Groovy Documentation

org.codenarc.rule.basic
[Groovy] Class ExplicitHashMapInstantiationRule

java.lang.Object
  org.codenarc.rule.AbstractRule
      org.codenarc.rule.AbstractAstVisitorRule
          org.codenarc.rule.basic.ExplicitHashMapInstantiationRule

class ExplicitHashMapInstantiationRule
extends AbstractAstVisitorRule

This rule checks for the explicit instantiation of a HashMap using the no-arg constructor. In Groovy, it is best to write "new HashMap()" as "[:]", which creates the same object.

Authors:
Hamlet D'Arcy
Chris Mair
Version:
\$Revision: 540 \$ - \$Date: 2011-01-17 17:13:49 -0500 (Mon, 17 Jan 2011) \$


Field Summary
 
Fields inherited from class AbstractAstVisitorRule
DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME
 
Property Summary
String name

int priority

 
Method Summary
AstVisitor getAstVisitor()

 
Methods inherited from class AbstractAstVisitorRule
applyTo, getAstVisitor, shouldApplyThisRuleTo
 
Methods inherited from class AbstractRule
applyTo, applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, isReady, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate
 

Property Detail

name

String name


priority

int priority


 
Method Detail

getAstVisitor

@Override
AstVisitor getAstVisitor()


 

Groovy Documentation