Library class deprecated and marked for removal - how to silence warning ONLY in the affected class using it?

Answered

I have a class that uses spring's JdbcDaoSupport.  It is marked deprecated and for removal.  I need to use it anyway but I can find no way to silence the warning unless I suppress the warning globally for all deprecated classes… which I clearly do not want to do.

I tried using @SuppressWarnings("Deprecation") but it doesn't help.

Suggestions?

0
3 comments

Hi Bruno Genovese 

The root cause here is the use of uppercase “D” on “Deprecation”; it should be lowercase “deprecation” then it'll work. Below is an example:

@SuppressWarnings({"deprecation", "removal"})

0

Thanks, in the end it was “removal” in the class declaration, deprecation wasn't needed.

The import was still choking but I fixed it by skipping the import altogether and instead using “extends org.springframework.jdbc.core.support.JdbcDaoSupport”.

0

Hi Bruno Genovese

Thanks for the update, it's good to hear now it's working.

0

Please sign in to leave a comment.