Skip to content

Commit b04fbc5

Browse files
Andrey Loskutoviloveeclipse
authored andcommitted
Fix ConstantPoolModuleAccessTest failures on Java 25
Updated test expectations according to changes in module-info classes shipped with JDK 25.
1 parent f0f2fcf commit b04fbc5

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ The <action> type attribute can be add,update,fix,remove.
6969
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Operation on the "considered" shared variable in "ConstantUtf8" class is not atomic [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 137] AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE.</action>
7070
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Operation on the "skipped" shared variable in "ConstantUtf8" class is not atomic [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 134] AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE.</action>
7171
<action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.util.ClassPath.addJdkModules(String, List&lt;String&gt;) now reads the system property "jdk.module.path" instead of "java.modules.path"; see https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/System.html#jdk.module.path.</action>
72+
<action type="fix" dev="iloveeclipse" due-to="Andrey Loskutov">Fix ConstantPoolModuleAccessTest failures on Java 25</action>
7273
<!-- ADD -->
7374
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Const.MAJOR_25.</action>
7475
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Const.MINOR_25.</action>

src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void visitModule(final Module obj) {
161161
expected.add("java.time.chrono.AbstractChronology");
162162
expected.add("java.time.chrono.Chronology");
163163
expected.add("java.time.zone.ZoneRulesProvider");
164-
if (javaClass.getMajor() > Const.MAJOR_11) {
164+
if (javaClass.getMajor() > Const.MAJOR_11 && javaClass.getMajor() < Const.MAJOR_24) {
165165
expected.add("java.util.random.RandomGenerator");
166166
}
167167
expected.add("java.util.spi.CalendarDataProvider");
@@ -231,6 +231,9 @@ public void visitModule(final Module obj) {
231231
expected.add("com.sun.tools.doclint.DocLint");
232232
}
233233
expected.add("com.sun.tools.javac.platform.PlatformProvider");
234+
if (javaClass.getMajor() > Const.MAJOR_23) {
235+
expected.add("com.sun.tools.javac.api.JavacTrees$DocCommentTreeTransformer");
236+
}
234237
assertEquals(expected, Arrays.asList(usedClassNames));
235238
} else if (urlPath.contains("/jdk.jconsole/module-info.class")) {
236239
final List<String> expected = new ArrayList<>();
@@ -269,6 +272,10 @@ public void visitModule(final Module obj) {
269272
final List<String> expected = new ArrayList<>();
270273
expected.add("jdk.internal.netscape.javascript.spi.JSObjectProvider");
271274
assertEquals(expected, Arrays.asList(usedClassNames));
275+
} else if (urlPath.contains("/jdk.jdeps/module-info.class") && javaClass.getMajor() > Const.MAJOR_24) {
276+
final List<String> expected = new ArrayList<>();
277+
expected.add("com.sun.tools.javac.platform.PlatformProvider");
278+
assertEquals(expected, Arrays.asList(usedClassNames));
272279
} else {
273280
assertEquals(0, usedClassNames.length, () -> "Found " + Arrays.toString(usedClassNames) + " in " + urlPath);
274281
}

0 commit comments

Comments
 (0)