views:

173

answers:

2

I am using Eclipse v3.5.

In previous Eclipse versions i remember if i have defined a method with a parameter and didn't use it internally a warning appears, like this :

public void myMethod( int x ) {
  // Didn't use x here so a warning appears at the x parameter.
}

But in v3.5 i do not see this warning. How can i enable it in Eclipse ?

A: 

I am not sure how to activate it in Eclipse, but I am quite sure you will get such a warning using the UCDetector plugin.

Gabriel Ščerbák
+4  A: 

See

Window / Preferences / Java / Compiler / ErrorsWarnings / Unnecessary Code / Parameter is never read

Note: If there is a valid reason for not using a parameter (e.g. it is used via reflection), you can suppress the warning by annotating the method with

@SuppressWarnings("unused")
sleske
Thanks ... I didn't see that at the beginning.
Brad
Cool! I was whining about the fact that Eclipse gave no warning on these just the other week, not knowing that all I had to do was turn it on.
Jay