Bug 105339 - [1.5][compiler] The internal compiler incorrectly handles constraints to type variables
Summary: [1.5][compiler] The internal compiler incorrectly handles constraints to type...
Status: RESOLVED DUPLICATE of bug 125956
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-27 13:01 EDT by Dinko Tenev CLA
Modified: 2006-02-24 13:15 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dinko Tenev CLA 2005-07-27 13:01:01 EDT
The following perfectly legal fragment compiles OK with javac (jdk1.5.0_04) from
the command line, but is rejected by the internal compiler, with the error "The
return type is incompatible with U.foo()" reported for V.foo():


class C<T> {}

class A {}
class U { public <T extends A> C<T> foo() { return null; } }

class B extends A {}
class V extends U { public C<B> foo() { return null; } }
Comment 1 Olivier Thomann CLA 2005-07-27 13:50:25 EDT
Javac reports an unchecked warning:
X.java:23: warning: foo() in V overrides <T>foo() in U; return type requires
unchecked conversion
found   : C<B>
required: C<T>
class V extends U { public C<B> foo() { return null; } }
                                ^
1 warning
Comment 2 Kent Johnson CLA 2005-07-28 14:52:39 EDT
Need to check the spec closer since with this case, the return types are not 
compatible:

class C<T> {}
class A { C<A> foo() { return null; } }
class B extends A { C<B> foo() { return super.foo(); } }
Comment 3 Philipe Mulet CLA 2005-07-28 18:27:30 EDT
Could be a javac bug.
Comment 4 Brian Miller CLA 2005-08-01 11:20:32 EDT
Is this related to bug 97693?
Comment 5 Kent Johnson CLA 2005-08-02 16:04:13 EDT
No its not.

This is an issue with comparing a method with an inherited method, its not a 
cast issue.
Comment 6 Kent Johnson CLA 2006-02-24 13:15:01 EST
Added MethodVerify test82

*** This bug has been marked as a duplicate of 125956 ***