Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review: feat: Create launcher constant for code compliance level #1543

Merged
merged 3 commits into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/spoon/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/spoon/support/StandardEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends CtElement> defaultFileGenerator;

private int errorCount = 0;
Expand Down Expand Up @@ -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 <code>null</code> default file
* generator.
Expand Down Expand Up @@ -306,7 +310,7 @@ public void setProcessingStopped(boolean processingStopped) {
public void setVerbose(boolean verbose) {
}

int complianceLevel = 7;


public int getComplianceLevel() {
return complianceLevel;
Expand Down