You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/03/31 16:51:04 UTC
[royale-compiler] 01/02: Normalize exit codes across compiler tools
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit dd44cbbc4c0bdf936b243f91a6ef42006a3aa5e7
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Feb 16 13:28:59 2022 -0800
Normalize exit codes across compiler tools
In particular, removed the unnecessary exit code for problems that aren't errors. Unless there are errors, a compile should be considered a success. We don't want build tools like Ant, Maven, etc. thinking that a compile failed because of some warnings. If people want it, we could add a new compiler option to treat warnings as errors. That shouldn't be default, though.
The FAILED_WITH_PROBLEMS enum value had already been changed to 0 in most cases, but there were some places where it seems to have been missed. Now, that enum value simply doesn't exist, to avoid potential confusion. Again, we don't want a build failure from warnings only.
---
.../apache/royale/compiler/clients/EXTERNC.java | 7 ++++++-
.../apache/royale/compiler/clients/ASDOCJSC.java | 7 ++++++-
.../apache/royale/compiler/clients/COMPJSC.java | 19 +++++++++++-------
.../royale/compiler/clients/COMPJSCNative.java | 7 ++++++-
.../royale/compiler/clients/COMPJSCRoyale.java | 7 ++++++-
.../apache/royale/compiler/clients/MXMLJSC.java | 23 +++++++++++-----------
.../royale/compiler/clients/MXMLJSCNative.java | 16 +++++++++------
.../royale/compiler/clients/MXMLJSCNode.java | 16 +++++++++------
.../royale/compiler/clients/MXMLJSCRoyale.java | 16 +++++++++------
.../compiler/clients/MXMLJSCRoyaleCordova.java | 16 +++++++++------
.../mxml/royale/TestRoyaleMXMLApplication.java | 2 +-
.../royale/compiler/clients/PLAYERGLOBALC.java | 9 +++++++--
.../org/apache/royale/compiler/clients/MXMLC.java | 13 +++++++-----
.../org/apache/royale/formatter/FORMATTER.java | 9 +++++++--
14 files changed, 110 insertions(+), 57 deletions(-)
diff --git a/compiler-externc/src/main/java/org/apache/royale/compiler/clients/EXTERNC.java b/compiler-externc/src/main/java/org/apache/royale/compiler/clients/EXTERNC.java
index c6ad9cf..ed4c71c 100644
--- a/compiler-externc/src/main/java/org/apache/royale/compiler/clients/EXTERNC.java
+++ b/compiler-externc/src/main/java/org/apache/royale/compiler/clients/EXTERNC.java
@@ -48,7 +48,7 @@ public class EXTERNC implements FlexTool
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(2),
+ FAILED_WITH_ERRORS(2),
FAILED_WITH_EXCEPTIONS(3),
FAILED_WITH_CONFIG_PROBLEMS(4);
@@ -58,6 +58,11 @@ public class EXTERNC implements FlexTool
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
public ProblemQuery problems;
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/ASDOCJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/ASDOCJSC.java
index 133cfa0..e720cc3 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/ASDOCJSC.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/ASDOCJSC.java
@@ -73,7 +73,7 @@ public class ASDOCJSC extends MXMLJSCRoyale
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(2),
+ FAILED_WITH_ERRORS(2),
FAILED_WITH_EXCEPTIONS(3),
FAILED_WITH_CONFIG_PROBLEMS(4);
@@ -83,6 +83,11 @@ public class ASDOCJSC extends MXMLJSCRoyale
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
index 3fdd841..f44094e 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
@@ -47,7 +47,7 @@ public class COMPJSC extends MXMLJSC
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(2),
+ FAILED_WITH_ERRORS(2),
FAILED_WITH_EXCEPTIONS(3),
FAILED_WITH_CONFIG_PROBLEMS(4);
@@ -57,6 +57,11 @@ public class COMPJSC extends MXMLJSC
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
@@ -177,7 +182,7 @@ public class COMPJSC extends MXMLJSC
compc.workspace.setASDocDelegate(new RoyaleASDocDelegate(true));
compc.configurationClass = JSGoogCompcConfiguration.class;
result = compc.mainNoExit(removeJSArgs(args));
- if (result != 0)
+ if (result != COMPC.ExitCode.SUCCESS.getCode())
{
problems.addAll(compc.problems.getProblems());
break targetloop;
@@ -188,7 +193,7 @@ public class COMPJSC extends MXMLJSC
COMPJSCRoyale royale = new COMPJSCRoyale();
lastCompiler = royale;
result = royale.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0)
+ if (result != COMPJSCRoyale.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -198,7 +203,7 @@ public class COMPJSC extends MXMLJSC
COMPJSCNative jsc = new COMPJSCNative();
lastCompiler = jsc;
result = jsc.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0)
+ if (result != COMPJSCNative.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -210,9 +215,9 @@ public class COMPJSC extends MXMLJSC
if (problems.hasFilteredProblems())
{
if (problems.hasErrors())
- exitCode = ExitCode.FAILED_WITH_EXCEPTIONS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ exitCode = ExitCode.FAILED_WITH_ERRORS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
index a01843b..e17a592 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
@@ -92,7 +92,7 @@ public class COMPJSCNative extends MXMLJSCNative
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(2),
+ FAILED_WITH_ERRORS(2),
FAILED_WITH_EXCEPTIONS(3),
FAILED_WITH_CONFIG_PROBLEMS(4);
@@ -102,6 +102,11 @@ public class COMPJSCNative extends MXMLJSCNative
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
index 0cf1e50..5a084e6 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
@@ -85,7 +85,7 @@ public class COMPJSCRoyale extends MXMLJSCRoyale
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(2),
+ FAILED_WITH_ERRORS(2),
FAILED_WITH_EXCEPTIONS(3),
FAILED_WITH_CONFIG_PROBLEMS(4);
@@ -95,6 +95,11 @@ public class COMPJSCRoyale extends MXMLJSCRoyale
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
index 5951645..02e4726 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
@@ -167,10 +167,9 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_PROBLEMS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code)
{
@@ -332,7 +331,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
result = mxmlc.mainCompileOnly(removeJSArgs(args), err);
else
result = mxmlc.mainNoExit(removeJSArgs(args));
- if (result != 0 && result != 2)
+ if (result != MXMLC.ExitCode.SUCCESS.getCode())
{
problems.addAll(mxmlc.problems.getProblems());
break targetloop;
@@ -342,7 +341,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
MXMLJSCRoyale royale = new MXMLJSCRoyale();
lastCompiler = royale;
result = royale.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0 && result != 2)
+ if (result != MXMLJSCRoyale.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -351,7 +350,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
MXMLJSCRoyaleCordova royaleCordova = new MXMLJSCRoyaleCordova();
lastCompiler = royaleCordova;
result = royaleCordova.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0 && result != 2)
+ if (result != MXMLJSCRoyaleCordova.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -360,7 +359,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
MXMLJSCNode node = new MXMLJSCNode();
lastCompiler = node;
result = node.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0 && result != 2)
+ if (result != MXMLJSCNode.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -369,7 +368,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
MXMLJSCNodeModule nodeModule = new MXMLJSCNodeModule();
lastCompiler = nodeModule;
result = nodeModule.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0 && result != 2)
+ if (result != MXMLJSCNodeModule.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -378,7 +377,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
MXMLJSCNative jsc = new MXMLJSCNative();
lastCompiler = jsc;
result = jsc.mainNoExit(removeASArgs(args), problems.getProblems(), false);
- if (result != 0 && result != 2)
+ if (result != MXMLJSCNative.ExitCode.SUCCESS.getCode())
{
break targetloop;
}
@@ -391,8 +390,8 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
{
if (problems.hasErrors())
exitCode = ExitCode.FAILED_WITH_ERRORS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java
index 3560bc3..3b333e4 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java
@@ -103,10 +103,9 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_PROBLEMS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code)
{
@@ -114,6 +113,11 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
@@ -241,8 +245,8 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider
{
if (problems.hasErrors())
exitCode = ExitCode.FAILED_WITH_ERRORS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java
index 9f16912..852f997 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java
@@ -102,10 +102,9 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider,
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_PROBLEMS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code)
{
@@ -113,6 +112,11 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider,
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
@Override
@@ -243,8 +247,8 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider,
{
if (problems.hasErrors())
exitCode = ExitCode.FAILED_WITH_ERRORS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
index 0be545e..ae080c4 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
@@ -123,10 +123,9 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_PROBLEMS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code)
{
@@ -134,6 +133,11 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
public static MXMLJSC.JSOutputType jsOutputType;
@@ -266,8 +270,8 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
{
if (problems.hasErrors())
exitCode = ExitCode.FAILED_WITH_ERRORS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java
index b760c9f..83db08d 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java
@@ -103,10 +103,9 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP
{
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_PROBLEMS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code)
{
@@ -114,6 +113,11 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
public static MXMLJSC.JSOutputType jsOutputType;
@@ -246,8 +250,8 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP
{
if (problems.hasErrors())
exitCode = ExitCode.FAILED_WITH_ERRORS;
- else
- exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
index b88bb01..5ddbf9f 100644
--- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
@@ -2946,7 +2946,7 @@ public class TestRoyaleMXMLApplication extends RoyaleTestBase
args[18] = new File(testAdapter.getUnitTestBaseDir(), "royale/files/RoyaleTest_again_Flash.mxml").getPath();
int result = mxmlc.mainNoExit(args, errors, true);
- assertThat(result, is(3));
+ assertThat(result, is(2));
assertErrors("Access of possibly undefined property scrollRect.");
}
diff --git a/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
index e2ef480..530465b 100644
--- a/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
+++ b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
@@ -51,13 +51,18 @@ import org.dom4j.io.SAXReader;
class PLAYERGLOBALC implements FlexTool {
static enum ExitCode {
- SUCCESS(0), PRINT_HELP(1), FAILED_WITH_PROBLEMS(2), FAILED_WITH_EXCEPTIONS(3), FAILED_WITH_CONFIG_PROBLEMS(4);
+ SUCCESS(0), PRINT_HELP(1), FAILED_WITH_ERRORS(2), FAILED_WITH_EXCEPTIONS(3), FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code) {
this.code = code;
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
private static final List<String> VECTOR_SUFFIXES = Arrays.asList("$double", "$int", "$uint", "$object");
@@ -252,7 +257,7 @@ class PLAYERGLOBALC implements FlexTool {
printer.printProblems(problems.getFilteredProblems());
}
- return exitCode.code;
+ return exitCode.getCode();
}
public void generateSources() throws Exception {
diff --git a/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java b/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
index 8c1a971..718136f 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
@@ -121,10 +121,9 @@ public class MXMLC implements FlexTool
// Therefore the following enum values must be non-negative.
SUCCESS(0),
PRINT_HELP(1),
- FAILED_WITH_PROBLEMS(0),
- FAILED_WITH_ERRORS(3),
- FAILED_WITH_EXCEPTIONS(4),
- FAILED_WITH_CONFIG_ERRORS(5);
+ FAILED_WITH_ERRORS(2),
+ FAILED_WITH_EXCEPTIONS(3),
+ FAILED_WITH_CONFIG_ERRORS(4);
ExitCode(int code)
{
@@ -351,7 +350,9 @@ public class MXMLC implements FlexTool
if (printer.printProblems(problems.getFilteredProblems()) > 0)
{
if (problems.hasErrors())
- exitCode = ExitCode.FAILED_WITH_ERRORS;
+ exitCode = ExitCode.FAILED_WITH_ERRORS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
}
else
@@ -391,6 +392,8 @@ public class MXMLC implements FlexTool
if (errorCount > 0)
exitCode = ExitCode.FAILED_WITH_ERRORS;
+ // no exit code for warnings because anything except 0 is
+ // detected as a failure by various build tools
}
return exitCode;
diff --git a/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java b/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
index af40ec4..a1bc2b0 100644
--- a/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
+++ b/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
@@ -83,13 +83,18 @@ public class FORMATTER {
private static final String FORMATTER_TAG_ON = "@formatter:on";
static enum ExitCode {
- SUCCESS(0), PRINT_HELP(1), FAILED_WITH_PROBLEMS(2), FAILED_WITH_EXCEPTIONS(3), FAILED_WITH_CONFIG_PROBLEMS(4);
+ SUCCESS(0), PRINT_HELP(1), FAILED_WITH_ERRORS(2), FAILED_WITH_EXCEPTIONS(3), FAILED_WITH_CONFIG_PROBLEMS(4);
ExitCode(int code) {
this.code = code;
}
final int code;
+
+ int getCode()
+ {
+ return code;
+ }
}
/**
@@ -193,7 +198,7 @@ public class FORMATTER {
printer.printProblems(problems.getFilteredProblems());
}
}
- return exitCode.code;
+ return exitCode.getCode();
}
public String formatFile(File file, Collection<ICompilerProblem> problems) throws IOException {