Bug 282209

Summary: [1.5][compiler] Compiler allows type parameter outside its bound for local class
Product: [Eclipse Project] JDT Reporter: Brad Dolin <bdolin>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, Olivier_Thomann, srikanth_sankaran, stephan.herrmann
Version: 3.4.1   
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Brad Dolin CLA 2009-07-01 16:14:25 EDT
Build ID: M20080911-1700

Consider the following code:

public class Test
{
    class Blorg<T extends Serializable>
    {
    }
    
    void foo()
    {
        class Geblaro extends Blorg<Object>
        {
        }
    }
}

We should get this compiler warning:

"The type Object is not a valid substitute for the bounded parameter <T extends Serializable> of the type Test.Blorg<T>"

But in fact we get no error at all. If Geblaro is promoted to a non-local class (e.g., an inner class in Test) we do get the error message.

More information:

Note that javac does give an error for the local class:

type parameter java.lang.Object is not within its bound
        class Geblaro extends Blorg<Object>
                                    ^
1 error
Comment 1 Stephan Herrmann CLA 2009-07-01 18:03:32 EDT
Could you please give it a try in 3.5? Seems to be fixed there,
i.e., I do get the expected error message.
Comment 2 Brad Dolin CLA 2009-07-02 11:19:54 EDT
(In reply to comment #1)
> Could you please give it a try in 3.5? Seems to be fixed there,
> i.e., I do get the expected error message.

Verified expected error message in 3.5.

Comment 3 Olivier Thomann CLA 2009-07-02 17:21:23 EDT
Kent, maybe you can find a duplicate to close this one.
Comment 4 Kent Johnson CLA 2009-07-07 12:26:19 EDT
Had no luck finding a duplicate for this case.
Comment 5 Srikanth Sankaran CLA 2009-08-04 02:55:08 EDT
Verified for 3.6M1