JDK-4881267 : improve diagnostic for "instanceof T" for type parameter T
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2003-06-19
  • Updated: 2013-10-08
  • Resolved: 2013-09-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b110Fixed
Related Reports
Relates :  
Description
If T is an identifier for a parameterized type, then using
"instanceof T" obviously shouldn't be legal.  The compiler does enforce
this but the error message "unexpected type ... found T, required class
or array" doesn't make it obvious that this is a deliberate restriction.

--------------------------------

An example:

class T4881267 {
    <T> void m(Object o) {
	boolean b = o instanceof T;
    }
}

###@###.### 2004-09-17

Comments
deferring to 9 as low priority
10-05-2013

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon mustang
19-09-2004

PUBLIC COMMENTS ...
19-09-2004

EVALUATION Should be fixed before generics roll out. ###@###.### 2003-06-20 Let's see if we can do it in an update. ###@###.### 2004-09-17
20-06-2003