javaguavaerrorprone

Google errorprone java compiler - Default bugpatterns? Mark ignore?


I am getting some warnings regarding the accessing static method from a variable over class.

Is there a way to tell errorprone to ignore these warnings? Is error-prone loaded with a set of "bugpatterns"? Is it all of these:

https://github.com/google/error-prone/tree/master/core/src/main/java/com/google/errorprone/bugpatterns

How can I override for instance this to stop complaining:

Warning:(111, 21) java: [StaticAccessedFromInstance] Static method info should not be accessed from an object instance; instead use Log.info (see errorprone.info/bugpattern/StaticAccessedFromInstance) Did you mean 'Log.info( EntityError.class, Gson.asString(this) );'?

I am using Intellij.


Solution

  • According to the errorprone flags documentation, you can switch the check off with:

    -Xep:StaticAccessedFromInstance:OFF
    

    However, I agree with Kayaman: you are better off fixing the problem than working to ignore it.