resolve non-exhaustive switch statements without defaults
OpenPublic

Description

bazel 0.4.5 generates a few different errors on the current code [0, 1]:
because there are non-exhaustive switch statements that don't have defaults.

In case [0] this is sort of a non-issue because there is a _different_ switch statement earlier in the code that includes a default (which rejects all other enum values with an exception), but this is fragile.
In cases like these we may want to refactor the code to remove this fragility.

In case [1] there is no previous switch statement that provides a run-time guard (AFAICT).
In cases like these we need to provide a meaningful default behavior (throwing an exception, logging, etc.).

[0] kythe/java/com/google/devtools/kythe/extractors/java/JavaCompilationUnitExtractor.java&l=480
[1] kythe/kythe/java/com/google/devtools/kythe/analyzers/java/JavaEntrySets.java?l=111

jrtom created this task.Via WebMar 22 2017, 10:48 AM
jrtom changed the edit policy of this Maniphest Task from "Task Author" to "Core Team (Project)".
jrtom added a subscriber: jrtom.
Herald added a subscriber: Core Team. · View Herald TranscriptVia HeraldMar 22 2017, 10:48 AM

Add Comment