1 4 package org.hammurapi.inspectors; 5 6 import org.hammurapi.InspectorBase; 7 8 import com.pavelvlasov.jsel.TypeBody; 9 import com.pavelvlasov.jsel.TypeDefinition; 10 import com.pavelvlasov.jsel.VariableDefinition; 11 12 13 19 public class VariableNameClashesWithTypeNameRule extends InspectorBase { 20 21 27 public void visit(VariableDefinition element) { 28 29 TypeBody enclosingType = element.getEnclosingType(); 30 if (enclosingType instanceof TypeDefinition && ((TypeDefinition) enclosingType).getName().equals(element.getName())) { 31 context.reportViolation(element); 32 } 33 } 34 35 } 36 | Popular Tags |