Bug 70695 - [1.5] warning for easily detectible incorrect bounds
Summary: [1.5] warning for easily detectible incorrect bounds
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 3.1 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-22 17:15 EDT by Adam Kiezun CLA
Modified: 2004-11-04 10:51 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 Adam Kiezun CLA 2004-07-22 17:15:26 EDT
consider 
class A<T extends String & List<T>>{
 ..
}

String is final so this bound in simply wrong - it can never be realized.
It's trivially detectible and perhaps a worthwhile warning. 
(kind of like the mandatory error for 
 "foo" instanceof Integer
 (it can never be true so compiler catches it statically))
Comment 1 Philipe Mulet CLA 2004-07-23 09:11:47 EDT
There is already a warning for final bounds. Have you seen it ?
Comment 2 Adam Kiezun CLA 2004-07-23 09:18:17 EDT
nope. that sort of fixes it then.
ok to close from my side. 

however, the problem in this report is definitely indicating a bug while a final
bound can be ok (you can still use your A<T extends String> class while A<T
extends String & RandomAccess> is doomed from the beginning).
Comment 3 Frederic Fusier CLA 2004-10-28 13:21:25 EDT
Using build I200410260800, problem report is:
"The type parameter T should not be bounded by the final type String. Final
types cannot be further extended"

Consider this problem fixed.
I'll add this bug to JDT/Core buildnotes.
Comment 4 Frederic Fusier CLA 2004-10-29 13:18:49 EDT
Test case already exists: GenericTypeTest#test021
Comment 5 Frederic Fusier CLA 2004-11-04 10:51:44 EST
Verified for 3.1 M3 with build I200411040800