Bug 90438 - [compiler][1.5] Two problems: Automatically generated method has wrong generic type; Compilation error with JDK
Summary: [compiler][1.5] Two problems: Automatically generated method has wrong generi...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-06 08:29 EDT by Volker Renneberg CLA
Modified: 2006-04-28 15:01 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Renneberg CLA 2005-04-06 08:29:13 EDT
Hi!

This example covers two problems of Eclipse 3.1M6. The following code contains 
and internal class "MyInterfaceImpl" implementing the interface "MyInterface". 
If you leave out the necessary implementation of the method and ask Eclipse to 
generate a default implementation (as a solution for the error), the shown 
method will be generated:

       public <A extends Object & Data> void copyData(A data) {

although the signature should be

       public <A extends Data> void copyData(A data) {

Furthermore, the generated code does compile with Eclipse, Although it does 
not compile with the Javac compiler JDK 1.5 (update 2)
public class ExtendedGenericMethodSignature {
    public interface Data {
    }

    public interface MyInterface {
        public <A extends Data> void copyData(A data);
    }

    public class MyInterfaceImpl implements MyInterface {
        public <A extends Object & Data> void copyData(A data) {
        }
    }
}

Javac says:
ExtendedGenericMethodSignature.MyInterfaceImpl is not abstract and does not 
override abstract method <A>copyData(A) in 
ExtendedGenericMethodSignature.MyInterface.
Comment 1 Jerome Lanneluc CLA 2006-03-28 10:23:21 EST
Verified that the generated code is now as expected.
However we still have a different behavior than javac.
Comment 2 Philipe Mulet CLA 2006-04-04 09:23:53 EDT
Method verifier issue.

Comment 3 Philipe Mulet CLA 2006-04-21 09:33:07 EDT
+1 for 3.2RC2
Comment 4 Kent Johnson CLA 2006-04-21 13:32:55 EDT
Added MethodVerifier test86
Comment 5 Olivier Thomann CLA 2006-04-28 15:01:28 EDT
Verified with I20060427-1600 for 3.2RC2