Skip to content
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

Conversation

@alexkravin
Copy link
Contributor

@alexkravin 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
Copy link
Member

@romani romani commented Jul 4, 2014

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

@daniilyar
Copy link
Member

@daniilyar 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
Copy link
Contributor Author

@alexkravin alexkravin commented Jul 6, 2014

Fixed. Updates with NestedTernaryCheck were removed from this Pull Request

@coveralls
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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.

1 similar comment
@coveralls
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link

@coveralls 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
Copy link
Member

@daniilyar 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
Copy link
Contributor Author

@alexkravin alexkravin commented Jul 7, 2014

Fixed.

@coveralls
Copy link

@coveralls 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.