Bug 84355

Summary: [1.5] Generics bounds overzealous when converting to Object
Product: [Eclipse Project] JDT Reporter: JR Boyens <jboyens>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test case showing the bug none

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