error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

Invalid severity could have explicit error message

Open commonquail opened this issue 1 year ago • 0 comments

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)

commonquail avatar Mar 03 '24 13:03 commonquail