3

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)

Community
  • 1
  • 1
Vito De Tullio
  • 2,332
  • 3
  • 33
  • 52
  • 1
    How about using the Java > Compiler > Errors/Warnings preference page to disable the parameter assignment warning? – Howard Wang May 04 '15 at 07:58
  • 1
    well... I *like* this eclipse check. I think it's correct to use it. Just, in a couple of cases, I need to potentially modify input parameters, and I didn't like these false positives – Vito De Tullio May 10 '15 at 09:32

2 Answers2

4

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...

Daniele Torino
  • 1,714
  • 2
  • 16
  • 22
0

There is no annotation to suppress that warning, and I don't think there ever was except maybe in a milestone or nightly build. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=53773 (especially the last 5 or 6 comments, where the annotation token was discussed and ultimately removed from the code).

E-Riz
  • 31,431
  • 9
  • 97
  • 134