This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push:
new 402515be [BCEL-377] Fix testing on Java 24 and up
402515be is described below
commit 402515be515189f0973f4fd4e4977c35bebea90f
Author: Gary D. Gregory <[email protected]>
AuthorDate: Thu Oct 9 18:22:39 2025 -0400
[BCEL-377] Fix testing on Java 24 and up
---
src/changes/changes.xml | 3 ++-
.../apache/bcel/generic/JdkGenericDumpTest.java | 10 +++++++++-
src/test/resources/jpms/empty/empty.jmod | Bin 0 -> 1046 bytes
src/test/resources/jpms/empty/module-info.class | Bin 0 -> 154 bytes
src/test/resources/jpms/empty/module-info.java | 22 +++++++++++++++++++++
5 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0748ba78..7f46a7e2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -69,7 +69,8 @@ The <action> type attribute can be add,update,fix,remove.
<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>
<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>
<action type="fix" dev="ggregory" due-to="Gary
Gregory">org.apache.bcel.util.ClassPath.addJdkModules(String,
List<String>) 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>
- <action type="fix" dev="iloveeclipse" due-to="Andrey
Loskutov">Fix ConstantPoolModuleAccessTest failures on Java 25</action>
+ <action type="fix" dev="iloveeclipse" due-to="Andrey
Loskutov">Fix ConstantPoolModuleAccessTest failures on Java 25.</action>
+ <action issue="377" type="fix" dev="ggregory" due-to="Dejan
Stojadinović, Gary Gregory, Andrey Loskutov">Fix testing on Java 24 and
up.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary
Gregory">Add Const.MAJOR_25.</action>
<action type="add" dev="ggregory" due-to="Gary
Gregory">Add Const.MINOR_25.</action>
diff --git a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTest.java
b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTest.java
index 2f3dedc7..b003e69a 100644
--- a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTest.java
+++ b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTest.java
@@ -32,11 +32,13 @@ import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
+import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.stream.Stream;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.Code;
@@ -128,6 +130,12 @@ class JdkGenericDumpTest {
return new String(hexChars);
}
+ static Stream<Path> testJdkModules() {
+ // JUnit requires at least one parameter.
+ // Make sure we have at least one JMOD file, since Java 25 and up may
not have them present by default, depending on your installation.
+ return Stream.concat(JavaHome.streamModulePath(),
Stream.of(Paths.get("src/test/resources/jpms/empty/empty.jmod")));
+ }
+
private void compare(final String name, final Method method) {
// System.out.println("Method: " + m);
final Code code = method.getCode();
@@ -178,8 +186,8 @@ class JdkGenericDumpTest {
}
@ParameterizedTest
- @MethodSource("org.apache.bcel.generic.JavaHome#streamModulePath")
@DisabledOnJre(value = JRE.JAVA_8)
+ @MethodSource
void testJdkModules(final Path jmodPath) throws Exception {
testJar(jmodPath);
}
diff --git a/src/test/resources/jpms/empty/empty.jmod
b/src/test/resources/jpms/empty/empty.jmod
new file mode 100644
index 00000000..6788a42b
Binary files /dev/null and b/src/test/resources/jpms/empty/empty.jmod differ
diff --git a/src/test/resources/jpms/empty/module-info.class
b/src/test/resources/jpms/empty/module-info.class
new file mode 100644
index 00000000..848b94e9
Binary files /dev/null and b/src/test/resources/jpms/empty/module-info.class
differ
diff --git a/src/test/resources/jpms/empty/module-info.java
b/src/test/resources/jpms/empty/module-info.java
new file mode 100644
index 00000000..e7f72f6f
--- /dev/null
+++ b/src/test/resources/jpms/empty/module-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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
+ *
+ * https://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.
+ */
+
+module empty {
+ // empty
+}