Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.pmd.rules
Class ConstructorCallsOverridableMethod

    java.lang.Object
      net.sourceforge.pmd.CommonAbstractRule
          net.sourceforge.pmd.AbstractJavaRule
              net.sourceforge.pmd.AbstractRule
                  net.sourceforge.pmd.rules.ConstructorCallsOverridableMethod

All Implemented Interfaces:
  JavaParserVisitor, Rule

    public final class ConstructorCallsOverridableMethod

extends AbstractRule

Searches through all methods and constructors called from constructors. It marks as dangerous any call to overridable methods from non-private constructors. It marks as dangerous any calls to dangerous private constructors from non-private constructors.

Author:
  CL Gilbert (dnoyeb@users.sourceforge.net)

Field Summary

Fields inherited from interface net.sourceforge.pmd.Rule
`LOWEST_PRIORITY, PRIORITIES`

Constructor Summary
`ConstructorCallsOverridableMethod()`

Method Summary
`java.lang.Object` | `visit(ASTClassOrInterfaceDeclaration node, java.lang.Object data)` This check must be evaluated independelty for each class.
`java.lang.Object` | `visit(ASTCompilationUnit node, java.lang.Object data)`
`java.lang.Object` | `visit(ASTConstructorDeclaration node, java.lang.Object data)` Non-private constructor's methods are added to a list for later safety evaluation.
`java.lang.Object` | `visit(ASTEnumDeclaration node, java.lang.Object data)`
`java.lang.Object` | `visit(ASTMethodDeclarator node, java.lang.Object data)` Create a MethodHolder to hold the method.

Methods inherited from class net.sourceforge.pmd.AbstractJavaRule
`addViolation, addViolation, addViolation, addViolationWithMessage, apply, getDeclaringType, importsPackage, isQualifiedName, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll`

Methods inherited from class net.sourceforge.pmd.CommonAbstractRule
`addExample, addProperties, addProperty, addRuleChainVisit, asFixedMap, asFixedMap, end, equals, getBooleanProperties, getBooleanProperty, getBooleanProperty, getDescription, getDoubleProperties, getDoubleProperty, getDoubleProperty, getExample, getExamples, getExternalInfoUrl, getIntProperties, getIntProperty, getIntProperty, getMessage, getName, getPriority, getPriorityName, getProperties, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, getStringProperties, getStringProperty, getStringProperty, getTypeProperties, getTypeProperty, hashCode, hasProperty, include, propertiesByName, propertyDescriptorFor, setDescription, setExternalInfoUrl, setInclude, setMessage, setName, setPriority, setProperties, setProperty, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, start, usesDFA, usesRuleChain, usesTypeResolution`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConstructorCallsOverridableMethod

    public ConstructorCallsOverridableMethod()

Method Detail

### visit

    public java.lang.Object visit(ASTCompilationUnit node,
                                  java.lang.Object data)

  Specified by:
    `visit` in interface `JavaParserVisitor`
  Overrides:
    `visit` in class `AbstractJavaRule`

### visit

    public java.lang.Object visit(ASTEnumDeclaration node,
                                  java.lang.Object data)

  Specified by:
    `visit` in interface `JavaParserVisitor`
  Overrides:
    `visit` in class `AbstractJavaRule`

### visit

    public java.lang.Object visit(ASTClassOrInterfaceDeclaration node,
                                  java.lang.Object data)

  This check must be evaluated independelty for each class. Inner classses get their own EvalPackage in order to perform independent evaluation.

  Specified by:
    `visit` in interface `JavaParserVisitor`
  Overrides:
    `visit` in class `AbstractJavaRule`

### visit

    public java.lang.Object visit(ASTConstructorDeclaration node,
                                  java.lang.Object data)

  Non-private constructor's methods are added to a list for later safety evaluation. Non-private constructor's calls on private constructors are added to a list for later safety evaluation. Private constructors are added to a list so their safety to be called can be later evaluated.

  Note: We are not checking private constructor's calls on non-private constructors because all non-private constructors will be evaluated for safety anyway. This means we wont flag a private constructor as unsafe just because it calls an unsafe public constructor. We want to show only 1 instance of an error, and this would be 2 instances of the same error.

  Specified by:
    `visit` in interface `JavaParserVisitor`
  Overrides:
    `visit` in class `AbstractJavaRule`

### visit

    public java.lang.Object visit(ASTMethodDeclarator node,
                                  java.lang.Object data)

  Create a MethodHolder to hold the method. Store the MethodHolder in the Map as the key Store each method called by the current method as a List in the Map as the Object

  Specified by:
    `visit` in interface `JavaParserVisitor`
  Overrides:
    `visit` in class `AbstractJavaRule`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2009 InfoEther. All Rights Reserved.