Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use SuppressWarnings for unused method parameters (only)

843810Nov 15 2006 — edited Dec 9 2006
I have a method in a JSF backing bean that looks something like this:
  public void clickButton(ActionEvent ae)
  {
     // do the same thing every time
  }
and since "ae" is not used, I get a warning from javac to that effect.

I realize that I can do this:
  @SuppressWarnings("unused") 
  public void clickButton(ActionEvent ae)
  {
     // do the same thing every time
  }
but the problem with that is that is suppresses ALL unused-type warnings in the entire method.

What I would like to do is this
  public void clickButton(@SuppressWarnings("unused") ActionEvent ae)
  {
     // do the same thing every time
  }
but that does not seem to be supported. I still get the warnings from javac. I am using 1.5.0_07-b03. Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2007
Added on Nov 15 2006
1 comment
367 views