JDK-6298110 : Permit annotation-based invalidation of raw type use for new generic type
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-07-18
  • Updated: 2011-02-16
  • Resolved: 2007-04-19
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
Raw types are needed for backwards compatibility, but this only applies to legacy types (such as collections). This request is for a compiler extension that would recognize a class annotation (@NoRaw) and emit a compile-time error message if the annotated class is invoked without a type parameter.

JUSTIFICATION :
Writing a new generic type that may be invoked using raw types requires significant defensive programming that would not be necessary if client use of raw types was forbidden. Implementing this RFE would allow a new generic type to be written in a simpler fashion.

The request is effectively an attempt to get closer to how generic types might be implemented had the need for backwards compatibility not been paramount. This need does not exist for newly-written generic types.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
As above.

CUSTOMER SUBMITTED WORKAROUND :
Write defensive code.
###@###.### 2005-07-18 10:07:41 GMT

Comments
EVALUATION A number of options for handling raw types will be considered if generics are enhanced in the future. I am closing this CR in favor of 6512103, which is marginally more realistic in suggesting a compiler flag for disallowing all raw types rather than a per-class qualification.
15-11-2006