New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diamond Operator For Variable Definition Check #188 #194

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@alexkravin
Contributor

alexkravin commented Jul 4, 2014

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

This comment has been minimized.

Show comment
Hide comment
@romani

romani Jul 4, 2014

Member

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

Member

romani commented Jul 4, 2014

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

@daniilyar

This comment has been minimized.

Show comment
Hide comment
@daniilyar

daniilyar Jul 5, 2014

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

Member

daniilyar commented Jul 5, 2014

@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

This comment has been minimized.

Show comment
Hide comment
@alexkravin

alexkravin Jul 6, 2014

Contributor

Fixed. Updates with NestedTernaryCheck were removed from this Pull Request

Contributor

alexkravin commented Jul 6, 2014

Fixed. Updates with NestedTernaryCheck were removed from this Pull Request

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

Coverage Status

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

@daniilyar

This comment has been minimized.

Show comment
Hide comment
@daniilyar

daniilyar Jul 7, 2014

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>
Member

daniilyar commented Jul 7, 2014

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

This comment has been minimized.

Show comment
Hide comment
@alexkravin

alexkravin Jul 7, 2014

Contributor

Fixed.

Contributor

alexkravin commented Jul 7, 2014

Fixed.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 7, 2014

Coverage Status

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

coveralls commented Jul 7, 2014

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