Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way, in Eclipse, to remove deprecated warnings, pre Java 1.5

Tags:

java

eclipse

We have an internal Java library, that for legacy reasons, needs to be compiled using Java 1.4. However, this lib has gone through several versions, the latter of which have had certain methods and objects deprecated. For client support reasons, the code needs to use some of these deprecated methods/objects. As such, we always keep the latest lib on the build path of our projects (in Eclipse).

I would like to

@SuppressWarnings("deprecation");

Though, do to the aforementioned 1.4 dependency, this is not possible.

Is there a way for me to remove the warnings, if only from my Eclipse Problems view, and somewhat cleanup my development environment?

like image 720
P. Deters Avatar asked Jul 09 '10 05:07

P. Deters


2 Answers

Is there a way for me to remove the warnings, if only from my Eclipse Problems view, and somewhat cleanup my development environment?

You can configure the Java Compiler to ignore the Deprecated Warnings. I'd suggest to configure this setting for the specific project, not globally. To do so, right-click on your project and go to Properties > Java Compiler > Errors/Warnings. Click Enable project specific settings and then unfold Deprecated and restricted API and select Ignore for Deprecated API.

This will disable all deprecated warnings though.

like image 104
Pascal Thivent Avatar answered Nov 16 '22 01:11

Pascal Thivent


If you're not concerned about deprecation anywhere in that project, you could always give it custom project compilation settings and set it to ignore deprecation. It's not ideal, but it may well be better for you in this case than living with the deprecation warnings - it means you'll be able to spot ones in your other projects more easily.

like image 33
Jon Skeet Avatar answered Nov 16 '22 00:11

Jon Skeet