Bug 80735 - [1.5] TypeVariable cannot extends TypeVariable
Summary: [1.5] TypeVariable cannot extends TypeVariable
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-10 17:12 EST by Olivier Thomann CLA
Modified: 2005-01-14 16:04 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 Olivier Thomann CLA 2004-12-10 17:12:49 EST
According to 4.4, the extends part of a TypeVariable has to be a
ClassOrInterfaceType (is not a TypeVariable).
public class X<U, V extends U> {}

should not compile.
Using javac 1.5, this code compiles fine.

If you add one more bound, it doesn't work anymore.

public class X<U, V, W extends U&V> {}

javac reports:
X.java:1: a type variable may not be followed by other bounds

Eclipse compiles both cases
public class X<U, V, W extends U&V> {}
Comment 1 Kent Johnson CLA 2005-01-14 16:04:35 EST
Actually with this case:
  public class X<U, V, W extends U&V> {}

we report: 'The type V is not an interface; it cannot be specified as a 
bounded parameter'

Since javac accepts this case:
  public class X<U, V extends U> {}

I think we need to continue to accept it.