A DESCRIPTION OF THE REQUEST :
When porting code to use generics, and also when writing new code, often it is hard to find where generics could be fuller specified in the code.
This occurs for instance
1. when some code is calling a method and using a non generic declaration to store the variable
e.g.
List x = x.foo();
when x.foo() returns List<sometype>
2. when constructing a new object, not specifying the generic parameters
e.g. List x = new ArrayList()
should be List<Object> x = new ArrayList<Object>();
or something similar
3. when the return value of a method is not generified, but the implementation of the method returns a generic value
JUSTIFICATION :
It would significantly improve the porting time if the developer could see at a glance when the new features of the language may be used
When porting code to use generics, and also when writing new code, often it is hard to find where generics could be fuller specified in the code.
This occurs for instance
1. when some code is calling a method and using a non generic declaration to store the variable
e.g.
List x = x.foo();
when x.foo() returns List<sometype>
2. when constructing a new object, not specifying the generic parameters
e.g. List x = new ArrayList()
should be List<Object> x = new ArrayList<Object>();
or something similar
3. when the return value of a method is not generified, but the implementation of the method returns a generic value
JUSTIFICATION :
It would significantly improve the porting time if the developer could see at a glance when the new features of the language may be used
- duplicates
-
JDK-6334465 javac can provide a suggestion in the warning about unchecked call/conversion in the generics
-
- Closed
-