Bug 227185 - [1.5][compiler] Compiler error using generics with static class
Summary: [1.5][compiler] Compiler error using generics with static class
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-15 13:13 EDT by Divyanshu Sharma CLA
Modified: 2008-05-16 03:05 EDT (History)
2 users (show)

See Also:
philippe_mulet: review+


Attachments
Proposed patch with testcases (3.25 KB, patch)
2008-05-14 11:42 EDT, Kent Johnson CLA
no flags Details | Diff
New proposed patch and testcases (6.91 KB, patch)
2008-05-14 14:31 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 Divyanshu Sharma CLA 2008-04-15 13:13:52 EDT
Build ID: M20080221-1800

Steps To Reproduce:
Compiler error appears in eclipse with following test case. However, the class compiles fine with JDK 1.5.0_06


public class TestEclipseGenerics
{
    public static abstract class SuperAbstract<Owner, Type>
    {
        public abstract Object foo(Type other);
    }
 
    public static abstract class HalfGenericSuper<Owner> extends SuperAbstract<Owner, String>
    {
        public abstract Object foo(String other);
    }
 
    public static abstract class AbstractImpl<Owner> extends HalfGenericSuper<Owner>
    {
        public Object foo(String other)
        {
            return null;
        }
    }
 
    public static class Concrete extends AbstractImpl
    {
    }
}

More information:
Comment 1 Olivier Thomann CLA 2008-04-15 13:22:45 EDT
With HEAD, I got:
----------
1. ERROR in D:\tests_sources\TestEclipseGenerics.java (at line 21)
	public static class Concrete extends AbstractImpl
	                    ^^^^^^^^
The type TestEclipseGenerics.Concrete must implement the inherited abstract method TestEclipseGenerics.SuperAbstract.foo(Object)
----------
2. WARNING in D:\tests_sources\TestEclipseGenerics.java (at line 21)
	public static class Concrete extends AbstractImpl
	                                     ^^^^^^^^^^^^
TestEclipseGenerics.AbstractImpl is a raw type. References to generic type TestEclipseGenerics.AbstractImpl<Owner> should be parameterized
----------
2 problems (1 error, 1 warning)

It compiles fine with JDK6 and 1.5.0_15.
Comment 2 Kent Johnson CLA 2008-05-14 11:42:16 EDT
Created attachment 100208 [details]
Proposed patch with testcases
Comment 3 Philipe Mulet CLA 2008-05-14 11:59:41 EDT
#doesMethodOverride(...) does not seem to check the return type any longer. So didn't we lose part of the logic with the patch ?
Comment 4 Kent Johnson CLA 2008-05-14 14:31:56 EDT
Created attachment 100266 [details]
New proposed patch and testcases

Passes all of our tests

Added MethodVerifyTest 161-164 (the last 2 verify our behaviour with mismatched return types)
Comment 5 Kent Johnson CLA 2008-05-14 15:45:04 EDT
Released for 3.4RC1

Philippe - please add the +1
Comment 6 Philipe Mulet CLA 2008-05-14 16:33:29 EDT
+1 for 3.4RC1
Comment 7 Maxime Daniel CLA 2008-05-15 03:11:27 EDT
Waiting for new build availability for final verification. Hosting upon v_864 yields correct results.
Comment 8 Maxime Daniel CLA 2008-05-16 03:05:31 EDT
Verified for 3.4 RC1 using build I20080515-2000.