Community
Participate
Working Groups
Created attachment 213796 [details] jdt core preferences only with relevant settings Steps to reproduce: 1) Create an eclipse plugin project. 2) Set from "Java Compiler->Errors/Warnings" all settings to default and the following two settings to be reported as errors: - Unnecessary code/Unused import - Generic types/Usage of a raw type 3) In a java file add a valid import package that is not used by a code. 4) Add a statement that would use a generic type in raw form. e.g. implement IAdaptable. The method "getAdapter" will generate "Usage of a raw type" warning. 5) Build java class. I expect for java compiler to report both types of errors: usage of generic raw types and having unused imports. Actually only usage of raw types will be reported. To exacerbate the issue, when using "@SuppressWarnings("rawtypes")" no errors/warnings will be reported. Attache is jdt core preferences and a sample java file
Created attachment 213797 [details] Sample java code
(In reply to comment #0) > > I expect for java compiler to report both types of errors: usage of generic raw > types and having unused imports. Actually only usage of raw types will be > reported. unused imports is being reported only if there are no errors by the time the check is done. This was done so that we don't report errors for those problems which would have required the import itself. However, I agree that this problem is slightly different and it may be good if we report both the errors. This will 'probably' fixed along with the fix for bug 371832. > > To exacerbate the issue, when using "@SuppressWarnings("rawtypes")" no > errors/warnings will be reported. > This will be fixed by bug 371832.
*** This bug has been marked as a duplicate of bug 371832 ***
(In reply to comment #0) > To exacerbate the issue, when using "@SuppressWarnings("rawtypes")" no > errors/warnings will be reported. Teo, are you saying a "true" compiler error can go undetected because of this issue?
(In reply to comment #4) > (In reply to comment #0) > > To exacerbate the issue, when using "@SuppressWarnings("rawtypes")" no > > errors/warnings will be reported. > > Teo, are you saying a "true" compiler error can go undetected because of this > issue? No, it is limited to warnings elevated to error severity
(In reply to comment #5) > > Teo, are you saying a "true" compiler error can go undetected because of this > > issue? > > No, it is limited to warnings elevated to error severity Whew :-)
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #0) > > > To exacerbate the issue, when using "@SuppressWarnings("rawtypes")" no > > > errors/warnings will be reported. > > > > Teo, are you saying a "true" compiler error can go undetected because of this > > issue? > > No, it is limited to warnings elevated to error severity Just want to add that bug 346175 took care of all kind of errors other than 'unused imports'.
(In reply to comment #7) > Just want to add that bug 346175 took care of all kind of errors other than > 'unused imports'. Great, thank you.
Verified for 3.8 M7 with build I20120430-2000