Bug 219625 - [1.5][compiler] Generics related AbstractMethodError that is not given by Sun Java
Summary: [1.5][compiler] Generics related AbstractMethodError that is not given by Sun...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-20 12:13 EST by Matt Hillsdon CLA
Modified: 2008-03-26 03:08 EDT (History)
3 users (show)

See Also:


Attachments
Java class demonstrating bug (1.22 KB, text/x-java)
2008-02-20 12:13 EST, Matt Hillsdon CLA
no flags Details
Proposed patch with testcase (3.75 KB, patch)
2008-03-13 15:03 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Hillsdon CLA 2008-02-20 12:13:23 EST
Created attachment 90208 [details]
Java class demonstrating bug

Build ID: M20071023-1652

Steps To Reproduce:
Compile and run the attached class.

This gives an AbstractMethodError in Eclipse 3.3.1.1.  I was surprised to find this works fine in Sun Java 1.6.0_03, to be honest I'd expected a compile error from both.

Exception in thread "main" java.lang.AbstractMethodError: GenericsAbstractMethodError$ConcreteFoo.doSomething(Ljava/lang/Object;)V
	at GenericsAbstractMethodError.feedFoosValueIntoFoo(GenericsAbstractMethodError.java:33)
	at GenericsAbstractMethodError.testGenericString(GenericsAbstractMethodError.java:46)
	at GenericsAbstractMethodError.main(GenericsAbstractMethodError.java:51)

Running javap on the class files shows that in the Sun Java compiled class there is a
    public void doSomething(java.lang.Object);
method.  In the Eclipse case there is no doSomething method on ConcreteFoo (explaining the AbstractMethodError).
Comment 1 Philipe Mulet CLA 2008-02-20 12:56:56 EST
Reproduced with HEAD.
Comment 2 Philipe Mulet CLA 2008-02-28 12:28:28 EST
Added GenericTypeTest#test1303-1304
Comment 3 Philipe Mulet CLA 2008-02-29 05:07:11 EST
Method verifier never issues a bridge method for #doSomething(T) in ConcreteFoo like it should. 
I believe this comes from the fact it eliminates Foo(String>#doSomething(String) early on (when computing inherited methods), hence it will not consider it any longer afterwards.
Comment 4 Kent Johnson CLA 2008-03-13 15:03:35 EDT
Created attachment 92492 [details]
Proposed patch with testcase
Comment 5 Kent Johnson CLA 2008-03-13 15:04:05 EDT
Released into HEAD for 3.4M6
Comment 6 Eric Jodet CLA 2008-03-26 03:08:19 EDT
Verified for 3.4M6 using build I20080324-1300