According to the javadoc of
|
private static boolean isPreJava16(CompilerConfiguration config) { |
and
|
private static boolean isPreJava14(CompilerConfiguration config) { |
the methods
isPreJavaXX are supposed to
return true if the compiler configuration represents a Java XX compiler or later, false otherwise
The logic within those methods evaluates partially also the parameter source (
|
v = config.getSourceVersion(); |
) or
release (
|
String v = config.getReleaseVersion(); |
) which are completely orthogonal to the javac version being used. They only determine the bytecode version being generated but have nothing to do with the version of the compiler itself.
However I am not sure when CompilerConfiguration.getCompilerVersion() is reliably set at all. IMHO there should be some logic separate for in-process and forked compiling which determines the real javac version (either from system property java.version for in-process compilation or the parsed output of javac -version)
According to the javadoc of
plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 410 in c5edddc
plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 393 in c5edddc
isPreJavaXXare supposed toThe logic within those methods evaluates partially also the parameter
source(plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 418 in c5edddc
release(plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 435 in c5edddc
However I am not sure when
CompilerConfiguration.getCompilerVersion()is reliably set at all. IMHO there should be some logic separate for in-process and forked compiling which determines the realjavacversion (either from system propertyjava.versionfor in-process compilation or the parsed output ofjavac -version)