JDK-6885255 : Improve usability of raw warnings
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: unknown
  • Submitted: 2009-09-24
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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 7
7 b109Fixed
Related Reports
Relates :  
Relates :  
Description
The comments about raw warnings in [1] suggest that the following improvements should be implemented:

*) no raw warnings on instanceof

e.g.

xxx instanceof List // no warning

*) no raw warnings on cast

e.g.

(List)xxx //no warning

*) no raw warnings when the type parameter of Class is raw

e.g.

Class<List> cl = ... //no warning

[1] - http://blogs.sun.com/mcimadamore/entry/diagnosing_raw_types

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/d6fe0ea070aa
19-08-2010

EVALUATION It would be nice not to have the compiler generating unavoidable warnings (as the ones for class) - moreover it seems more logical for the compiler to support cast/instance test where the target type is raw - actually this should be the only suported target type in the absence of reification [the fact that the compiler allows cast to generic types is the major compatibility issue that one will have to face when extending Java w/ support for reification].
24-09-2009