| Summary: | @SuppressWarnings warningToken doesn't work | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Heiko Böttger <heiko.boettger> |
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, stephan.herrmann |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Heiko Böttger
(In reply to comment #0) > Steps to Reproduce: > 1. create a class > 2. add @SuppressWarnings("unused,warningToken") > 3. should not create a warnung The @SuppressWarnings annotation is working as it is intended to. I think you did not use it in the correct way. All the warning kinds that you need to suppress have to be specified in a string array as value for the annotation. So, you would use @SuppressWarnings ({"unused", "null"}) to suppress unused warnings and null warnings. You can also use quick fix (CTRL-1) on the warning that you don't want to see and chose "Add @SuppressWarnings.." and let JDT add the annotation for you. (In reply to comment #0) > JDT should allow a "warningToken" to suppress the warning caused by unused > tokens in @SuppressWarnings. If indeed you want to suppress the warning Unnecessary @SuppressWarnings("foo") then this is not covered by the build notes you cite, but it looks like a duplicate of enhancement request bug 252518. Please confirm, thanks. (In reply to comment #2) > (In reply to comment #0) > > JDT should allow a "warningToken" to suppress the warning caused by unused > > tokens in @SuppressWarnings. > > If indeed you want to suppress the warning > Unnecessary @SuppressWarnings("foo") > then this is not covered by the build notes you cite, but it looks like a > duplicate of enhancement request bug 252518. > > Please confirm, thanks. Thanks Stephan. Yes, I thought that there should be something like this @SuppressWarnings({ "warningToken", "rawtypes", "unused" }). I think I got confused because according to the table on this website http://yottabyte.net/blog/?m=200806 and some other websites, there is a real token named "warningToken". This means that the buildnotes only uses this as a placeholder. And yes that was what I was looking for, I wonder why I didn't found it. So you can mark this as an dupplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=252518. Do you see any chance to get that fixed in 3.7. The problem is, that we make use of code generation, which causes a bunch of warnings if there is an unused import. However if we suppress the warning, we get a new warning where ever the import is used :). (In reply to comment #1) > (In reply to comment #0) > > Steps to Reproduce: > > 1. create a class > > 2. add @SuppressWarnings("unused,warningToken") > > 3. should not create a warnung > > The @SuppressWarnings annotation is working as it is intended to. I think you > did not use it in the correct way. All the warning kinds that you need to > suppress have to be specified in a string array as value for the annotation. > So, you would use @SuppressWarnings ({"unused", "null"}) to suppress unused > warnings and null warnings. > You can also use quick fix (CTRL-1) on the warning that you don't want to see > and chose "Add @SuppressWarnings.." and let JDT add the annotation for you. Sorry for that, I must have had a blackout. Your are right the tokens have to be passed as an array. Marking as dup as per above comment *** This bug has been marked as a duplicate of bug 252518 *** |