Skip to content

Commit

Permalink
feat: provide a more agressive class pruning in the JCTools shading
Browse files Browse the repository at this point in the history
  • Loading branch information
jponge committed Sep 23, 2024
1 parent 55c8d14 commit 671f86e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
22 changes: 17 additions & 5 deletions no-deps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,23 @@
</filter>
<filter>
<artifact>org.jctools:jctools-core</artifact>
<excludes>
<exclude>org/jctools/counters/**</exclude>
<exclude>org/jctools/maps/**</exclude>
<exclude>org/jctools/queues/unpadded/**</exclude>
</excludes>
<includes>
<include>org/jctools/queues/atomic/unpadded/**</include>
<include>org/jctools/queues/MessagePassingQueue*</include>
<include>org/jctools/queues/IndexedQueueSizeUtil*</include>
<include>org/jctools/queues/QueueProgressIndicators*</include>
<include>org/jctools/queues/SupportsIterator*</include>
<include>org/jctools/queues/BaseLinkedQueue*</include>
<include>org/jctools/queues/LinkedQueueNode*</include>
<include>org/jctools/queues/atomic/AtomicQueueUtil*</include>
<include>org/jctools/queues/atomic/AtomicReferenceArrayQueue*</include>
<include>org/jctools/queues/atomic/SequencedAtomicReferenceArrayQueue*</include>
<include>org/jctools/queues/atomic/LinkedQueueAtomicNode*</include>
<include>org/jctools/util/SpscLookAheadUtil*</include>
<include>org/jctools/util/Pow2*</include>
<include>org/jctools/util/RangeUtil*</include>
<include>org/jctools/util/UnsafeAccess*</include>
</includes>
</filter>
</filters>
<transformers>
Expand Down
42 changes: 18 additions & 24 deletions no-deps/src/test/java/io/smallrye/mutiny/nodeps/ShadingIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,30 @@
public class ShadingIT {

@Test
public void check_shaded_classes() throws ClassNotFoundException {
public void check_class_relocation() throws ClassNotFoundException {
Class.forName("io.smallrye.mutiny.shaded.org.jctools.queues.BaseLinkedQueue");
Class.forName("io.smallrye.mutiny.shaded.org.jctools.queues.atomic.unpadded.BaseLinkedAtomicUnpaddedQueue");
Class.forName("io.smallrye.mutiny.shaded.io.smallrye.common.annotation.CheckReturnValue");
}

@Test
public void mpsc_queue_factory() {
Queue<String> queue = Queues.createMpscArrayQueue(256);

queue.add("foo");
queue.add("bar");
assertEquals("foo", queue.poll());
assertEquals("bar", queue.poll());
assertNull(queue.poll());

assertTrue(queue.getClass().getCanonicalName().contains("shaded"));
}

@Test
public void spsc_queue_factory() {
Queue<String> queue = Queues.createSpscArrayQueue(256);

queue.add("foo");
queue.add("bar");
assertEquals("foo", queue.poll());
assertEquals("bar", queue.poll());
assertNull(queue.poll());

assertTrue(queue.getClass().getCanonicalName().contains("shaded"));
public void check_factories() {
List<Queue<String>> queues = List.of(
Queues.createSpscArrayQueue(256),
Queues.createSpscUnboundedArrayQueue(256),
Queues.createSpscChunkedArrayQueue(256),
Queues.createMpscQueue(),
Queues.createSpscUnboundedQueue(256),
Queues.createMpscArrayQueue(256));

queues.forEach(queue -> {
queue.add("foo");
queue.add("bar");
assertEquals("foo", queue.poll());
assertEquals("bar", queue.poll());
assertNull(queue.poll());
assertTrue(queue.getClass().getCanonicalName().contains("shaded"));
});
}

@Test
Expand Down

0 comments on commit 671f86e

Please sign in to comment.