Comments (3)
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.
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.
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)
- [Patterns][unnamed] Support for identifier '_' for old compile source/target versions HOT 2
- [Patterns][internal] toString() output of AST nodes shows up with modifier sealed for pattern variables
- [Switch][Pattern] Withdraw the internal AST APIs Pattern.suspendVariables & Pattern.resumeVariables
- [Patterns][Unnamed] Wasteful allocation and assignment into unnamed pattern variables.
- [Patterns][internal] High degree of code duplication in instanceof pattern code generation
- [Patterns][Unnamed] VerifyError with unnamed pattern variable in instanceof HOT 1
- CommentRecorderParser sometimes generates ranges that miss Javadoc HOT 2
- Type signatures returned through bindings don't match signatures returned through codeSelect
- Pattern matching instanceof expression with bit-wise and doesn't report a parser error but doesn HOT 1
- Pattern matching instanceof expression with bit-wise-and doesn't report a parser error but doesn't recognize pattern variable HOT 2
- ResourceLeakTests & ResourceLeakAnnotatedTests fail in some compliance levels when run locally via RunJDTCoreTests HOT 4
- [Patterns][internal] It doesn't make sense for org.eclipse.jdt.internal.compiler.ast.RecordPattern to extend TypePattern
- [Patterns][smell] {TypePattern/RecordPattern/GuardedPattern}.resolveType should not be reentered HOT 1
- [Pattern] Grammar file references impossible and nop reduce action methods
- ASTParser cannot keep elements/nodes after a lambda expression (without a block)
- org.eclipse.jdt.core.dom.MethodBinding$LambdaMethod doesn't resolve to a org.eclipse.jdt.internal.core.LambdaMethod (err to ResolvedSourceMethod)
- Formater: Blank lines and highlighting breaks when top level class is record with two or more fields HOT 3
- ASTParser.createAST silently stop in the middle of a batch of compilation units HOT 7
- [Switch][Patterns] ECJ incorrectly holds a record pattern "guarded by when true" as being unconditional for the switch expression type
- [memory] deduplicate ResolvedBinaryType.uniqueKey
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse.jdt.core.