Closed wtwhite closed 4 months ago
At last we see differences in the classfiles produced:
wtwhite@wtwhite-vuw-vm:~/code/jcompile$ diff <(unzip -lv jars/openjdk-20.0.1/checkstyle-10.12.3.jar|grep -F .class|perl -lpe 's/\d\d \d\d:\d\d /DD XX:XX /') <(unzip -lv jars/openjdk-nodebug-20.0.1/checkstyle-10.12.3.jar|grep -F .class|perl -lpe 's/\d\d \d\d:\d\d /DD XX:XX /')|wc -l
1746
wtwhite@wtwhite-vuw-vm:~/code/jcompile$ javap -l -classpath jars/openjdk-nodebug-20.0.1/commons-csv-1.10.0.jar org.apache.commons.csv.CSVRecord|head -20
Compiled from "CSVRecord.java"
public final class org.apache.commons.csv.CSVRecord implements java.io.Serializable, java.lang.Iterable<java.lang.String> {
org.apache.commons.csv.CSVRecord(org.apache.commons.csv.CSVParser, java.lang.String[], java.lang.String, long, long);
LineNumberTable:
line 60: 0
line 61: 4
line 62: 10
line 63: 25
line 64: 30
line 65: 35
line 66: 41
public java.lang.String get(java.lang.Enum<?>);
LineNumberTable:
line 76: 0
public java.lang.String get(int);
LineNumberTable:
line 87: 0
(Compare https://github.com/binaryeq/jcompile/pull/83#issuecomment-2172365121, which shows the local variable table.)
Resolves #81 "backwards" -- it turns out that, although
javac
leaves debug information out by default, Maven turns debugging on by default, so we need to turn it off:https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#debug
Also, this can be done from the
mvn
command very simply with-Dmaven.compiler.debug=false
, so we don't need the whole complicated approach of #83 of finding everymaven-compiler-plugin
in the POM (including inside and outside of<execution>
s, etc.) and adding<compilerArgs><arg>-g</arg></compilerArgs>
to them. (That machinery may still be useful in improving the existing ECJ compiler injection though -- which currently uses a brittle regex-based approach.)