Skip to content

test UnitTestsCompilerOptionsQueryImplTest fails on Java 17 and Java 21 #8614

Open
@homberghp

Description

@homberghp

Apache NetBeans version

Apache NetBeans 26

What happened

While trying to triage #8560, I ran the tests for the package org.netbeans.modules.java.api.common.queries; because it
contains the file org.netbeans.modules.java.api.common.queries.ModuleInfoAccessibilityQueryImpl that @pedro-w metions in his patch.

The failures are: (ant output)

    [junit] ------------- ---------------- ---------------
    [junit] Testcase: testRootsChanges(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] junit.framework.AssertionFailedError: expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testRootsChanges(UnitTestsCompilerOptionsQueryImplTest.java:215)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] Jun 23, 2025 2:57:31 PM org.netbeans.modules.java.source.parsing.JavacParser validateSourceLevel
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] WARNING: Even though the source level of /home/hom/homberghp/netbeans/master/java/java.api.common/build/test/unit/work/o.n.m.j.a.c.q.U/jdktiism/src is set to: 9, java.lang.AssertionError cannot be found on the bootclasspath: 
    [junit] 
    [junit] 
    [junit] 
    [junit] Testcase: testModuleInfoChanges(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] Working directory: /home/hom/homberghp/netbeans/master/java/java.api.common/build/test/unit/work/o.n.m.j.a.c.q.U/jdktiism
    [junit] junit.framework.AssertionFailedError: expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testModuleInfoChanges(UnitTestsCompilerOptionsQueryImplTest.java:258)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] 
    [junit] 
    [junit] Testcase: testJDK9_TestModule(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[--add-reads, org.nb.AppTest=ALL-UNNAMED]> but was:<[]>
    [junit] junit.framework.AssertionFailedError: expected:<[--add-reads, org.nb.AppTest=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testJDK9_TestModule(UnitTestsCompilerOptionsQueryImplTest.java:145)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] 
    [junit] 
    [junit] Testcase: testSourceLevelChanges(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] junit.framework.AssertionFailedError: expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testSourceLevelChanges(UnitTestsCompilerOptionsQueryImplTest.java:184)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] 
    [junit] 
    [junit] Testcase: testModuleInfoCreation(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] junit.framework.AssertionFailedError: expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testModuleInfoCreation(UnitTestsCompilerOptionsQueryImplTest.java:239)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] 
    [junit] 
    [junit] Testcase: testJDK9_TestInlinedIntoSourceModule(org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest):	FAILED
    [junit] expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] junit.framework.AssertionFailedError: expected:<[-XD-Xmodule:org.nb.App, --add-reads, org.nb.App=ALL-UNNAMED]> but was:<[]>
    [junit] 	at org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest.testJDK9_TestInlinedIntoSourceModule(UnitTestsCompilerOptionsQueryImplTest.java:124)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:84)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:489)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:410)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:840)
    [junit] 
    [junit] 
    [junit] Test org.netbeans.modules.java.api.common.queries.UnitTestsCompilerOptionsQueryImplTest FAILED

BUILD SUCCESSFUL
Total time: 3 seconds

These failures keep me from proposing a PR as proposed in #8560.

Language / Project Type / NetBeans Component

NB module java/java.api.common

How to reproduce

Build the module java/java.api.common
run the test with netbeans or with ant. The command line for ant is

ant  -Dtest.type=unit -Dcontinue.after.failing.tests=true -Dtest.includes=org/netbeans/modules/java/api/common/queries/UnitTestsCompilerOptionsQueryImplTest.java test-single

Did this work correctly in an earlier version?

No / Don't know

Operating System

ubuntu 24.04

JDK

17 and 21

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

This problem is repeatable.

Not sure if these tests are still relevant. Currently the build seems to pass with either these failures, or the tests are not run.

Are you willing to submit a pull request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugBug report or fixneeds:triageRequires attention from one of the committers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions