Skip to content

Invalid severity could have explicit error message #4306

Closed
@commonquail

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions