[ https://issues.apache.org/jira/browse/BCEL-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory closed BCEL-323. ----------------------------- Resolution: Fixed Fix Version/s: 6.4.0 In git master. > JDK 13 build failing in master: BCELifierTestCase.testJavapCompare > ------------------------------------------------------------------ > > Key: BCEL-323 > URL: https://issues.apache.org/jira/browse/BCEL-323 > Project: Commons BCEL > Issue Type: Improvement > Reporter: Tomo Suzuki > Priority: Minor > Fix For: 6.4.0 > > Attachments: screenshot-1.png, screenshot-2.png > > Time Spent: 20m > Remaining Estimate: 0h > > h1. Problem > With OpenJDK 13 EA, BCELifer does not give "default" modifier for an > [interface's default > method|https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html]. > [https://travis-ci.org/apache/commons-bcel/jobs/556441835] > {code:java} > [INFO] > [INFO] Results: > [INFO] > [ERROR] Failures: > [ERROR] BCELifierTestCase.testJavapCompare:90->testClassOnPath:80 > expected:<...a8Example { > public [default ]void hello(); > Code:...> but was:<...a8Example { > public []void hello(); > Code:...> > [INFO] > [ERROR] Tests run: 130, Failures: 1, Errors: 0, Skipped: 1{code} > > I'm checking why it fails. > Memo for myself: > {code:java} > export JAVA_HOME=${HOME}/local/jdk-13 > export PATH=${JAVA_HOME}/bin:$PATH{code} > h1. Difference causing Test Failure > In OpenJDK 13, the default parameter for the interface disappears after > BCELifier creates the class file. > !screenshot-1.png! > > {code:java} > $ java -version > openjdk version "13-ea" 2019-09-17 > OpenJDK Runtime Environment (build 13-ea+28) > OpenJDK 64-Bit Server VM (build 13-ea+28, mixed mode, sharing){code} > h2. What does BCELifierTestCase do? > The test compares two output of javap command: > * javap "target/test-classes/Java8Example.class" (which is copied from > ./src/test/resources/Java8Example.class in git) > * javap another Java8Example.class which is generated by BCELifer. > ** Actually the class file is not directly created by BCELifer. > *** BCELifer writes Java8ExampleCreator.java > *** The test runs "javac" to compile Java8ExampleCreator. > *** The test runs "java" to run Java8ExampleCreator, which in turn generates > Java8Example.class > JDK 13's javap command adds "default" for the first Java8Example.class but > not on the second one. > h2. Question to Answer > Q. In theory, because Java8Example.class is generated by BCEL, not JDK, the > output should not change. Which part of BCEL relies on JDK? > A. This question is irrelevant, because the output class files are all the > same (see below). > Q. Is there difference between Java8ExampleCreator.java files from JDK 8 and > JDK 13? > A. They are the same. > Q. How to see the difference between Java8Example.class from JDK 8 and JDK 13? > * javap (screenshot shown above) > !screenshot-2.png! > * binary diff editor? > Q. What about JDK 11? > A. JDK 11's javap does not show "default" for both Java8Example.class files. > JDK11's generated Java8Example.class has 1 attributes. The resulting > Java8Example.class files are all the same across JDKs: > {code} > $ md5sum /tmp/target-jdk*/Java8Example.class > f4c51ee3d4864cb226e79cfca8dbe6da /tmp/target-jdk11/Java8Example.class > f4c51ee3d4864cb226e79cfca8dbe6da /tmp/target-jdk13/Java8Example.class > f4c51ee3d4864cb226e79cfca8dbe6da /tmp/target-jdk8/Java8Example.class{code} > So it's the matter of javap command showing "default" or not. > Q. JDK 13's javap outputs "default" under certain condition. What is the > condition? > A. It's when major.minor >= 52.0, as per > http://hg.openjdk.java.net/jdk/jdk13/rev/77b54b2822cc > h1. Root Cause > Open JDK 13's javap shows "default" when major.minor >= 52.0 ([commit in June > 2019|http://hg.openjdk.java.net/jdk/jdk13/rev/77b54b2822cc]). BCEL while > BCELifier was not copying major.minor (default: "45.3"). -- This message was sent by Atlassian JIRA (v7.6.3#76005)