This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/support-java-10
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-compiler.git
The following commit(s) were added to refs/heads/feature/support-java-10 by
this push:
new a1348b9 SLING-7365 only log unsupported java version once per version
a1348b9 is described below
commit a1348b91f1f0a8ef0ec841010e3f15e10929e999
Author: Konrad Windszus <[email protected]>
AuthorDate: Fri Jan 12 17:48:45 2018 +0100
SLING-7365 only log unsupported java version once per version
---
.../apache/sling/commons/compiler/impl/EclipseJavaCompiler.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
b/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
index 0a4ab90..564b232 100644
---
a/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
+++
b/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
@@ -26,6 +26,8 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.sling.commons.classloader.ClassLoaderWriter;
import org.apache.sling.commons.compiler.CompilationResult;
@@ -70,6 +72,8 @@ public class EclipseJavaCompiler implements JavaCompiler {
/** the static policy. */
private final IErrorHandlingPolicy policy =
DefaultErrorHandlingPolicies.exitAfterAllProblems();
+
+ private final Set<String> warningEmittedForUnsupportedJavaVersion = new
CopyOnWriteArraySet<>();
/**
* Get the classloader for the compilation.
@@ -235,7 +239,10 @@ public class EclipseJavaCompiler implements JavaCompiler {
private String adjustJavaVersion(String 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);
+ // only log once per invalid javaVersion
+ if (!warningEmittedForUnsupportedJavaVersion.contains(javaVersion)
&& warningEmittedForUnsupportedJavaVersion.add(javaVersion)) {
+ logger.warn("Using unsupported java version '{}', assuming
latest supported version '{}'", javaVersion, CompilerOptions.VERSION_9);
+ }
return CompilerOptions.VERSION_9;
}
return javaVersion;
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].