suneet-s commented on a change in pull request #9690: IntelliJ inspection and 
checkstyle rule for "Collection.EMPTY_* field accesses replaceable with 
Collections.empty*()"
URL: https://github.com/apache/druid/pull/9690#discussion_r409533515
 
 

 ##########
 File path: codestyle/checkstyle.xml
 ##########
 @@ -325,5 +325,11 @@ codestyle/checkstyle.xml.
"/>
 
     <module name="StringLiteralEquality"/>
 
+    <module name="Regexp">
+      <property name="format" 
value="Collections\.(EMPTY_LIST|EMPTY_MAP|EMPTY_SET)"/>
+      <property name="message" value="Use Collections.empty*() method instead 
of Collection.EMPTY_* field"/>
+      <property name="illegalPattern" value="true"/>
+    </module>
 
 Review comment:
   I don't think this rule lines up with the intelliJ inspection warning. 
   
   See 
https://github.com/JetBrains/intellij-community/blob/master/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/collections_field_access_replaceable_by_method_call/CollectionsFieldAccessReplaceableByMethodCall.java
   
   It appears that object comparisons against `Collections.EMPTY_*` are not 
reported as errors on purpose, but this change would make checkstyle fail.
   
   The intelliJ inspections run as part of the build, so I think we can omit 
this change to the checkstyle.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to