views:

113

answers:

3

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?

+2  A: 

One way to do this is to add @SuppressWarning(...) annotations to the source code.

Another way would be to move the troublesome code to a separate Eclipse project and use per-project compiler settings.

EDIT

Surely, you can partition your code into multiple projects with the appropriate inter-project dependencies?

If not, I'd say you are out of realistic options. (But if you want some unrealistic ones, you could post-process the generated code to add the annotations, hack the Eclipse Java compiler to implement per-file suppression, hack the Eclipse "Problems" view to implement per-file/directory filtering of errors, etc, etc.)

Stephen C
+1 "per-project compiler settings." New thing learnt!!
bdhar
Yea that is is good. The problem is that the SQLJ files are regularly newly generated (Whenever someone changes the SQL). So all the @SuppressWarning(all) disappear then.
kutuzof
A: 

@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

bdhar
Good too. The problem is that the SQLJ files are in the same project and many of the warnings are useful to have for other files. I need a file specific settings...
kutuzof
A: 

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

meriton
I've tried filtering the problems view to a working set. The "selected elements and its children only" is pretty sweet actually!
kutuzof