diff options
author | Herman van Hovell <hvanhovell@questtec.nl> | 2016-02-11 18:23:44 -0800 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-02-11 18:23:44 -0800 |
commit | 8121a4b1cb4d7efa84a5e9e8e16d6656cdb79b85 (patch) | |
tree | c71488d21880e00a3b7221d806b536ff252cf3cb /project | |
parent | b10af5e238ce2051be2bf4d7ddda181d34cbb69a (diff) | |
download | spark-8121a4b1cb4d7efa84a5e9e8e16d6656cdb79b85.tar.gz spark-8121a4b1cb4d7efa84a5e9e8e16d6656cdb79b85.tar.bz2 spark-8121a4b1cb4d7efa84a5e9e8e16d6656cdb79b85.zip |
[SPARK-13277][BUILD] Follow-up ANTLR warnings are treated as build errors
It is possible to create faulty but legal ANTLR grammars. ANTLR will produce warnings but also a valid compileable parser. This PR makes sure we treat such warnings as build errors.
cc rxin / viirya
Author: Herman van Hovell <hvanhovell@questtec.nl>
Closes #11174 from hvanhovell/ANTLR-warnings-as-errors.
Diffstat (limited to 'project')
-rw-r--r-- | project/SparkBuild.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index 550b5bad8a..6eba58c87c 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -433,9 +433,12 @@ object Catalyst { } // Generate the parser. - antlr.process - if (antlr.getNumErrors > 0) { - log.error("ANTLR: Caught %d build errors.".format(antlr.getNumErrors)) + antlr.process() + val errorState = org.antlr.tool.ErrorManager.getErrorState + if (errorState.errors > 0) { + sys.error("ANTLR: Caught %d build errors.".format(errorState.errors)) + } else if (errorState.warnings > 0) { + sys.error("ANTLR: Caught %d build warnings.".format(errorState.warnings)) } // Return all generated java files. |