JDK-6939780 : add a warning to detect diamond sites
Type:Enhancement
Component:tools
Sub-Component:javac
Affected Version:7
Priority:P3
Status:Closed
Resolution:Fixed
OS:generic
CPU:unknown
Submitted:2010-03-31
Updated:2011-03-08
Resolved:2011-03-08
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.
Add a warning that detects diamond sites:
class Foo<T> {
Foo(T t) {}
}
Foo<String> fs = new Foo<String>(); //compiler should optionally issue a warning here
SUGGESTED FIX
A webrev of this fix is available at the following URL:
http://hg.openjdk.java.net/jdk7/tl/langtools/rev/fadc6d3e63f4
02-11-2010
EVALUATION
We should issue an optional warning when the type S inferred by the diamond operator (not available in the user code) is substitutable for the type explicitly occurring in the user code.