• Post Reply Bookmark Topic Watch Topic
  • New Topic

Suppressing Deprecation Warnings  RSS feed

 
David Peterson
author
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using JDK1.3.1.

I've written a class that implements the PreparedStatement interface, but the compiler complains that the setUnicodeStream() method is deprecated.

I'm not using the method, but I have to include it in order to implement the interface. I tried marking the method as /** @deprecated */ but this had no effect.

Does anyone know of a way to stop the warnings for this class only? (I don't want to turn off the warnings completely).
 
Rovas Kram
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me quickly give you a couple of supposed to's:

1) Deprecation warnings should be displayed when you use the -deprecation option of the compiler. Are you using a IDE that has that option set by default?

2) The @deprecated tag allows(not disallows) the compiler to issue deprecation warnings.
 
David Peterson
author
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think I explained well enough.

I am compiling with Ant. I have turned on 'deprecation warnings' because if any of my code is using deprecated methods then I want to be aware of that fact.

My issue is that I am never calling the deprecated methods in PreparedStatement, but I am still getting warnings just for implementing them. This seems crazy.

My IDE (Eclipse) is more sensible and stops reporting the warning if I put @deprecated as a javadoc tag before the implementation of the method, but the "javac" Ant task continues to report them.



Any bright ideas how to stop Ant reporting these false deprecation warnings, without turning them off completely?
[ August 20, 2004: Message edited by: David Peterson ]
 
Rovas Kram
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that because you use the @deprecated tag for your implementation class, the warning should be for the consumer of your class not your class itself. I suspect that this is a short coming of javac(maybe they didn't consider abstract methods) and your Eclipse IDE has a unique feature to account for the above.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!