Diamond Operator For Variable Definition Check #188 #194

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@alexkravin
Contributor

Check highlights variable definition statements where diamond operator could be used.
http://docs.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html

E.g.:
Without diamond operator:
Map<String, Map<String, Integer>> someMap = new HashMap<String, Map<String, Integer>>();
With diamond operator:
Map<String, Map<String, Integer>> someMap = new HashMap<>();

@romani
Member
romani commented Jul 4, 2014

build is failed.
@daniilyar, please merge this PR as it become valid.

@daniilyar
Member

@alexkravin , please fix: https://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds/29129566
Failure caused by your NestedTernaryCheck updates. NestedTernaryCheck update should go in a separate Pull Request, it does NOT linked with DiamondOperatorForVariableDefinitionCheck

@alexkravin
Contributor

Fixed. Updates with NestedTernaryCheck were removed from this Pull Request

@alexkravin alexkravin was assigned by daniilyar Jul 7, 2014
@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 955abaa on alexkravin:ForceDiamondOperatorUsage_issue#188 into a1c2d2a on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling b79dacc on alexkravin:ForceDiamondOperatorUsage_issue#188 into a1c2d2a on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling ced6f03 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling ced6f03 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 10639b4 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 15453fa on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 03615e6 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 2c0a410 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 97ffce8 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling ae597bc on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling fc456c0 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling fc456c0 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling fc456c0 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@daniilyar
Member

I found redundant code duplication in file sonar/checkstyle-extensions.xml, please resolve it:

 <rule>
+   <key>com.github.sevntu.checkstyle.checks.coding.DiamondOperatorForVariableDefinitionCheck</key>
+       <name>Diamond Operator For Variable Definition</name>
+       <category name="design"/>
+       <description>Highlights variable definition statements where diamond operator could be used</description>
+       <configKey>Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.DiamondOperatorForVariableDefinitionCheck</configKey>
+   </rule>
+   <rule>
        <key>com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnTypeCheck</key>
        <name>Forbid Wildcard As Return Type</name>
        <category name="design"/>
@@ -293,6 +300,13 @@
        </param>
    </rule>
    <rule>
+       <key>com.github.sevntu.checkstyle.checks.coding.DiamondOperatorForVariableDefinitionCheck</key>
+       <name>Diamond Operator For Variable Definition</name>
+       <category name="design"/>
+       <description>Highlights variable definition statements where diamond operator could be used</description>
+       <configKey>Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.DiamondOperatorForVariableDefinitionCheck</configKey>
+   </rule>
+   <rule>
@alexkravin
Contributor

Fixed.

@coveralls

Coverage Status

Coverage increased (+0.02%) when pulling 6013b87 on alexkravin:ForceDiamondOperatorUsage_issue#188 into e14911c on sevntu-checkstyle:master.

@daniilyar daniilyar closed this Jul 7, 2014
@alexkravin alexkravin deleted the alexkravin:ForceDiamondOperatorUsage_issue#188 branch Jul 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment