Bug 282209 - [1.5][compiler] Compiler allows type parameter outside its bound for local class
Summary: [1.5][compiler] Compiler allows type parameter outside its bound for local class
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-01 16:14 EDT by Brad Dolin CLA
Modified: 2009-08-04 02:55 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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