From 1e0b70bf7169b0db2c4b2ce61b4524d60713d971 Mon Sep 17 00:00:00 2001 From: pavel Date: Sat, 23 Apr 2016 11:16:42 +1000 Subject: [PATCH] Allow TargetBytecode to be set in Ant task to all supported versions (1.8 to 1.4) as opposed to only 1.4 and 1.5 --- .../main/java/org/codehaus/groovy/ant/Groovyc.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java index e77dfc5715a..7499428d268 100644 --- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java +++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java @@ -292,20 +292,26 @@ public String getScriptExtension() { } /** - * Sets the bytecode compatibility mode + * Sets the bytecode compatibility mode. The parameter can take + * one of the values 1.8, 1.7, 1.6, 1.5 or 1.4. * * @param version the bytecode compatibility mode */ public void setTargetBytecode(String version) { - if (CompilerConfiguration.PRE_JDK5.equals(version) || CompilerConfiguration.POST_JDK5.equals(version)) { - this.targetBytecode = version; + + for (String allowedJdk : CompilerConfiguration.ALLOWED_JDKS) { + if (allowedJdk.equals(version)) { + this.targetBytecode = version; + } } } /** * Retrieves the compiler bytecode compatibility mode. * - * @return bytecode compatibility mode. Can be either 1.5 or 1.4. + * @return bytecode compatibility mode. Can be one of the values + * 1.8, 1.7, 1.6, 1.5 or + * 1.4. */ public String getTargetBytecode() { return this.targetBytecode;