Skip to content
Snippets Groups Projects
Commit 8121a4b1 authored by Herman van Hovell's avatar Herman van Hovell Committed by Reynold Xin
Browse files

[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.
parent b10af5e2
No related branches found
No related tags found
No related merge requests found
...@@ -433,9 +433,12 @@ object Catalyst { ...@@ -433,9 +433,12 @@ object Catalyst {
} }
// Generate the parser. // Generate the parser.
antlr.process antlr.process()
if (antlr.getNumErrors > 0) { val errorState = org.antlr.tool.ErrorManager.getErrorState
log.error("ANTLR: Caught %d build errors.".format(antlr.getNumErrors)) 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. // Return all generated java files.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment