Groovy Documentation

groovy.org.codenarc.rule.groovyism
[Groovy] Class AssignCollectionSortRule

java.lang.Object
  org.codenarc.rule.AbstractAstVisitorRule
      groovy.org.codenarc.rule.groovyism.AssignCollectionSortRule

class AssignCollectionSortRule
extends AbstractAstVisitorRule

The Collections.sort() method mutates the list and returns the list as a value. If you are assigning the result of sort() to a variable, then you probably don't realize that you're also modifying the original list as well. This is frequently the cause of subtle bugs.

Authors:
Hamlet D'Arcy


Property Summary
Class astVisitorClass

String name

int priority

 

Property Detail

astVisitorClass

Class astVisitorClass


name

String name


priority

int priority


 

Groovy Documentation