Skip to content

Commit 22689eb

Browse files
authored
Add @SuppressWarnings("FallThrough") on generated lexer. (#454)
* Enabled Error-prone FallThrough WARN in Bazel * Add @SuppressWarnings("FallThrough") on generated lexer. * Let Travis use the project's bazelrc
1 parent 16bc6e5 commit 22689eb

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# https://errorprone.info/
2+
# TODO(#222) Increase to error when we build from jflex-1.7.1 with a lexer annotated with
3+
# @SuppressWarnings
4+
build --javacopt "-Xep:FallThrough:WARN"

.ci.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import %workspace%/.bazelrc
2+
13
# This is from Bazel's former travis setup, to avoid blowing up the RAM usage.
24
startup --host_jvm_args=-Xms2000m
35
startup --host_jvm_args=-Xmx3000m

jflex/src/main/java/jflex/Emitter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ private void emitUserCode() {
434434
}
435435

436436
private void emitClassName() {
437+
// TODO(#222) Actually fix the fall-through violations
438+
println("// See https://github.com/jflex-de/jflex/issues/222");
439+
println("@SuppressWarnings(\"FallThrough\")");
437440
if (scanner.isPublic) print("public ");
438441

439442
if (scanner.isAbstract) print("abstract ");

0 commit comments

Comments
 (0)