Bug 280809

Summary: [1.5][compiler] Type mismatch: cannot convert ... compiler errors
Product: [Eclipse Project] JDT Reporter: Michael Giroux <michael_giroux>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, philippe_mulet, srikanth_sankaran
Version: 3.5   
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Giroux CLA 2009-06-18 14:12:43 EDT
Build ID: 20090611-1022  3.5 RC4

Installed 3.5 RC4.  Project that builds in 3.4 is getting compile errors building with 3.5 RC4 : "Type mismatch: cannot convert from Component to BillingItem"

More information:
Installed 3.5RC4 and attempted to build a project that builds without errors in 3.4, and using command line javac from JDK 1.5, and 1.6.  The Eclipse compiler is generating errors on statements that to not get errors when building in Eclipse 3.4, and when building with JDK 1.6.0_14.

The problem was originally posted in the tools.jdt newsgroup.  Text of the original post is at the end of this report.

The following line gets the error:
      BillingItem result = ComponentFactory.getComponent(BillingItem.class, owner);

We have a ComponentFactory class that returns objects of a requested type.  The first parameter of the getComponent method is a Class of the desired type.  The getComponent method declares the return type using generics notation.  

The method being called is:
   public static <D extends DAO<?>,T extends Component<D, ? extends PrimaryKey<?>>> T getComponent(
         Class<T> component,          Component<? extends DAO<?>, ? extends PrimaryKey<?>> parent)
   {
      T result = newInstance(component, parent.environment);
      result.setOwner(parent);
      return result;
   }


Note that the method accepts a 'component' parameter of type Class<T> that should result in the correct type being returned.  Can anyone explain why this is now causing compile error in Eclipse 3.5?

Let me know how much more info you need to investigate.
Comment 1 Olivier Thomann CLA 2009-06-18 15:38:52 EDT
Could you please provide a complete test case that worked with 3.4 and now failed with 3.5?
Comment 2 Kent Johnson CLA 2009-06-18 15:56:55 EDT
Michael - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643#c6

*** This bug has been marked as a duplicate of bug 277643 ***
Comment 3 Srikanth Sankaran CLA 2009-08-04 04:26:05 EDT
Verified for 3.6M1
Comment 4 Michael Giroux CLA 2009-08-04 09:26:51 EDT
(In reply to comment #3)
> Verified for 3.6M1

What exactly does "Verified for 3.6M1" imply?

This bug was marked as a duplicate of 277643, and the comments in that bug indicate the compiler is correct and that it will not be fixed.

Comment 5 Srikanth Sankaran CLA 2009-08-05 00:53:42 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > Verified for 3.6M1
> What exactly does "Verified for 3.6M1" imply?

That it was verified to be a duplicate at the 3.6
M1 milestone release time.