Search code examples
javaeclipsewarningseclipse-lunasuppress-warnings

Disable warning "The parameter ... should not be assigned" in Eclipse Luna?


Is there an annotation to tell eclipse to disable the check triggering the warning "The parameter ... should not be assigned" on a method basis?

According to What is the list of valid @SuppressWarnings warning names in Java? there "was" a "paramAssign" parameter to pass to @SuppressWarnings, but in my eclipse (Version: Luna Service Release 2 (4.4.2); Build id: 20150219-0600) it is not recognized.

So... is there some other value to @SuppressWarnings to disable the parameter assignment warning (which, generally, I find useful)


Solution

  • The only way I found to disable that warning (without completely disabling it in the preferences) is using

    @SuppressWarnings("all")
    

    Of course this will disable all warnings in the annotated method. That's why I recommend only using this in combination with findbugs or similar.

    One could also comment out the annotation before making changes to the method and put it back once the changes are done. But knowing developers this will probably been forgotten or not done because of laziness...