How can I disable compiler warnings in Eclipse on a file specific basis? [duplicate]

Solution 1:

Ensure the files are under the gen folder, the typical home for all generated .java files. Then in the project properties, under Java Build Path, set Ignore optional compile problems for that folder to Yes.

If your project structure requires your files be in a folder other than gen, add that folder to the Java Build Path so that you can enable ignoring optional compile problems for it.

Solution 2:

The "problems" view in eclipse can be filtered; I always have it set to "on selected element and its children only". Granted, this is more of a work-around, but it lessens the impact of having the files in the same project. (Note that even if you must have them in the same project, you can keep them in a separate source folder).

Edit: To configure the filters, find the icon with a downward arrow with tooltip "View Menu" on the top right of the problems view. Click it, and then click "configure contents".

Solution 3:

@SuppressWarning annotation?

Per, Stephen's comment, you can find the "Per project compiler settings option here"

Project->Properties->Java Compiler->Errors/Warnings

Enable project specific settings

alt text