Details
Description
The idea is to start simple: report only when the type on the LHS is exactly the same as the one on the RHS.
MyClass myClass = new MyClass(); // Noncompliant var myClass = new MyClass(); // Compliant List<String> list = new ArrayList<String>(); // Compliant, not the same type. var list = new ArrayList<String>(); // Compliant
Be careful to only report an issue if the code is supporting Java 10 and if the variable is local.
Eventually, in a second step, we could improve the rule when the type is not the same (subtype).
Attachments
Issue Links
- implements
-
RSPEC-6212 Local-Variable Type Inference should be used
- Active