Bug 322547 - Eclipse gives a false type safety warning. When I "fix" it , it then warns me that the "Suppress Warnings" isn't suppressing anything
Summary: Eclipse gives a false type safety warning. When I "fix" it , it then warns m...
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 10:54 EDT by Greg Dougherty CLA
Modified: 2010-09-14 10:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Dougherty CLA 2010-08-12 10:54:22 EDT
Build Identifier: 

Building a GWT 2.0.4 project.  I have the following declarations:

public void getAvailableKeySpaces (String species, AsyncCallback<List<KeyspaceInfo>> callback);

class GetKeySpacesImpl implements AsyncCallback<List<KeyspaceInfo>> ....

gDataRetriever.getAvailableKeySpaces (species, new GetKeySpacesImpl (...));

Eclipse gives me the following warning:
type safety: the expression of type GetKeySpacesImpl needs unchecked conversion to conform to AsyncCallback<List<KeyspaceInfo>>

It does this for each of 10+ difference classes that have been declared to handle the different AsyncCallbacks.  However, if I declare ANY ONE of those classes to be generic:
class GetSpeciesImpl<E> implements AsyncCallback<List<String>>
, and then uselessly parametrize its call:
gDataRetriever.getAvailableSpecies (new GetSpeciesImpl<List<String>> (this));

ALL the Warnings disappear.

Reproducible: Always

Steps to Reproduce:
1. Declare a class that extends a particular parametrization for a typed interface
2. Try to use that class.  Get a warning.
3. Fix the Warning with Suppress Warnings, get a Warning that the Suppress Warnings isn't needed.
Comment 1 Greg Dougherty CLA 2010-08-12 10:55:33 EDT
Sorry.  Build Identifier is 20100617-1415
Comment 2 Ayushman Jain CLA 2010-08-12 13:34:10 EDT
Srikanth, please follow up! Thanks!
Comment 3 Srikanth Sankaran CLA 2010-08-12 19:19:14 EDT
(In reply to comment #0)
> Build Identifier: 
> 
> Building a GWT 2.0.4 project.  I have the following declarations:

Please attach a test case:

I have tried the following and don't see any warnings:

import java.util.List;

class DataRetriver {
	public void getAvailableKeySpaces (String species,
			AsyncCallback<List<KeyspaceInfo>> callback) {}
}

interface AsyncCallback<T> {}
class KeyspaceInfo {}
class GetKeySpacesImpl implements AsyncCallback<List<KeyspaceInfo>> {}

public class Bug {
    public static void main(String[] args) {
    	new DataRetriver().getAvailableKeySpaces ("species", 
    			new GetKeySpacesImpl ());
    }
}

We love a defect reporter who provides a test case that will
fit in a single editor (where possible) and their defects get
priority.

:)
Comment 4 Srikanth Sankaran CLA 2010-08-16 07:06:02 EDT
You may also want to compile your program with
javac and see if you get any warnings.

Use -Xlint:unchecked option to javac.
Comment 5 Srikanth Sankaran CLA 2010-08-31 04:51:51 EDT
As things stand, no progress can be made. There are no
known issues in this area. I plan to close this WORKSFORME.
If you manage to dig up a case you can reopen it then.
Comment 6 Srikanth Sankaran CLA 2010-09-03 02:48:58 EDT
Please reopen if a test case becomes available. As it
is no progress can be made.
Comment 7 Olivier Thomann CLA 2010-09-14 10:10:11 EDT
Verified for 3.7M2 using I20100914-0100