From 1d381b81e35bcb9e415883770b15e9a42e02e08d Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 22 Jan 2026 12:52:45 +0100 Subject: [PATCH 01/10] CI: bump lower bound to JDK 21 new test and build range: JDK 21-26 few modules are still stuck on 17 and got special treatment --- .github/workflows/main.yml | 79 +++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 706c88fdb4e5..6f12a10fa972 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,7 +137,7 @@ jobs: timeout-minutes: 40 strategy: matrix: - java: [ '17', '25', '26-ea' ] + java: [ '21', '25', '26-ea' ] exclude: - java: ${{ github.event_name == 'pull_request' && 'nothing' || '25' }} fail-fast: false @@ -167,11 +167,11 @@ jobs: run: ant $OPTS -quiet -Dcluster.config=$CLUSTER_CONFIG build-nozip - name: Prepare Artifact - if: ${{ matrix.java == '17' }} + if: ${{ matrix.java == '21' }} run: tar -I 'zstd -9 -T0' -cf /tmp/build.tar.zst --exclude ".git" . - name: Upload Workspace - if: ${{ (matrix.java == '17') && success() }} + if: ${{ (matrix.java == '21') && success() }} uses: actions/upload-artifact@v6 with: name: build @@ -181,11 +181,11 @@ jobs: if-no-files-found: error - name: Create Dev Build - if: ${{ matrix.java == '17' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} + if: ${{ matrix.java == '21' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} run: ant $OPTS -quiet -Dcluster.config=$CLUSTER_CONFIG zip-cluster-config - name: Upload Dev Build - if: ${{ matrix.java == '17' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} + if: ${{ matrix.java == '21' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} uses: actions/upload-artifact@v6 with: name: dev-build_${{github.event.pull_request.number || github.run_id}} @@ -239,7 +239,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - java: [ 17 ] + java: [ '21' ] include: - os: ubuntu-latest java: 26-ea @@ -273,7 +273,7 @@ jobs: run: tar --zstd -xf build.tar.zst - name: platform/masterfs - if: ${{ matrix.java == '17' }} + if: ${{ matrix.java == '21' }} run: .github/retry.sh ant $OPTS -f platform/masterfs test - name: Commit Validation tests @@ -301,7 +301,7 @@ jobs: ANT_OPTS: -Dmetabuild.jsonurl=https://raw.githubusercontent.com/apache/netbeans-jenkins-lib/master/meta/netbeansrelease.json strategy: matrix: - java: [ '17' ] + java: [ '21' ] steps: - name: Check PR labels @@ -379,7 +379,7 @@ jobs: timeout-minutes: 100 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -473,7 +473,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] config: [ 'platform', 'release' ] fail-fast: false steps: @@ -519,7 +519,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -849,9 +849,9 @@ jobs: timeout-minutes: 50 strategy: matrix: - java: [ '17', '21', '25', '26-ea' ] + java: [ '21', '25', '26-ea' ] exclude: - - java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }} + - java: ${{ github.event_name == 'pull_request' && 'nothing' || '25' }} fail-fast: false steps: @@ -935,28 +935,35 @@ jobs: run: ant $OPTS -f java/gradle.test test - name: java/gradle.java - if: ${{ matrix.java == '17' || matrix.java == '21' || matrix.java == '25' }} + if: ${{ matrix.java == '21' || matrix.java == '25' }} run: .github/retry.sh ant $OPTS -f java/gradle.java test - name: extide/gradle - if: ${{ matrix.java == '17' || matrix.java == '21' || matrix.java == '25' }} + if: ${{ matrix.java == '21' || matrix.java == '25' }} run: ant $OPTS -f extide/gradle test - name: java/gradle.dependencies - if: ${{ matrix.java == '17' || matrix.java == '21' || matrix.java == '25' }} + if: ${{ matrix.java == '21' || matrix.java == '25' }} run: ant $OPTS -f java/gradle.dependencies test # TODO next are JDK 21 or 25 incompatibe steps - name: java/java.mx.project - if: ${{ matrix.java == '17' || matrix.java == '21' }} + if: ${{ matrix.java == '21' }} run: .github/retry.sh ant $OPTS -f java/java.mx.project test + - name: Set up JDK 17 for ant + uses: actions/setup-java@v5 + if: ${{ matrix.java == '21' }} + with: + java-version: 17 + distribution: ${{ env.DEFAULT_JAVA_DISTRIBUTION }} + - name: extide/o.apache.tools.ant.module - if: ${{ matrix.java == '17' }} + if: ${{ matrix.java == '21' }} run: ant $OPTS -f extide/o.apache.tools.ant.module test - name: apisupport.ant - if: ${{ matrix.java == '17' }} + if: ${{ matrix.java == '21' }} run: ant $OPTS -f apisupport/apisupport.ant test - name: Create Test Summary @@ -975,7 +982,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1138,7 +1145,7 @@ jobs: timeout-minutes: 90 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1273,7 +1280,7 @@ jobs: timeout-minutes: 100 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1459,7 +1466,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17', '26-ea' ] + java: [ '21', '26-ea' ] config: [ 'batch1', 'batch2' ] exclude: - java: ${{ github.event_name == 'pull_request' && 'nothing' || '26-ea' }} @@ -1516,7 +1523,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17', '25', '26-ea' ] + java: [ '21', '25', '26-ea' ] exclude: - java: ${{ github.event_name == 'pull_request' && 'nothing' || '25' }} fail-fast: false @@ -1578,7 +1585,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1623,7 +1630,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1801,7 +1808,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1849,9 +1856,9 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17', '21' ] - exclude: - - java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }} + java: [ '21' ] +# exclude: +# - java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }} fail-fast: false steps: @@ -1902,7 +1909,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -1950,7 +1957,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -2195,7 +2202,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: @@ -2278,7 +2285,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false services: @@ -2340,7 +2347,7 @@ jobs: DISPLAY: ":99.0" strategy: matrix: - java: [ '17' ] + java: [ '21' ] os: [ 'windows-latest', 'ubuntu-latest' ] exclude: - os: ${{ github.event_name == 'pull_request' && 'nothing' || 'windows-latest' }} @@ -2496,7 +2503,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - java: [ '17' ] + java: [ '21' ] fail-fast: false steps: From 56df0cb2ef6fddb21b0d1d948207615d83619fdf Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 23 Jan 2026 23:52:03 +0100 Subject: [PATCH 02/10] Updated java.editor and java.source tests for JDK 21 and 25 - added unimportant classes to the ignore list so that the test data doesn't have to be updated. - refactored file read monitoring from SecurityManager to JFR --- .../editor/imports/ComputeImportsTest.java | 11 +-- .../nbproject/project.properties | 2 +- .../api/java/source/TreePathHandleTest.java | 67 ++++++++----------- 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/imports/ComputeImportsTest.java b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/imports/ComputeImportsTest.java index a43ef3f0b499..95c431526546 100644 --- a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/imports/ComputeImportsTest.java +++ b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/imports/ComputeImportsTest.java @@ -34,7 +34,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -68,7 +67,7 @@ */ public class ComputeImportsTest extends NbTestCase { - private static final Set IGNORE_CLASSES = new HashSet(Arrays.asList(new String[] { + private static final Set IGNORE_CLASSES = Set.of( "com.sun.tools.javac.util.List", "com.sun.tools.javac.code.Attribute.RetentionPolicy", "com.sun.tools.classfile.Opcode.Set", @@ -81,6 +80,8 @@ public class ComputeImportsTest extends NbTestCase { "com.sun.xml.internal.bind.v2.runtime.output.NamespaceContextImpl.Element", "com.sun.xml.internal.bind.v2.schemagen.xmlschema.Element", "sun.text.normalizer.RangeValueIterator.Element", + "jdk.internal.org.commonmark.node.Document", + "java.lang.StringTemplate.STR", "javax.xml.bind.Element", "javax.lang.model.element.Element", "com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList", @@ -90,13 +91,13 @@ public class ComputeImportsTest extends NbTestCase { "com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type.Element", "com.sun.xml.internal.ws.policy.privateutil.PolicyUtils.Collections", "com.azul.crs.client.service.JarLoadMonitor.ProcessedJarFiles.LRU.Element" - })); + ); - private static final List IGNORE_PATTERNS = Collections.unmodifiableList(Arrays.asList( + private static final List IGNORE_PATTERNS = List.of( Pattern.compile("jdk\\..*\\.internal\\..*"), Pattern.compile("org\\.graalvm\\..*"), Pattern.compile("com\\.azul\\.crs\\..*") // https://docs.azul.com/vulnerability-detection/detailed-information/configuration-options - )); + ); private FileObject testSource; private JavaSource js; diff --git a/java/java.source.base/nbproject/project.properties b/java/java.source.base/nbproject/project.properties index e74394ad6113..923ec707672b 100644 --- a/java/java.source.base/nbproject/project.properties +++ b/java/java.source.base/nbproject/project.properties @@ -206,5 +206,5 @@ test.config.vanilla-javac.excludes=\ # remove default compiler JMS flags so that we don't get "Unknown module" warnings due to --limit-modules jms-compiler.flags.jvm= -test.jms.flags=--limit-modules=java.base,java.logging,java.xml,java.prefs,java.desktop,java.management,java.instrument,jdk.zipfs,java.scripting,java.naming +test.jms.flags=--limit-modules=java.base,java.logging,java.xml,java.prefs,java.desktop,java.management,java.instrument,jdk.zipfs,java.scripting,java.naming,jdk.jfr test.bootclasspath.prepend.args=-Dno.netbeans.bootclasspath.prepend.needed=true diff --git a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java index 950c9fa6afcf..6d762690fcdc 100644 --- a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java +++ b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java @@ -26,10 +26,11 @@ import com.sun.source.util.TreePath; import java.io.File; import java.io.OutputStream; -import java.security.Permission; +import java.util.concurrent.atomic.AtomicBoolean; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import jdk.jfr.consumer.RecordingStream; import org.netbeans.api.java.source.JavaSource.Phase; import org.netbeans.core.startup.Main; import org.netbeans.junit.NbTestCase; @@ -51,6 +52,7 @@ public TreePathHandleTest(String testName) { private FileObject sourceRoot; + @Override protected void setUp() throws Exception { clearWorkDir(); @@ -170,29 +172,40 @@ public void test134457() throws Exception { public void testTreePathIsNotParsing() throws Exception { FileObject file = FileUtil.createData(sourceRoot, "test/test.java"); - writeIntoFile(file, "package test; public class test {}"); - writeIntoFile(FileUtil.createData(sourceRoot, "test/test2.java"), "package test; public class test2 {}"); + + FileObject file2 = FileUtil.createData(sourceRoot, "test/test2.java"); + writeIntoFile(file2, "package test; public class test2 {}"); JavaSource js = JavaSource.forFileObject(file); SourceUtilsTestUtil.compileRecursively(sourceRoot); - js.runUserActionTask(new Task() { - public void run(CompilationController parameter) throws Exception { - parameter.toPhase(Phase.RESOLVED); - - TypeElement string = parameter.getElements().getTypeElement("test.test2"); - - SecurityManager old = System.getSecurityManager(); - - System.setSecurityManager(new SecMan()); - - TreePathHandle.create(string, parameter); - - System.setSecurityManager(old); + AtomicBoolean wasRead = new AtomicBoolean(); + + js.runUserActionTask(controller -> { + controller.toPhase(Phase.RESOLVED); + + TypeElement string = controller.getElements().getTypeElement("test.test2"); + + try (RecordingStream rs = new RecordingStream()) { + rs.setMaxSize(Long.MAX_VALUE); + rs.enable("jdk.FileRead").withoutThreshold().withStackTrace(); + rs.onEvent("jdk.FileRead", e -> { + if (e.getString("path").endsWith("test2.java")) { + wasRead.set(true); + System.err.println(e); + } + }); + rs.startAsync(); +// file2.getInputStream().read(); // check: commenting this in should fail the test + TreePathHandle.create(string, controller); + // TODO call directly post JDK 21 bump + RecordingStream.class.getMethod("stop").invoke(rs); // flushes stream } }, true); + + assertFalse("file was read", wasRead.get()); } public void testEquals() throws Exception { @@ -454,26 +467,4 @@ public void testVarInstanceMember() throws Exception { assertNotNull(handle.getElementHandle()); JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = false; } - - private static final class SecMan extends SecurityManager { - - @Override - public void checkRead(String file) { - assertFalse(file.endsWith("test2.java")); - } - - @Override - public void checkRead(String file, Object context) { - assertFalse(file.endsWith("test2.java")); - } - - @Override - public void checkPermission(Permission perm) { - } - - @Override - public void checkPermission(Permission perm, Object context) { - } - - } } From 1a05b62ab810b3e521ec94c8836a6a55cceef4b8 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 16:55:10 +0100 Subject: [PATCH 03/10] Update enterprise/micronaut completion test data for JDK 21 --- .../allTypes.pass | 5 ++++- .../ctxTypes.pass | 5 ++++- .../intMethods.pass | 2 ++ .../intStaticMethods.pass | 2 ++ .../javaLangPackageContent.pass | 6 +++++- .../stringMethods.pass | 3 +++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/allTypes.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/allTypes.pass index 014426affcfe..feaf949b0a5f 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/allTypes.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/allTypes.pass @@ -20,7 +20,6 @@ ClassValue CloneNotSupportedException Cloneable Comparable -Compiler Deprecated Double Enum @@ -49,6 +48,7 @@ Iterable LayerInstantiationException LinkageError Long +MatchException Math Module ModuleLayer @@ -76,6 +76,7 @@ Runtime RuntimeException RuntimePermission SafeVarargs +ScopedValue SecurityException SecurityManager Short @@ -87,6 +88,7 @@ String StringBuffer StringBuilder StringIndexOutOfBoundsException +StringTemplate SuppressWarnings System Thread @@ -102,6 +104,7 @@ UnsupportedOperationException VerifyError VirtualMachineError Void +WrongThreadException com io jakarta diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/ctxTypes.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/ctxTypes.pass index 291b09aee455..5e9c14a0793b 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/ctxTypes.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/ctxTypes.pass @@ -21,7 +21,6 @@ ClassValue CloneNotSupportedException Cloneable Comparable -Compiler Deprecated Double Enum @@ -50,6 +49,7 @@ Iterable LayerInstantiationException LinkageError Long +MatchException Math Module ModuleLayer @@ -77,6 +77,7 @@ Runtime RuntimeException RuntimePermission SafeVarargs +ScopedValue SecurityException SecurityManager Short @@ -88,6 +89,7 @@ String StringBuffer StringBuilder StringIndexOutOfBoundsException +StringTemplate SuppressWarnings System Thread @@ -103,6 +105,7 @@ UnsupportedOperationException VerifyError VirtualMachineError Void +WrongThreadException com io jakarta diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intMethods.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intMethods.pass index 7eeaa3435c84..a99e559130c8 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intMethods.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intMethods.pass @@ -3,11 +3,13 @@ byteValue() : byte compare(int x, int y) : int compareTo(Integer anotherInteger) : int compareUnsigned(int x, int y) : int +compress(int i, int mask) : int decode(String nm) : Integer describeConstable() : Optional divideUnsigned(int dividend, int divisor) : int doubleValue() : double equals(Object obj) : boolean +expand(int i, int mask) : int floatValue() : float getInteger(String nm) : Integer getInteger(String nm, Integer val) : Integer diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intStaticMethods.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intStaticMethods.pass index 0a92dc03ca49..1aba581617f8 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intStaticMethods.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/intStaticMethods.pass @@ -1,8 +1,10 @@ bitCount(int i) : int compare(int x, int y) : int compareUnsigned(int x, int y) : int +compress(int i, int mask) : int decode(String nm) : Integer divideUnsigned(int dividend, int divisor) : int +expand(int i, int mask) : int getInteger(String nm) : Integer getInteger(String nm, Integer val) : Integer getInteger(String nm, int val) : Integer diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/javaLangPackageContent.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/javaLangPackageContent.pass index ca6e5c869912..9c95206c2f0c 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/javaLangPackageContent.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/javaLangPackageContent.pass @@ -20,7 +20,6 @@ ClassValue CloneNotSupportedException Cloneable Comparable -Compiler Deprecated Double Enum @@ -49,6 +48,7 @@ Iterable LayerInstantiationException LinkageError Long +MatchException Math Module ModuleLayer @@ -76,6 +76,7 @@ Runtime RuntimeException RuntimePermission SafeVarargs +ScopedValue SecurityException SecurityManager Short @@ -87,6 +88,7 @@ String StringBuffer StringBuilder StringIndexOutOfBoundsException +StringTemplate SuppressWarnings System Thread @@ -102,8 +104,10 @@ UnsupportedOperationException VerifyError VirtualMachineError Void +WrongThreadException annotation constant +foreign instrument invoke management diff --git a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/stringMethods.pass b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/stringMethods.pass index 4363207a59e8..5029e946810a 100644 --- a/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/stringMethods.pass +++ b/enterprise/micronaut/test/unit/data/goldenfiles/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageConstructsCompletionTest/stringMethods.pass @@ -33,6 +33,8 @@ indexOf(String str) : int indexOf(int ch) : int indexOf(String str, int fromIndex) : int indexOf(int ch, int fromIndex) : int +indexOf(String str, int beginIndex, int endIndex) : int +indexOf(int ch, int beginIndex, int endIndex) : int intern() : String isBlank() : boolean isEmpty() : boolean @@ -56,6 +58,7 @@ replaceFirst(String regex, String replacement) : String resolveConstantDesc(Lookup lookup) : String split(String regex) : String[] split(String regex, int limit) : String[] +splitWithDelimiters(String regex, int limit) : String[] startsWith(String prefix) : boolean startsWith(String prefix, int toffset) : boolean strip() : String From c13c0cef7e17ab2dbf3be8807ae5ae6c570bd239 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 01:25:43 +0100 Subject: [PATCH 04/10] Tests: enable SM where still needed - remove no longer needed SM usage in ide/xsl test - remove NBBundleWithSecurityManager test - remove NbLifecycleManagerEDTTest which is similar to LifecycleManagerEDTTest in openide.util.ui --- .../nbproject/project.properties | 3 ++ ide/versioning/nbproject/project.properties | 3 ++ .../xsl/transform/TransformServletTest.java | 49 ----------------- .../nbproject/project.properties | 2 + .../core.startup/nbproject/project.properties | 3 ++ .../masterfs/nbproject/project.properties | 3 ++ .../netbinox/nbproject/project.properties | 3 ++ .../nbproject/project.properties | 4 ++ .../core/NbLifecycleManagerEDTTest.java | 35 ------------- .../netbeans/core/NbLifecycleManagerTest.java | 4 +- .../nbproject/project.properties | 3 ++ .../nbproject/project.properties | 3 ++ .../nbproject/project.properties | 3 ++ .../nbproject/project.properties | 3 ++ .../nbproject/project.properties | 3 ++ .../NbBundleWithSecurityManager.properties | 18 ------- .../util/NbBundleWithSecurityManagerTest.java | 52 ------------------- 17 files changed, 38 insertions(+), 156 deletions(-) delete mode 100644 platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerEDTTest.java delete mode 100644 platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManager.properties delete mode 100644 platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManagerTest.java diff --git a/harness/apisupport.harness/nbproject/project.properties b/harness/apisupport.harness/nbproject/project.properties index ca593b9ca344..066614f085e3 100644 --- a/harness/apisupport.harness/nbproject/project.properties +++ b/harness/apisupport.harness/nbproject/project.properties @@ -97,3 +97,6 @@ test.unit.cp.extra=${netbeans.dest.dir}/harness/jnlp/jnlp-launcher.jar javadoc.arch=${basedir}/arch.xml test.config.stableBTD.includes=**/*Test.class + +# TODO needed for tests; remove with jnlp code +test.jms.flags=-Djava.security.manager=allow diff --git a/ide/versioning/nbproject/project.properties b/ide/versioning/nbproject/project.properties index 41a90285112a..9822f827d24b 100644 --- a/ide/versioning/nbproject/project.properties +++ b/ide/versioning/nbproject/project.properties @@ -43,3 +43,6 @@ test.config.stableBTD.excludes=\ **/GetAnnotatedOwnerTest.class,\ **/VCSContextTest.class,\ **/VersioningAnnotationProviderTest.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/ide/xsl/test/unit/src/org/netbeans/modules/xsl/transform/TransformServletTest.java b/ide/xsl/test/unit/src/org/netbeans/modules/xsl/transform/TransformServletTest.java index 802bcb3e3bca..6346ffe23f28 100644 --- a/ide/xsl/test/unit/src/org/netbeans/modules/xsl/transform/TransformServletTest.java +++ b/ide/xsl/test/unit/src/org/netbeans/modules/xsl/transform/TransformServletTest.java @@ -18,34 +18,11 @@ */ package org.netbeans.modules.xsl.transform; -//import java.io.*; import java.net.*; -import java.security.Permission; -//import java.util.*; - -//import javax.servlet.*; -//import javax.servlet.http.*; import junit.framework.*; import org.netbeans.junit.*; -/*import org.openide.util.HttpServer; -import org.openide.filesystems.FileObject; -import org.openide.util.SharedClassObject; -import org.openide.filesystems.FileUtil; -import org.openide.execution.NbfsURLConnection; - -import org.xml.sax.*; -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.sax.*; -import javax.xml.transform.stream.*; - -import org.netbeans.api.xml.cookies.*; -import org.netbeans.spi.xml.cookies.*; - -import org.netbeans.modules.xsl.utils.TransformUtil; -*/ /** * * @author Libor Kramolis @@ -60,15 +37,12 @@ public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(suite()); } - - public static Test suite() { TestSuite suite = new NbTestSuite(TransformServletTest.class); return suite; } - /** Test of getServletURL method, of class org.netbeans.modules.xsl.transform.TransformServlet. */ public void testGetServletURL() { // issue #196602 @@ -85,28 +59,5 @@ public void testGetServletURL() { assertTrue ("I need correct Transform Servlet URL!", (servletURL!=null & exceptionThrown!= true)); } - - @Override - protected void setUp() throws Exception { - super.setUp(); - SecurityManager sm = new SecurityManager() { - - @Override - public void checkPermission(Permission perm) { - } - - @Override - public void checkPermission(Permission perm, Object context) { - } - - }; - System.setSecurityManager(sm); - } - - @Override - protected void tearDown() throws Exception { - System.setSecurityManager(null); - super.tearDown(); - } } diff --git a/platform/core.startup.base/nbproject/project.properties b/platform/core.startup.base/nbproject/project.properties index 6e4f1711c5f7..0a484e2ef52c 100644 --- a/platform/core.startup.base/nbproject/project.properties +++ b/platform/core.startup.base/nbproject/project.properties @@ -24,3 +24,5 @@ javadoc.arch=${basedir}/arch.xml test-unit-sys-prop.xtest.data=${nb_all}/platform/o.n.bootstrap/test/unit/data test.unit.data.dir=${nb_all}/platform/o.n.bootstrap/test/unit/data +# TODO remove SM usage in test (testURLNoInetAccess) +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/core.startup/nbproject/project.properties b/platform/core.startup/nbproject/project.properties index f328f174001a..d77be16e95d5 100644 --- a/platform/core.startup/nbproject/project.properties +++ b/platform/core.startup/nbproject/project.properties @@ -50,3 +50,6 @@ test.config.stableBTD.excludes=\ **/SystemFileSystemTest.class,\ **/TopLoggingNbLoggerConsoleTest.class,\ **/TopLoggingStartLogTest.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/masterfs/nbproject/project.properties b/platform/masterfs/nbproject/project.properties index b0188f8ed182..95ac0d9f4d76 100644 --- a/platform/masterfs/nbproject/project.properties +++ b/platform/masterfs/nbproject/project.properties @@ -36,3 +36,6 @@ test.config.stableBTD.excludes=\ **/SlowRefreshSuspendableTest.class,\ **/StatFilesTest.class spec.version.base=2.87.0 + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/netbinox/nbproject/project.properties b/platform/netbinox/nbproject/project.properties index a9205738019b..31a4902af2d3 100644 --- a/platform/netbinox/nbproject/project.properties +++ b/platform/netbinox/nbproject/project.properties @@ -28,3 +28,6 @@ test.config.stableBTD.excludes=\ **/CachingPreventsFileTouchesTest.class,\ **/LogReaderServiceTest.class,\ **/NetigsoHasSAXParserTest.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow \ No newline at end of file diff --git a/platform/o.n.bootstrap/nbproject/project.properties b/platform/o.n.bootstrap/nbproject/project.properties index 429461e1f047..87855f16d1e0 100644 --- a/platform/o.n.bootstrap/nbproject/project.properties +++ b/platform/o.n.bootstrap/nbproject/project.properties @@ -31,3 +31,7 @@ javadoc.apichanges=${basedir}/apichanges.xml # When changing this list, change 'verifyexcludes' param. of 'makejnlp' task in apisupport.harness/release/jnlp.xml as well jnlp.verify.excludes=lib/nbexec,lib/nbexec.exe,lib/nbexec64.exe,lib/nbexec.dll,lib/nbexec64.dll + + +# TODO remove SM usage in test (JarClassLoaderTest, StampsExtraTest, StampsTest, StampsWithDotDotTest) +test.jms.flags=-Djava.security.manager=allow \ No newline at end of file diff --git a/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerEDTTest.java b/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerEDTTest.java deleted file mode 100644 index af2b167716bc..000000000000 --- a/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerEDTTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.netbeans.core; - -/** - * - * @author Jaroslav Tulach - */ -public class NbLifecycleManagerEDTTest extends NbLifecycleManagerTest { - - public NbLifecycleManagerEDTTest(String n) { - super(n); - } - - @Override - protected boolean runInEQ() { - return true; - } -} diff --git a/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerTest.java b/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerTest.java index f9ea0cc7de57..60a11054c1e8 100644 --- a/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerTest.java +++ b/platform/o.n.core/test/unit/src/org/netbeans/core/NbLifecycleManagerTest.java @@ -18,14 +18,14 @@ */ package org.netbeans.core; +import org.netbeans.junit.NbTestCase; import org.openide.LifecycleManager; -import org.openide.LifecycleManagerTest; /** * * @author Jaroslav Tulach */ -public class NbLifecycleManagerTest extends LifecycleManagerTest { +public class NbLifecycleManagerTest extends NbTestCase { public NbLifecycleManagerTest(String n) { super(n); diff --git a/platform/openide.execution/nbproject/project.properties b/platform/openide.execution/nbproject/project.properties index 5861684c4e8a..b48ccb792f07 100644 --- a/platform/openide.execution/nbproject/project.properties +++ b/platform/openide.execution/nbproject/project.properties @@ -26,3 +26,6 @@ javadoc.apichanges=${basedir}/apichanges.xml jnlp.verify.excludes=config/ModuleAutoDeps/org-openide-execution.xml test.config.stableBTD.includes=**/*Test.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/openide.filesystems/nbproject/project.properties b/platform/openide.filesystems/nbproject/project.properties index 800dc69b22c0..00f163c75c29 100644 --- a/platform/openide.filesystems/nbproject/project.properties +++ b/platform/openide.filesystems/nbproject/project.properties @@ -42,3 +42,6 @@ test.config.stableBTD.excludes=\ **/StatFilesTest.class,\ **/URLMapperTestHidden.class,\ **/XMLFileSystemTest.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/openide.loaders/nbproject/project.properties b/platform/openide.loaders/nbproject/project.properties index e6ae801dd818..ac112f441eeb 100644 --- a/platform/openide.loaders/nbproject/project.properties +++ b/platform/openide.loaders/nbproject/project.properties @@ -21,3 +21,6 @@ javac.release=17 javadoc.main.page=org/openide/loaders/doc-files/api.html javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/openide.util.lookup/nbproject/project.properties b/platform/openide.util.lookup/nbproject/project.properties index f98abe2df894..89acefed377a 100644 --- a/platform/openide.util.lookup/nbproject/project.properties +++ b/platform/openide.util.lookup/nbproject/project.properties @@ -25,3 +25,6 @@ javadoc.apichanges=${basedir}/apichanges.xml module.javadoc.packages=org.openide.util,org.openide.util.lookup test.config.stableBTD.includes=**/*Test.class + +# TODO remove SM usage in tests +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/openide.util.ui/nbproject/project.properties b/platform/openide.util.ui/nbproject/project.properties index dbb46b717842..1bf394eb24b3 100644 --- a/platform/openide.util.ui/nbproject/project.properties +++ b/platform/openide.util.ui/nbproject/project.properties @@ -33,3 +33,6 @@ test.config.stableBTD.excludes=\ **/RequestProcessorParallelTest.class,\ **/TaskTest.class,\ **/UtilitiesTest.class + +# TODO remove SM usage in tests (LifecycleManagerEDTTest, LifecycleManagerTest, XMLUtilReflectionTest) +test.jms.flags=-Djava.security.manager=allow diff --git a/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManager.properties b/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManager.properties deleted file mode 100644 index 4e88e515a17c..000000000000 --- a/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManager.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -HELLO=World diff --git a/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManagerTest.java b/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManagerTest.java deleted file mode 100644 index 4c87889f6ac4..000000000000 --- a/platform/openide.util/test/unit/src/org/openide/util/NbBundleWithSecurityManagerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.openide.util; - -import java.security.Permission; -import java.util.ResourceBundle; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.junit.Test; - -public class NbBundleWithSecurityManagerTest { - @Test - public void testQueue() { - final Thread[] raised = { null }; - System.setSecurityManager(new SecurityManager() { - @Override - public void checkAccess(Thread t) { - if (t.getClass().getName().startsWith("java.util.logging")) { - return; - } - raised[0] = t; - throw new SecurityException(); - } - - @Override - public void checkPermission(Permission perm) { - } - }); - ResourceBundle bundle = NbBundle.getBundle("org.openide.util.NbBundleWithSecurityManager"); - assertNotNull("Bundle found", bundle); - assertEquals("World", bundle.getString("HELLO")); - - System.setSecurityManager(null); - assertNotNull("The thread has been prevented from being started", raised[0]); - } -} From 550420531c7afcde7880578c1d70a2c9273338a7 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 04:20:38 +0100 Subject: [PATCH 05/10] disable JDK 21 incompatible tests (Thread.stop()) --- .github/workflows/main.yml | 5 +++-- .../test/unit/src/org/openide/nodes/ChildrenKeysTest.java | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f12a10fa972..e1092081b10b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -420,8 +420,9 @@ jobs: - name: ergonomics/ide.ergonomics run: ant $OPTS -f ergonomics/ide.ergonomics test -Dtest.config=commit - - name: nb/deadlock.detector - run: ant $OPTS -f nb/deadlock.detector test + # TODO not JDK 21 compatible +# - name: nb/deadlock.detector +# run: ant $OPTS -f nb/deadlock.detector test - name: nb/ide.branding run: ant $OPTS -f nb/ide.branding test diff --git a/platform/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java b/platform/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java index e0487d6eec34..230bbe7739bc 100644 --- a/platform/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java +++ b/platform/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java @@ -137,12 +137,14 @@ public void run() { }//fail("Ok"); } - /** + /* * See #78519 * T1 has write access and gets preempted just before call to * getNodes() by another thread callig getNodes. * Other thread */ + // TODO uses Thread.stop(); rewrite or remove + /* public void testGetNodesFromWriteAccess() throws Exception { final String[] keys = { "Nenik", "Tulach" }; Keys o = new Keys (lazy(), keys); @@ -195,7 +197,8 @@ public void run() { assertTrue ("Preempted thread finished correctly", done[0]); assertTrue ("Other thread finished correctly", done[1]); } - + */ + public void testNodesCountDelegated() throws Exception { class K extends Children.Keys { int cnt; From 308512f231a1b8d7fca75290be149f61bbb296be Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 15:50:15 +0100 Subject: [PATCH 06/10] Fix htmlui tests: source/target 7 is no longer supported by javac --- .../test/unit/src/org/netbeans/api/htmlui/Compile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/api.htmlui/test/unit/src/org/netbeans/api/htmlui/Compile.java b/platform/api.htmlui/test/unit/src/org/netbeans/api/htmlui/Compile.java index 6b7f5faba6f3..95ca12922944 100644 --- a/platform/api.htmlui/test/unit/src/org/netbeans/api/htmlui/Compile.java +++ b/platform/api.htmlui/test/unit/src/org/netbeans/api/htmlui/Compile.java @@ -71,7 +71,7 @@ private Compile(String htmlName, String html, String code, String sl) throws IOE /** Performs compilation of given HTML page and associated Java code */ public static Compile create(String htmlName, String html, String code) throws IOException { - return create(htmlName, html, code, "1.7"); + return create(htmlName, html, code, "1.8"); } static Compile create(String htmlName, String html, String code, String sourceLevel) throws IOException { return new Compile(htmlName, html, code, sourceLevel); @@ -208,7 +208,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept } }; - ToolProvider.getSystemJavaCompiler().getTask(null, jfm, this, Arrays.asList("-source", sourceLevel, "-target", "1.7"), null, Arrays.asList(file)).call(); + ToolProvider.getSystemJavaCompiler().getTask(null, jfm, this, Arrays.asList("-source", sourceLevel, "-target", sourceLevel), null, Arrays.asList(file)).call(); Map result = new HashMap(); From 9c920e9cb71a458c7dc4761bf33121bdfd92ae40 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 16:10:11 +0100 Subject: [PATCH 07/10] Disable failing object size estimation test --- .../apisupport/project/layers/WritableXMLFileSystemTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apisupport/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/layers/WritableXMLFileSystemTest.java b/apisupport/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/layers/WritableXMLFileSystemTest.java index 6075ee37fd2c..e95b9cc15992 100644 --- a/apisupport/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/layers/WritableXMLFileSystemTest.java +++ b/apisupport/apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/layers/WritableXMLFileSystemTest.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; +import org.junit.Ignore; import org.netbeans.junit.RandomlyFails; import org.netbeans.modules.apisupport.project.TestUtil; import org.netbeans.modules.apisupport.project.layers.LayerUtils.SavableTreeEditorCookie; @@ -667,6 +668,7 @@ public void testExternalFileChangesRefired() throws Exception { fcl.changes()); } + @Ignore("fails on JDK 21+") public void testHeapUsage() throws Exception { Layer l = new Layer(""); FileSystem fs = l.read(); From e6e25a82aeeb236f358718f2bf6bf3967f12c392 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 19:44:08 +0100 Subject: [PATCH 08/10] add -proc:none to test which doesn't need AP --- .../modules/netbinox/NetbinoxMultiversionJarTest.java | 4 ++-- .../test/unit/src/org/netbeans/JarClassLoaderTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetbinoxMultiversionJarTest.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetbinoxMultiversionJarTest.java index f186ea40e28e..c5ec39d9a96d 100644 --- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetbinoxMultiversionJarTest.java +++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetbinoxMultiversionJarTest.java @@ -69,7 +69,7 @@ protected void setUp() throws Exception { ToolProvider.getSystemJavaCompiler() .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); - }, Arrays.asList("-d", classes.getAbsolutePath()), null, + }, Arrays.asList("-d", classes.getAbsolutePath(), "-proc:none"), null, Arrays.asList(new SourceFileObject("test/Impl.java", "package test; public class Impl { public static String get() { return \"base\"; } }"), new SourceFileObject("api/API.java", "package api; public class API { public static String run() { return test.Impl.get(); } }"))) .call(); @@ -78,7 +78,7 @@ protected void setUp() throws Exception { ToolProvider.getSystemJavaCompiler() .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); - }, Arrays.asList("-d", classes9.getAbsolutePath(), "-classpath", classes.getAbsolutePath()), null, + }, Arrays.asList("-d", classes9.getAbsolutePath(), "-classpath", classes.getAbsolutePath(), "-proc:none"), null, Arrays.asList(new SourceFileObject("test/Impl.java", "package test; public class Impl { public static String get() { return \"9\"; } }"))) .call(); Map jarContent = new LinkedHashMap<>(); diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java index 0a603593bba1..d7c2740bdf24 100644 --- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java +++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java @@ -437,14 +437,14 @@ public void testMultiReleaseJar() throws Exception { File classes = new File(getWorkDir(), "classes"); classes.mkdirs(); ToolProvider.getSystemJavaCompiler() - .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); }, Arrays.asList("-d", classes.getAbsolutePath()), null, + .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); }, Arrays.asList("-d", classes.getAbsolutePath(), "-proc:none"), null, Arrays.asList(new SourceFileObject("test/Impl.java", "package test; public class Impl { public static String get() { return \"base\"; } }"), new SourceFileObject("api/API.java", "package api; public class API { public static String run() { return test.Impl.get(); } }"))) .call(); File classes9 = new File(new File(new File(classes, "META-INF"), "versions"), "9"); classes9.mkdirs(); ToolProvider.getSystemJavaCompiler() - .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); }, Arrays.asList("-d", classes9.getAbsolutePath(), "-classpath", classes.getAbsolutePath()), null, + .getTask(null, null, d -> { throw new IllegalStateException(d.toString()); }, Arrays.asList("-d", classes9.getAbsolutePath(), "-classpath", classes.getAbsolutePath(), "-proc:none"), null, Arrays.asList(new SourceFileObject("test/Impl.java", "package test; public class Impl { public static String get() { return \"9\"; } }"))) .call(); Map jarContent = new LinkedHashMap<>(); From 1e999545e75d4a1449039ca8707e9ab7acca37e7 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 19:48:59 +0100 Subject: [PATCH 09/10] disable test cases where PropertyChange event count changed --- .../org/netbeans/beaninfo/editors/FileArrayEditorTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java b/platform/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java index 2d9dd126a962..d7645630854a 100644 --- a/platform/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java +++ b/platform/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java @@ -25,6 +25,7 @@ import java.util.List; import javax.swing.JFileChooser; +import org.junit.Ignore; import org.netbeans.junit.NbTestCase; @@ -80,6 +81,7 @@ public void testSetCombinedSingleSelection(){ myListener.size()+ " event(s)"; } + @Ignore("TODO: JDK 20+: event count is now 3") public void testSetCombinedMultiSelection(){ JFileChooser chooser = new JFileChooser(); FileArrayEditor editor = getArrayEditor(); @@ -93,6 +95,7 @@ public void testSetCombinedMultiSelection(){ myListener.size()+ " event(s)"; } + @Ignore("TODO: JDK 20+: event count is now 4") public void testSetCombinedOtherOrderSelection(){ JFileChooser chooser = new JFileChooser(); FileArrayEditor editor = getArrayEditor(); @@ -109,6 +112,7 @@ public void testSetCombinedOtherOrderSelection(){ /* * This test for fix IZ#36742 */ + @Ignore("TODO: JDK 20+: event count is now 3") public void testDoubleSelection(){ JFileChooser chooser = new JFileChooser(); FileArrayEditor editor = getArrayEditor(); From 0e4b2686f3ea0d20b58e26c2cf6e6aa670f90b51 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 26 Jan 2026 22:32:40 +0100 Subject: [PATCH 10/10] fix ambiguous CL problem in tests on JDK 21 by reducing clusters --- .../modules/netbinox/CachingAndExternalPathsTest.java | 5 ++++- .../org/netbeans/modules/netbinox/IntegrationTest.java | 9 ++++----- .../netbeans/modules/netbinox/LogReaderServiceTest.java | 5 ++++- .../modules/netbinox/NetigsoHasSAXParserTest.java | 5 ++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CachingAndExternalPathsTest.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CachingAndExternalPathsTest.java index 36074ff0154a..1e2b8e1d8903 100644 --- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CachingAndExternalPathsTest.java +++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CachingAndExternalPathsTest.java @@ -81,7 +81,10 @@ static Test create(SetExtDirProperty setter) throws IOException { NbTestSuite suite = new NbTestSuite(); Compile compile = new Compile("testCompile", setter); suite.addTest(compile); - NbModuleSuite.Configuration common = NbModuleSuite.emptyConfiguration().clusters(".*").enableClasspathModules(false) + // JDK 21+: enabling all clusters causes: + // Will not load class org.osgi.framework.launch.Framework arbitrarily from one of + // ModuleCL@1070d437[org.netbeans.libs.osgi] and ModuleCL@2bbc301d[org.netbeans.modules.websvc.restlib] + NbModuleSuite.Configuration common = NbModuleSuite.emptyConfiguration().clusters("platform|ide").enableClasspathModules(false) .gui(false).honorAutoloadEager(true); { NbModuleSuite.Configuration conf = common.reuseUserDir(false).addTest(CachingAndExternalPathsTest.class, "testInitUserDir"); diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/IntegrationTest.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/IntegrationTest.java index c2baa86f6ba8..aa1b6ec47ebe 100644 --- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/IntegrationTest.java +++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/IntegrationTest.java @@ -19,19 +19,15 @@ package org.netbeans.modules.netbinox; import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.logging.Level; import junit.framework.Test; import org.netbeans.Module; import org.netbeans.ModuleManager; -import org.netbeans.NetigsoFramework; import org.netbeans.SetupHid; import org.netbeans.core.netigso.NetigsoUtil; import org.netbeans.core.startup.Main; import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbTestCase; -import org.openide.util.Lookup; import org.osgi.framework.Bundle; import org.osgi.framework.launch.Framework; @@ -47,11 +43,14 @@ public IntegrationTest(String name) { } public static Test suite() { + // JDK 21+: enabling all clusters causes: + // Will not load class org.osgi.framework.launch.Framework arbitrarily from one of + // ModuleCL@1070d437[org.netbeans.libs.osgi] and ModuleCL@2bbc301d[org.netbeans.modules.websvc.restlib] return NbModuleSuite.create( NbModuleSuite.emptyConfiguration().addTest( IntegrationTest.class ).honorAutoloadEager(true).clusters( - ".*" + "platform|ide" ).failOnException(Level.WARNING)/*.failOnMessage(Level.WARNING)*/ .gui(false) ); diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/LogReaderServiceTest.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/LogReaderServiceTest.java index 9fb8b2e81a61..4d1e7a6806c9 100644 --- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/LogReaderServiceTest.java +++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/LogReaderServiceTest.java @@ -40,11 +40,14 @@ public LogReaderServiceTest(String name) { } public static Test suite() { + // JDK 21+: enabling all clusters causes: + // Will not load class org.osgi.framework.launch.Framework arbitrarily from one of + // ModuleCL@1070d437[org.netbeans.libs.osgi] and ModuleCL@2bbc301d[org.netbeans.modules.websvc.restlib] return NbModuleSuite.create( NbModuleSuite.emptyConfiguration() .addTest(LogReaderServiceTest.class) .honorAutoloadEager(true) - .clusters(".*") + .clusters("platform|ide") .failOnException(Level.WARNING)/*.failOnMessage(Level.WARNING)*/ .gui(false) ); diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetigsoHasSAXParserTest.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetigsoHasSAXParserTest.java index f5ee8145e762..cc85e7b491f9 100644 --- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetigsoHasSAXParserTest.java +++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/NetigsoHasSAXParserTest.java @@ -39,11 +39,14 @@ public NetigsoHasSAXParserTest(String name) { } public static Test suite() { + // JDK 21+: enabling all clusters causes: + // Will not load class org.osgi.framework.launch.Framework arbitrarily from one of + // ModuleCL@1070d437[org.netbeans.libs.osgi] and ModuleCL@2bbc301d[org.netbeans.modules.websvc.restlib] return NbModuleSuite.create( NbModuleSuite.emptyConfiguration().addTest( NetigsoHasSAXParserTest.class ).honorAutoloadEager(true).clusters( - ".*" + "platform|ide" ).failOnException(Level.WARNING)/*.failOnMessage(Level.WARNING)*/ .gui(false) );