Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

In my Eclipse project are a handful of generated .java files that I need to use for SQLJ and I can't move to a separate project (due to Administrative Overhead). These files are also regularly regenerated so editing them is unfortunately out.

Unfortunately these files generate a few hundred java compiler warnings which drown out the useful warnings I get on files that I actually can edit.

Is there any way in Eclipse to say Ignore all the warnings of a file-by-file basis? Or can I block out a specific sub-directory?

like image 213
kutuzof Avatar asked Sep 02 '10 07:09

kutuzof


People also ask

How do I remove compiler warnings?

Turn off the warning for a project in Visual StudioSelect the Configuration Properties > C/C++ > Advanced property page. Edit the Disable Specific Warnings property to add 4996 . Choose OK to apply your changes.


2 Answers

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.

like image 104
Edward Brey Avatar answered Sep 22 '22 18:09

Edward Brey


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".

like image 40
meriton Avatar answered Sep 21 '22 18:09

meriton