Skip to content

Compiler version unmatching/release bug #269

@MizzMaster

Description

@MizzMaster

I have a jar file that has compiled in Java 8 and I have installed both Java 8 and 11. I know that in Java 11, javac command supports --release # but Java 8 doesnt. When I try to compile a class with Java 8 in Recaf, it says that Recaf doesnt support that version and defaulting to Java 7, but then it says invalid source release: 11, and compilation fails.

I think the best way to match corresponding jar's compiled java version and recaf's compiler version, it would be great that adding a setting to select a Java release when compiling with Java 11, and just say that Recaf doesnt support other versions, please download Java 11 if user doesnt have.

04:31:28.143 [JavaFX Application Thread] ERROR: Cannot find javac supported version, defaulting to Java 7
java.lang.IllegalArgumentException: invalid source release: 11
        at com.sun.tools.javac.main.OptionHelper$GrumpyHelper.error(OptionHelper.java:103)
        at com.sun.tools.javac.main.Option$11.process(Option.java:204)
        at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:217)
        at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:156)
        at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:107)
        at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64)
        at me.coley.recaf.compiler.JavacCompiler.compile(JavacCompiler.java:50)

This continues btw.

java.lang.UnsupportedClassVersionError: YourClass has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
end:
ERROR: Failed recompiling code for 'YourClass' - Reason: 'Failed compile due to compilation errors'
Now, I am trying to copy a blank class file that in the version that i want, and edit it the way that i want, then bypass this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugYup, thats broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions