[ https://issues.apache.org/jira/browse/BCEL-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18024310#comment-18024310 ]
Andrey Loskutov commented on BCEL-377: -------------------------------------- It is impossible to run the test with Eclipse in a deterministic way. The classpath generated for Eclipse by maven is weird, and that seem to be part of the problem for debugging. With Java 17, 21, testJavapCompare(): after executing maven, first test in Eclipse works. After that it finds different class and doesn't. Starting with Java 22 it doesn't work already at very first time. There is some magic how the .class file is found by the Repository.lookupClass(name) that uses classpath, and the classpath is crazy containing different folders where some class files are checked in and some are generated by maven. And it seems that after test is executed, it manages to change the class files (there are more class files after execution of BCELifierTest). {code:java|title=Initial git repo state} find . -name "Java8Example.class" | xargs ls -al -rw-rw-r-- 1 aloskuto users 1533 Okt 2 14:09 ./src/test/resources/Java8Example.class {code} {code:java|title=git repo state after compilation} JAVA_HOME=/lib/jvm/java-21/ PATH=$JAVA_HOME/bin:$PATH ~/bin/mvn compile find . -name "Java8Example.class" | xargs ls -al -rw-rw-r-- 1 aloskuto users 1533 Okt 2 14:09 ./src/test/resources/Java8Example.class -rw-r--r-- 1 aloskuto users 1533 Okt 2 18:21 ./target/test-classes/Java8Example.class {code} {code:java|title=git repo state after test} JAVA_HOME=/lib/jvm/java-21/ PATH=$JAVA_HOME/bin:$PATH ~/bin/mvn test -Dtest=org.apache.bcel.util.BCELifierTest find . -name "Java8Example.class" | xargs ls -al -rw-rw-r-- 1 aloskuto users 1533 Okt 2 14:09 ./src/test/resources/Java8Example.class -rw-rw-r-- 1 aloskuto users 1112 Okt 2 18:23 ./target/Java8Example.class -rw-rw-r-- 1 aloskuto users 1533 Okt 2 18:21 ./target/test-classes/Java8Example.class {code} So I can only use maven to run the test, debugger doesn't help as the test setup in Eclipse is not matching setup in maven. Wasted hours, found no reasonable setup in Eclipse for debugging test. Crazy. Anyway, the problem seem to be in the way how BCEL generates invokedynamic instructions. Note: it generates *exactly same code* in both java 21/25, but *javap* from Java 25 doesn't accept it! {code:java|title=Line generated by javap from Java 21} 36: invokedynamic #43, 0 // Method test.test:()Ljava/util/function/Predicate; {code} {code:java|title=Line generated by javap from Java 25} Error: Bad tag (10) at index (43) position (466), expected InvokeDynamicEntry 36: invokedynamic ??? {code} The rest is identical. So one need to digg into javap code to understand what the error means and why javap from 21 can accept that, but javap starting from Java 22 have problems with it. Attaching output from modified BCELifierTest on java 21 & 25 (removed all test cases except one and added extra output to see what's going on inside). Ignore white space changes and compare, the only difference is the line above... Test output on different Java versions [^test_BAD_mvn_java25.txt] [^test_OK_mvn_java21.txt] Changed test: [^BCELifierTest.java] Changed pom (to get rid of extra failing checks I don't care now): [^pom.xml] I maybe will continue next week, so if anyone wants to dig deeper, feel free to take over. > Fix Java 24 and 25 tests and release > ------------------------------------ > > Key: BCEL-377 > URL: https://issues.apache.org/jira/browse/BCEL-377 > Project: Commons BCEL > Issue Type: New Feature > Affects Versions: 6.10.0 > Reporter: Dejan Stojadinović > Priority: Major > Labels: Java25, patch, patch-upgrade > Attachments: BCELifierTest.java, pom.xml, test_BAD_mvn_java25.txt, > test_OK_mvn_java21.txt > > > *Prologue:* [https://github.com/spotbugs/spotbugs/issues/3569] SpotBugs: > Update to BCEL stable 6.11 release > *Note:* it really doesn't have to be a full-blown 6.11.0 release; patch > 6.10.1 would do: > * version 6.10.0: > [https://github.com/apache/commons-bcel/releases/tag/rel%2Fcommons-bcel-6.10.0] > and > * commit: > [https://github.com/apache/commons-bcel/commit/70562832ce2cc8925787bacf53911615e6fbb2b7] > FYI [~ggregory] -- This message was sent by Atlassian Jira (v8.20.10#820010)