Skip to content

[GenAI] Test fix for io.netty:netty-common:5.0.0.Alpha1 using gpt-5.5 - #9254

Open
jormundur00 wants to merge 14 commits into
masterfrom
ai/jormundur00/fix-javac-io.netty-netty-common-5.0.0.Alpha1
Open

[GenAI] Test fix for io.netty:netty-common:5.0.0.Alpha1 using gpt-5.5#9254
jormundur00 wants to merge 14 commits into
masterfrom
ai/jormundur00/fix-javac-io.netty-netty-common-5.0.0.Alpha1

Conversation

@jormundur00

Copy link
Copy Markdown
Member

What does this PR do?

Fixes: #9160

This PR provides test fixes and new metadata for io.netty:netty-common:5.0.0.Alpha1, addressing compile java failures caused by changes in the updated library version.

Summary:

  • Strategy: javac_iterative_with_coverage_sources_pi_gpt-5.5
  • Agent: pi
  • Model: gpt-5.5
  • Input tokens: 279522
  • Cached input tokens: 3156992
  • Output tokens: 31811
  • Metadata entries: 28
  • Test-only metadata entries: 4
  • Iterations: 12
  • Library coverage percentage: 14.44
  • Previous library version metadata entries: 1185
  • Previous library version test-only metadata entries: 2
  • Previous library version coverage percentage: 17.68

Forge

  • Forge monitored branch: origin/master
  • Forge branch: master
  • Forge commit hash: 16a7b2926ab94b31accff72fd0889c1b991c8f6d

Stats from stats/<groupId>/<artifactId>/<metadata-version>/stats.json

Dynamic access coverage

  • io.netty:netty-common:4.1.115.Final: 13/48 covered calls (27.08%)
  • io.netty:netty-common:5.0.0.Alpha1: 29/31 covered calls (93.55%)

Reflection:

  • io.netty:netty-common:4.1.115.Final: 13/42 covered calls (30.95%)
  • io.netty:netty-common:5.0.0.Alpha1: 28/30 covered calls (93.33%)

Resources:

  • io.netty:netty-common:4.1.115.Final: 0/6 covered calls (0.00%)
  • io.netty:netty-common:5.0.0.Alpha1: 1/1 covered calls (100.00%)

Library coverage

Instruction:

  • io.netty:netty-common:4.1.115.Final: 8546/52215 (16.37%)
  • io.netty:netty-common:5.0.0.Alpha1: 4458/34754 (12.83%)

Line:

  • io.netty:netty-common:4.1.115.Final: 2180/12333 (17.68%)
  • io.netty:netty-common:5.0.0.Alpha1: 1096/7589 (14.44%)

Method:

  • io.netty:netty-common:4.1.115.Final: 676/3215 (21.03%)
  • io.netty:netty-common:5.0.0.Alpha1: 254/1354 (18.76%)

Test-source comparison

/tmp/tmpm_2hht_k/{old => new}/build.gradle         |  28 ++
 ...oncurrentHashMapV8InnerCollectionViewTest.java} |  26 ++
 .../test/java/netty/ConcurrentHashMapV8Test.java}  |  49 +++
 .../netty/CountedCompleterAnonymous1Test.java}     |  33 ++
 .../new/src/test/java/netty/ForkJoinPoolTest.java} |  86 +++++
 .../new/src/test/java/netty/ForkJoinTaskTest.java} |  71 ++++
 .../src/test/java/netty/NettyTests.java            | 380 ++++-----------------
 .../test/java/netty/PlatformDependent0Test.java}   |  36 ++
 .../test/java/netty/Striped64Anonymous1Test.java}  |  28 ++
 .../test/java/netty/TypeParameterMatcherTest.java} |  35 ++
 .../new/src/test/java/netty/VersionTest.java}      |  64 ++++
 .../tmpm_2hht_k/new/user-code-filter.json}         |  16 +
 12 files changed, 533 insertions(+), 319 deletions(-)
diff --git a/tests/src/io.netty/netty-common/4.1.115.Final/build.gradle b/tests/src/io.netty/netty-common/5.0.0.Alpha1/build.gradle
index b43a60a937..19a0a84401 100644
--- a/tests/src/io.netty/netty-common/4.1.115.Final/build.gradle
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/build.gradle
@@ -16,6 +16,23 @@ dependencies {
     testImplementation 'org.awaitility:awaitility:4.2.0'
 }
 
+List<String> platformDependentAccessArgs = [
+        "--add-opens=java.base/java.nio=ALL-UNNAMED",
+        "--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED"
+]
+
+tasks.withType(Test).configureEach {
+    jvmArgs += platformDependentAccessArgs
+}
+
+graalvmNative {
+    binaries {
+        all {
+            buildArgs.addAll(platformDependentAccessArgs)
+        }
+    }
+}
+
 tasks.named("nativeTest") {
     if (libraryVersion.startsWith('4.2.')) {
         // Netty 4.2.x requires explicit unsafe access on Java 25 native runs.
@@ -26,3 +43,14 @@ tasks.named("nativeTest") {
         ])
     }
 }
+
+graalvmNative {
+    agent {
+        defaultMode = "conditional"
+        modes {
+            conditional {
+                userCodeFilterPath = "user-code-filter.json"
+            }
+        }
+    }
+}
diff --git a/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8InnerCollectionViewTest.java b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8InnerCollectionViewTest.java
new file mode 100644
index 0000000000..08a698fd5e
--- /dev/null
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8InnerCollectionViewTest.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright and related rights waived via CC0
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+package netty;
+
+import io.netty.util.internal.chmv8.ConcurrentHashMapV8;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ConcurrentHashMapV8InnerCollectionViewTest {
+    @Test
+    public void typedToArrayAllocatesResultWithRequestedComponentType() {
+        ConcurrentHashMapV8<String, Integer> map = new ConcurrentHashMapV8<>();
+        map.put("alpha", 1);
+        map.put("beta", 2);
+
+        String[] keys = map.keySet().toArray(new String[0]);
+
+        assertThat(keys).containsExactlyInAnyOrder("alpha", "beta");
+        assertThat(keys.getClass().getComponentType()).isEqualTo(String.class);
+    }
+}
diff --git a/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8Test.java b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8Test.java
new file mode 100644
index 0000000000..f39ab26e8d
--- /dev/null
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ConcurrentHashMapV8Test.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright and related rights waived via CC0
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+package netty;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import io.netty.util.internal.chmv8.ConcurrentHashMapV8;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ConcurrentHashMapV8Test {
+    @Test
+    public void serializesAndDeserializesEntries() throws IOException, ClassNotFoundException {
+        ConcurrentHashMapV8<String, String> map = new ConcurrentHashMapV8<>();
+        map.put("alpha", "one");
+        map.put("beta", "two");
+
+        Object restoredObject = deserialize(serialize(map));
+
+        assertThat(restoredObject).isInstanceOf(ConcurrentHashMapV8.class);
+        ConcurrentHashMapV8<?, ?> restored = (ConcurrentHashMapV8<?, ?>) restoredObject;
+        assertThat(restored).hasSize(2);
+        assertThat(restored.get("alpha")).isEqualTo("one");
+        assertThat(restored.get("beta")).isEqualTo("two");
+    }
+
+    private static byte[] serialize(Object value) throws IOException {
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        try (ObjectOutputStream out = new ObjectOutputStream(bytes)) {
+            out.writeObject(value);
+        }
+        return bytes.toByteArray();
+    }
+
+    private static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
+            return in.readObject();
+        }
+    }
+}
diff --git a/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/CountedCompleterAnonymous1Test.java b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/CountedCompleterAnonymous1Test.java
new file mode 100644
index 0000000000..39ce0b7acd
--- /dev/null
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/CountedCompleterAnonymous1Test.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright and related rights waived via CC0
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+package netty;
+
+import io.netty.util.internal.chmv8.CountedCompleter;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class CountedCompleterAnonymous1Test {
+    @Test
+    public void pendingCountOperationsUseInitializedUnsafeSupport() {
+        PendingTask task = new PendingTask();
+
+        assertThat(task.getPendingCount()).isZero();
+        task.addToPendingCount(2);
+        assertThat(task.getPendingCount()).isEqualTo(2);
+        assertThat(task.compareAndSetPendingCount(2, 1)).isTrue();
+        assertThat(task.decrementPendingCountUnlessZero()).isEqualTo(1);
+        assertThat(task.getPendingCount()).isZero();
+    }
+
+    public static final class PendingTask extends CountedCompleter<Integer> {
+        @Override
+        public void compute() {
+            complete(1);
+        }
+    }
+}
diff --git a/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinPoolTest.java b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinPoolTest.java
new file mode 100644
index 0000000000..2e26f630d1
--- /dev/null
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinPoolTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright and related rights waived via CC0
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+package netty;
+
+import io.netty.util.internal.chmv8.ForkJoinPool;
+import io.netty.util.internal.chmv8.ForkJoinWorkerThread;
+import org.junit.jupiter.api.Test;
+
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ForkJoinPoolTest {
+    private static final String COMMON_PARALLELISM_PROPERTY =
+            "java.util.concurrent.ForkJoinPool.common.parallelism";
+    private static final String COMMON_THREAD_FACTORY_PROPERTY =
+            "java.util.concurrent.ForkJoinPool.common.threadFactory";
+    private static final String COMMON_EXCEPTION_HANDLER_PROPERTY =
+            "java.util.concurrent.ForkJoinPool.common.exceptionHandler";
+
+    private static final AtomicInteger FACTORY_CONSTRUCTIONS = new AtomicInteger();
+    private static final AtomicInteger HANDLER_CONSTRUCTIONS = new AtomicInteger();
+
+    @Test
+    public void commonPoolLoadsConfiguredFactoryAndExceptionHandler() {
+        String previousParallelism = System.getProperty(COMMON_PARALLELISM_PROPERTY);
+        String previousFactory = System.getProperty(COMMON_THREAD_FACTORY_PROPERTY);
+        String previousHandler = System.getProperty(COMMON_EXCEPTION_HANDLER_PROPERTY);
+        try {
+            System.setProperty(COMMON_PARALLELISM_PROPERTY, "0");
+            System.setProperty(COMMON_THREAD_FACTORY_PROPERTY, ConfiguredWorkerThreadFactory.class.getName());
+            System.setProperty(COMMON_EXCEPTION_HANDLER_PROPERTY, ConfiguredExceptionHandler.class.getName());
+
+            ForkJoinPool pool = ForkJoinPool.commonPool();
+
+            assertThat(pool.getFactory()).isInstanceOf(ConfiguredWorkerThreadFactory.class);
+            assertThat(pool.getUncaughtExceptionHandler()).isInstanceOf(ConfiguredExceptionHandler.class);
+            assertThat(FACTORY_CONSTRUCTIONS).hasValue(1);
+            assertThat(HANDLER_CONSTRUCTIONS).hasValue(1);
+        } finally {
+            restoreProperty(COMMON_PARALLELISM_PROPERTY, previousParallelism);
+            restoreProperty(COMMON_THREAD_FACTORY_PROPERTY, previousFactory);
+            restoreProperty(COMMON_EXCEPTION_HANDLER_PROPERTY, previousHandler);
+        }
+    }
+
+    private static void restoreProperty(String property, String value) {
+        if (value == null) {
+            System.clearProperty(property);
+        } else {
+            System.setProperty(property, value);
+        }
+    }
+
+    public static final class ConfiguredWorkerThreadFactory implements ForkJoinPool.ForkJoinWorkerThreadFactory {
+        public ConfiguredWorkerThreadFactory() {
+            FACTORY_CONSTRUCTIONS.incrementAndGet();
+        }
+
+        @Override
+        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
+            return new ConfiguredWorkerThread(pool);
+        }
+    }
+
+    public static final class ConfiguredExceptionHandler implements UncaughtExceptionHandler {
+        public ConfiguredExceptionHandler() {
+            HANDLER_CONSTRUCTIONS.incrementAndGet();
+        }
+
+        @Override
+        public void uncaughtException(Thread thread, Throwable throwable) {
+        }
+    }
+
+    private static final class ConfiguredWorkerThread extends ForkJoinWorkerThread {
+        private ConfiguredWorkerThread(ForkJoinPool pool) {
+            super(pool);
+        }
+    }
+}
diff --git a/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinTaskTest.java b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinTaskTest.java
new file mode 100644
index 0000000000..65e27d366f
--- /dev/null
+++ b/tests/src/io.netty/netty-common/5.0.0.Alpha1/src/test/java/netty/ForkJoinTaskTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright and related rights waived via CC0
+ *
+ * You should have received a copy of the CC0 legalcode along with this
+ * work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+package netty;
+
+import io.netty.util.internal.chmv8.ForkJoinTask;
+import org.junit.jupiter.api.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ForkJoinTaskTest {
+    @Test
+    public void completedTaskCanBeSerializedAndDeserialized() throws IOException, ClassNotFoundException {
+        SerializableTask task = new SerializableTask("netty");
+
+        assertThat(task.invoke()).isEqualTo("netty");
+
+        SerializableTask deserialized = deserialize(serialize(task));
+
+        assertThat(deserialized.isCompletedNormally()).isTrue();
+        assertThat(deserialized.join()).isEqualTo("netty");
+    }
+
+    private static byte[] serialize(SerializableTask task) throws IOException {
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        try (ObjectOutputStream output = new ObjectOutputStream(bytes)) {
+            output.writeObject(task);
+        }
+        return bytes.toByteArray();
+    }
+
+    private static SerializableTas

The complete test diff is available in this pull request's Files changed tab.

Local CI Verification

  • Status: success
  • Commands run: 2
  • Fixup attempts: 0

@jormundur00 jormundur00 added GenAI PRs produced by generative AI fixes-javac-fail Fixes issues during update with javac labels Aug 6, 2026
@jormundur00
jormundur00 force-pushed the ai/jormundur00/fix-javac-io.netty-netty-common-5.0.0.Alpha1 branch from b8e5d05 to e0c8b8b Compare August 7, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-javac-fail Fixes issues during update with javac GenAI PRs produced by generative AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Automation] javac compile fails for io.netty:netty-common:5.0.0.Alpha1

1 participant