kwin commented on a change in pull request #1: SLING-7365 for unsupported java
version fall back to Java 9
URL:
https://github.com/apache/sling-org-apache-sling-commons-compiler/pull/1#discussion_r161271831
##########
File path:
src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
##########
@@ -233,9 +233,12 @@ public CompilationResult compile(final CompilationUnit[]
units,
}
private String adjustJavaVersion(String javaVersion) {
-
- // ECJ 4.6.1 expects Java version 1.9, not 9
- return "9".equals(javaVersion) ? "1.9" : javaVersion;
+ // use latest supported version (Java 9) in case the given java
version is not supported by ECJ yet
+ if (CompilerOptions.versionToJdkLevel(javaVersion) == 0) {
+ logger.warn("Using unsupported java version '{}', assuming latest
supported version '{}'", javaVersion, CompilerOptions.VERSION_9);
Review comment:
I updated the PR accordingly leveraging a CopyOnWriteArraySet(). Since the
`add` is still expensive since it always means locking (even in the case where
the set contains the value already) I guarded in addition with
`Set.contains(...)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services