Library class deprecated and marked for removal - how to silence warning ONLY in the affected class using it?
已回答
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?
请先登录再写评论。
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"})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”.
Hi Bruno Genovese
Thanks for the update, it's good to hear now it's working.