Bug 84355 - [1.5] Generics bounds overzealous when converting to Object
Summary: [1.5] Generics bounds overzealous when converting to Object
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-03 13:28 EST by JR Boyens CLA
Modified: 2005-03-31 09:09 EST (History)
0 users

See Also:


Attachments
Test case showing the bug (1.41 KB, application/octet-stream)
2005-02-03 13:29 EST, JR Boyens CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description JR Boyens CLA 2005-02-03 13:28:09 EST
Attached is a test case that shows the bug w/ the respective Eclipse project
files, etc.

I've also included the files inline because they are so small:

public class ClassA
{
  public ClassA()
  {
    String[] strings = new String[] { "test" };	
    
    // this fails
    Object obj = ClassB.doSomething((String)strings[0]);
	
    // this works fine
    String intermediate = ClassB.doSomething((String)strings[0]);
    Object obj1 = intermediate;
  }
}

public class ClassB
{
  public static <TargetType extends Serializable> TargetType doSomething(String
value)
  {
    return (TargetType)value;
  }
}
Comment 1 JR Boyens CLA 2005-02-03 13:29:26 EST
Created attachment 17664 [details]
Test case showing the bug
Comment 2 JR Boyens CLA 2005-02-03 13:29:53 EST
Forgot to include that this is against build I20050201-0800
Comment 3 Philipe Mulet CLA 2005-02-18 06:34:07 EST
We use expected type (from assignment LHS: Object) in place of type variable
erasure (Serializable).
We should be using the most specific of the 2.
Comment 4 Philipe Mulet CLA 2005-02-18 06:41:54 EST
Added GenericTypeTest#test510.
Fixed
Comment 5 David Audel CLA 2005-03-31 09:09:23 EST
Verified in I20050330-0500