diff --git a/src/main/java/spoon/Launcher.java b/src/main/java/spoon/Launcher.java index 5ba434f7c8f..b18a4403438 100644 --- a/src/main/java/spoon/Launcher.java +++ b/src/main/java/spoon/Launcher.java @@ -60,6 +60,8 @@ import java.util.List; import java.util.ResourceBundle; +import static spoon.support.StandardEnvironment.DEFAULT_CODE_COMPLIANCE_LEVEL; + /** * This class implements an integrated command-line launcher for processing * programs at compile-time using the JDT-based builder (Eclipse). It takes @@ -237,7 +239,7 @@ protected static JSAP defineArgs() { opt2.setLongFlag("compliance"); opt2.setHelp("Java source code compliance level (1,2,3,4,5, 6, 7 or 8)."); opt2.setStringParser(JSAP.INTEGER_PARSER); - opt2.setDefault("8"); + opt2.setDefault(DEFAULT_CODE_COMPLIANCE_LEVEL + ""); jsap.registerParameter(opt2); // compiler's encoding diff --git a/src/main/java/spoon/support/StandardEnvironment.java b/src/main/java/spoon/support/StandardEnvironment.java index 0698044a34b..aabb9b91f9d 100644 --- a/src/main/java/spoon/support/StandardEnvironment.java +++ b/src/main/java/spoon/support/StandardEnvironment.java @@ -58,6 +58,8 @@ public class StandardEnvironment implements Serializable, Environment { private static final long serialVersionUID = 1L; + public static final int DEFAULT_CODE_COMPLIANCE_LEVEL = 8; + private FileGenerator defaultFileGenerator; private int errorCount = 0; @@ -92,6 +94,8 @@ public class StandardEnvironment implements Serializable, Environment { private Charset encoding = Charset.defaultCharset(); + int complianceLevel = DEFAULT_CODE_COMPLIANCE_LEVEL; + /** * Creates a new environment with a null default file * generator. @@ -306,7 +310,7 @@ public void setProcessingStopped(boolean processingStopped) { public void setVerbose(boolean verbose) { } - int complianceLevel = 7; + public int getComplianceLevel() { return complianceLevel;