Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 376390 - Setting warning "Usage of a raw type" to be reported as error will hide reporting warnings/errors for unused imports
Summary: Setting warning "Usage of a raw type" to be reported as error will hide repor...
Status: VERIFIED DUPLICATE of bug 371832
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7.2   Edit
Hardware: PC Windows 7
: P3 minor (vote)
Target Milestone: 3.8 M7   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-10 07:51 EDT by Teodor Madan CLA
Modified: 2012-05-03 02:16 EDT (History)
3 users (show)

See Also:


Attachments
jdt core preferences only with relevant settings (287 bytes, application/octet-stream)
2012-04-10 07:51 EDT, Teodor Madan CLA
no flags Details
Sample java code (374 bytes, application/octet-stream)
2012-04-10 08:04 EDT, Teodor Madan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Teodor Madan CLA 2012-04-10 07:51:44 EDT
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
Comment 1 Teodor Madan CLA 2012-04-10 08:04:10 EDT
Created attachment 213797 [details]
Sample java code
Comment 2 Satyam Kandula CLA 2012-04-10 09:00:57 EDT
(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.
Comment 3 Satyam Kandula CLA 2012-04-10 09:01:12 EDT

*** This bug has been marked as a duplicate of bug 371832 ***
Comment 4 John Cortell CLA 2012-04-10 09:14:45 EDT
(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?
Comment 5 Teodor Madan CLA 2012-04-10 09:16:05 EDT
(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
Comment 6 John Cortell CLA 2012-04-10 09:17:35 EDT
(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 :-)
Comment 7 Satyam Kandula CLA 2012-04-10 10:07:25 EDT
(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'.
Comment 8 Teodor Madan CLA 2012-04-10 10:37:35 EDT
(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.
Comment 9 Jay Arthanareeswaran CLA 2012-05-03 02:16:57 EDT
Verified for 3.8 M7 with build I20120430-2000