Giter Site home page Giter Site logo

Comments (3)

trancexpress avatar trancexpress commented on August 16, 2024

Note that ecj produces class version 61 when it doesn't detect the module conflict:

$ /usr/lib/jvm/java-11-openjdk/bin/java -classpath TestLibraryModule.jar:TestLibraryUnnamedModule.jar:. TestConflict
Exception in thread "main" java.lang.UnsupportedClassVersionError: testpackage/TestClass has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at TestConflict.main(TestConflict.java:3)

from eclipse.jdt.core.

trancexpress avatar trancexpress commented on August 16, 2024

Maybe there is some default here? I see this source value during the compile:

org.eclipse.jdt.core.compiler.source=1.3
"main" #1 prio=5 os_prio=0 cpu=157.90ms elapsed=108.90s tid=0x00007f01e4014c60 nid=0x5f3b runnable  [0x00007f01e85fe000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(CompilerOptions.java:874)
        at org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(CompilerOptions.java:869)
        at org.eclipse.jdt.internal.compiler.batch.Main.validateOptions(Main.java:5540)
        at org.eclipse.jdt.internal.compiler.batch.Main.configure(Main.java:3055)
        at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1781)
        at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1521)

Calling ecj -help, that seems to be the case:

$ /usr/lib/jvm/java-17-openjdk/bin/java -jar /data/eclipses/ecj-4.27M1.jar -help 
Eclipse Compiler for Java(TM) v20221222-1640, 3.33.0
Copyright IBM Corp 2000, 2020. All rights reserved.
 
 Usage: <options> <source files | directories>
 If directories are specified, then their source contents are compiled.
 Possible options are listed below. Options enabled by default are prefixed
 with '+'.
[..]
 Compliance options:
    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)
    -1.4             + use 1.4 compliance (-source 1.3 -target 1.2)
    -1.5 -5 -5.0       use 1.5 compliance (-source 1.5 -target 1.5)
    -1.6 -6 -6.0       use 1.6 compliance (-source 1.6 -target 1.6)
    -1.7 -7 -7.0       use 1.7 compliance (-source 1.7 -target 1.7)
    -1.8 -8 -8.0       use 1.8 compliance (-source 1.8 -target 1.8)
    -1.9 -9 -9.0       use 1.9 compliance (-source 1.9 -target 1.9)
    -10 -10.0          use 10  compliance (-source 10  -target 10)
    -11 -11.0          use 11  compliance (-source 11  -target 11)
    -12 -12.0          use 12  compliance (-source 12  -target 12)
    -13 -13.0          use 13  compliance (-source 13  -target 13)
    -14 -14.0          use 14  compliance (-source 14  -target 14)
    -15 -15.0          use 15  compliance (-source 15  -target 15)
    -16 -16.0          use 16  compliance (-source 16  -target 16)
    -17 -17.0          use 17  compliance (-source 17  -target 17)
    -18 -18.0          use 18  compliance (-source 18  -target 18)
    -19 -19.0          use 19  compliance (-source 19  -target 19)
    -source <version>  set source level: 1.3 to 1.9, 10 to 19
                       (or 6, 6.0, etc)
    -target <version>  set classfile target: 1.3 to 1.9, 10 to 19
                       (or 6, 6.0, etc)
                       cldc1.1 can also be used to generate the StackMap
                       attribute

from eclipse.jdt.core.

trancexpress avatar trancexpress commented on August 16, 2024

Seems fine then. -source 1.3 sounds quite outdated as a default, but its documented and changing it is maybe not the best idea.

For completeness, javac seems to use the JDK version as default:

https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html

--source release or -source release

    Compiles source code according to the rules of the Java programming language for the specified Java SE release. The supported values of release are the current Java SE release and a limited number of previous releases, detailed in the command-line help.

    If the option is not specified, the default is to compile source code according to the rules of the Java programming language for the current Java SE release.

from eclipse.jdt.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.