devoured elysium
devoured elysium

Reputation: 105067

Disabling warnings in my Java Eclipse Project for just a couple of files. Is it possible?

I am using a code generator that generates code that raises thousands of warnings just as

ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized    Parser.java

I'd like to know how to turn off specific kinds of warnings in specific files. I'd like to still have these kinds of warnings on other files of mine.

Is it possible to accomplish this?

Thanks

Upvotes: 4

Views: 2826

Answers (3)

Rudi
Rudi

Reputation: 106

At least in Eclipse Kepler, it is possible to switch off warnings per directory. In the package explorer, right click on the directory, then choose

Properties -> Java Compiler -> Ignore optional compile problems

I assume that this switches off other warnings as well - but for generated code, these have to be fixed by changing the generator anyway.

Upvotes: 5

Ravisha
Ravisha

Reputation: 3343

You can as well create working sets for the two sets 1>generated files and 2> code written by you. Then you can select to view warnings pertaining to the working set which ever you like . ScreenShot

On the top right corner of eclipse problem tab you can see one down arrow click on that, and select configure contents one more window shall open up where in you can configure to view warnings of desired working set. alternatively you could select show >show warnings & errors on selection. Now when you select the working set respective warnings will only be shown

Upvotes: 3

AlexR
AlexR

Reputation: 115328

I am afraid you can disable warnings for workspace or project only. I can suggest you 2 solutions: (1) put all generated code to separate project. I think this is a good practice anyway.

(2) Try to add "@SuppressWarnings" annotation to your generated class.

Upvotes: 2

Related Questions