Bug 70695

Summary: [1.5] warning for easily detectible incorrect bounds
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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