Invalid severity could have explicit error message #4306
Closed
Description
opened on Mar 3, 2024
That WARN
is WARN
and not WARNING
frequently trips me up. When a mistake like that is made the default output is something like
Fatal error compiling: invalid flag: -Xep:WildcardImport:WARNING
This is true, and Maven's -e
flag does reveal the likely cause:
Caused by: com.google.errorprone.InvalidCommandLineOptionException: invalid flag: -Xep:WildcardImport:WARNING
at com.google.errorprone.ErrorProneOptions$Builder.parseSeverity (ErrorProneOptions.java:288)
...
However, the implementation of ErrorProneOptions$Builder
as of 2.25.0 does specifically know that the error in question is an unrecognized severity name and could say as much in the error message.
For comparison, checker names are also validated but in a different location and with a clear message (but an unclear stack trace):
Caused by: com.google.errorprone.InvalidCommandLineOptionException: wildcardimport is not a valid checker name
at com.google.errorprone.scanner.ScannerSupplier.lambda$applyOverrides$12 (ScannerSupplier.java:201)
at com.google.common.collect.RegularImmutableMap.forEach (RegularImmutableMap.java:297)
at com.google.errorprone.scanner.ScannerSupplier.applyOverrides (ScannerSupplier.java:195)
at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$0 (ErrorProneAnalyzer.java:79)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get (Suppliers.java:181)
Metadata
Assignees
Labels
No labels
Activity