| Summary: | Unused @SuppressWarnings(..) not flagged when suppressed problem is set to Error | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | Olivier_Thomann, stephan.herrmann | ||||||||
| Version: | 3.6 | ||||||||||
| Target Milestone: | 3.6 M6 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Markus Keller
Created attachment 160333 [details]
Proposed fix + regression tests
Running all tests to make sure we don't have regressions.
We had a check to tolerate unnecessary @SuppressWarnings when errors. This should only apply to mandatory errors.
Created attachment 160334 [details]
Proposed fix + regression tests
One more regression test.
This means that @SuppressWarnings are reported as unused if the corresponding setting is set to error and the new option is not set.
So that code:
public class TestUnused {
void m() {
@SuppressWarnings("cast")
int i= (int) 0;
@SuppressWarnings("cast")
byte b= (byte) i;
System.out.println(b);
}
}
with:
- set "Errors/Warnings > Unnecessary Code > Unnecessary cast or..." to Error
- uncheck "Errors/Warnings > Annotations > "Suppress optional errors with
'@SuppressWarnings'"
both @SuppressWarnings are reported as unused.
Is this what you expect ?
(In reply to comment #3) Yes, that would be fine with me. Created attachment 160347 [details]
Proposed fix + regression tests
Updated existing tests.
Released for 3.6M6. Regression tests added in: org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test284 org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test285 org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test286 Verified for 3.6M6 using build I20100307-2000. |