This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-compiler.git
commit 249c18712ec647f4e91d98b96fe5e3bb4f38d4ba Author: Robert Munteanu <[email protected]> AuthorDate: Tue Sep 12 19:50:07 2017 +0000 SLING-7105 - Some JSP tests fail under Java 9 - parameterized types are only available if source level is 1.5 or greater - pass Java version as 1.9 instead of 9, as Eclipse expects that - update to ecj 4.6.1 git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1808147 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 2 +- .../sling/commons/compiler/impl/EclipseJavaCompiler.java | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index d1bd3de..5de2242 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ <dependency> <groupId>org.eclipse.jdt.core.compiler</groupId> <artifactId>ecj</artifactId> - <version>4.5.1</version> + <version>4.6.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> 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 49d4a5e..160bb6b 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 @@ -198,11 +198,11 @@ public class EclipseJavaCompiler implements JavaCompiler { props.put(CompilerOptions.OPTION_SourceFileAttribute, "generate"); } if (options.getSourceVersion() != null) { - props.put(CompilerOptions.OPTION_Source, options.getSourceVersion()); - props.put(CompilerOptions.OPTION_Compliance, options.getSourceVersion()); + props.put(CompilerOptions.OPTION_Source, adjustJavaVersion(options.getSourceVersion())); + props.put(CompilerOptions.OPTION_Compliance, adjustJavaVersion(options.getSourceVersion())); } if (options.getTargetVersion() != null) { - props.put(CompilerOptions.OPTION_TargetPlatform, options.getTargetVersion()); + props.put(CompilerOptions.OPTION_TargetPlatform, adjustJavaVersion(options.getTargetVersion())); } props.put(CompilerOptions.OPTION_Encoding, "UTF8"); @@ -232,6 +232,12 @@ public class EclipseJavaCompiler implements JavaCompiler { return result; } + private String adjustJavaVersion(String javaVersion) { + + // ECJ 4.6.1 expects Java version 1.9, not 9 + return "9".equals(javaVersion) ? "1.9" : javaVersion; + } + //--------------------------------------------------------< inner classes > private class CompileContext implements ICompilerRequestor, INameEnvironment { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
