public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
@Override public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
public boolean visit(EnumConstantDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveVariable(); return true; }
/** * Called only from visitFieldInitNode(node,context) */ private CAstNode createEnumConstantDeclarationInit(EnumConstantDeclaration node, WalkContext context) { String hiddenVariableName = (String) node.getProperty("com.ibm.wala.cast.java.translator.jdt.fakeValuesDeclName"); if (hiddenVariableName == null) { FieldReference fieldRef = fIdentityMapper.getFieldRef(node.resolveVariable()); // We use null to indicate an OBJECT_REF to a static field CAstNode lhsNode = makeNode(context, fFactory, node, CAstNode.OBJECT_REF, makeNode(context, fFactory, null, CAstNode.VOID), fFactory.makeConstant(fieldRef)); // CONSTRUCT ARGUMENTS & "new MyEnum(...)" statement ArrayList<Object> arguments = new ArrayList<>(); arguments.add(fFactory.makeConstant(node.getName().getIdentifier())); // name of constant arguments.add(fFactory.makeConstant(node.resolveVariable().getVariableId())); // id arguments.addAll(node.arguments()); CAstNode rhsNode = createClassInstanceCreation(node, arguments, node.resolveConstructorBinding(), null, node .getAnonymousClassDeclaration(), context); CAstNode assNode = makeNode(context, fFactory, node, CAstNode.ASSIGN, lhsNode, rhsNode); return assNode; // their naming, not mine } else { // String[] x = (new Direction[] { // NORTH, EAST, SOUTH, WEST, $VALUES, $VALUES$ // }); return null; } }
private IMethodBinding[] getUnimplementedMethods(ASTNode typeNode) { ITypeBinding binding = null; boolean implementAbstractsOfInput = false; if (typeNode instanceof AnonymousClassDeclaration) { AnonymousClassDeclaration decl = (AnonymousClassDeclaration) typeNode; binding = decl.resolveBinding(); } else if (typeNode instanceof AbstractTypeDeclaration) { AbstractTypeDeclaration decl = (AbstractTypeDeclaration) typeNode; binding = decl.resolveBinding(); } else if (typeNode instanceof EnumConstantDeclaration) { EnumConstantDeclaration enumConstantDeclaration = (EnumConstantDeclaration) typeNode; if (enumConstantDeclaration.getAnonymousClassDeclaration() != null) { binding = enumConstantDeclaration.getAnonymousClassDeclaration().resolveBinding(); } else { IVariableBinding varBinding = enumConstantDeclaration.resolveVariable(); if (varBinding != null) { binding = varBinding.getDeclaringClass(); implementAbstractsOfInput = true; } } } if (binding == null) { return new IMethodBinding[0]; } IMethodBinding[] unimplementedMethods = StubUtility2Core.getUnimplementedMethods(binding, implementAbstractsOfInput); Arrays.sort(unimplementedMethods, new MethodsSourcePositionComparator(binding)); return unimplementedMethods; } }
private IMethodBinding[] getUnimplementedMethods(ASTNode typeNode) { ITypeBinding binding= null; boolean implementAbstractsOfInput= false; if (typeNode instanceof AnonymousClassDeclaration) { AnonymousClassDeclaration decl= (AnonymousClassDeclaration) typeNode; binding= decl.resolveBinding(); } else if (typeNode instanceof AbstractTypeDeclaration) { AbstractTypeDeclaration decl= (AbstractTypeDeclaration) typeNode; binding= decl.resolveBinding(); } else if (typeNode instanceof EnumConstantDeclaration) { EnumConstantDeclaration enumConstantDeclaration= (EnumConstantDeclaration) typeNode; if (enumConstantDeclaration.getAnonymousClassDeclaration() != null) { binding= enumConstantDeclaration.getAnonymousClassDeclaration().resolveBinding(); } else { IVariableBinding varBinding= enumConstantDeclaration.resolveVariable(); if (varBinding != null) { binding= varBinding.getDeclaringClass(); implementAbstractsOfInput= true; } } } if (binding == null) return new IMethodBinding[0]; IMethodBinding[] unimplementedMethods= StubUtility2Core.getUnimplementedMethods(binding, implementAbstractsOfInput); Arrays.sort(unimplementedMethods, new MethodsSourcePositionComparator(binding)); return unimplementedMethods; } }
private IMethodBinding[] getUnimplementedMethods(ASTNode typeNode) { ITypeBinding binding= null; boolean implementAbstractsOfInput= false; if (typeNode instanceof AnonymousClassDeclaration) { AnonymousClassDeclaration decl= (AnonymousClassDeclaration) typeNode; binding= decl.resolveBinding(); } else if (typeNode instanceof AbstractTypeDeclaration) { AbstractTypeDeclaration decl= (AbstractTypeDeclaration) typeNode; binding= decl.resolveBinding(); } else if (typeNode instanceof EnumConstantDeclaration) { EnumConstantDeclaration enumConstantDeclaration= (EnumConstantDeclaration) typeNode; if (enumConstantDeclaration.getAnonymousClassDeclaration() != null) { binding= enumConstantDeclaration.getAnonymousClassDeclaration().resolveBinding(); } else { IVariableBinding varBinding= enumConstantDeclaration.resolveVariable(); if (varBinding != null) { binding= varBinding.getDeclaringClass(); implementAbstractsOfInput= true; } } } if (binding == null) return new IMethodBinding[0]; IMethodBinding[] unimplementedMethods= StubUtility2.getUnimplementedMethods(binding, implementAbstractsOfInput); Arrays.sort(unimplementedMethods, new MethodsSourcePositionComparator(binding)); return unimplementedMethods; } }
/** * Only called from createClassDeclaration. */ private CAstEntity visit(EnumConstantDeclaration decl) { return new FieldEntity(decl.getName().getIdentifier(), decl.resolveVariable().getType(), enumQuals, makePosition(decl .getStartPosition(), decl.getStartPosition() + decl.getLength()), null, makePosition(decl.getName())); }
IVariableBinding var = ((EnumConstantDeclaration) parent).resolveVariable(); insert(typeDependency, ownValue, resolveBinding(var));
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
recordNodes(enumConstantDeclaration, enumConstant); recordNodes(typeName, enumConstant); enumConstantDeclaration.resolveVariable();
return resolveBinding(((AnonymousClassDeclaration) node).resolveBinding()); } else if (node instanceof EnumConstantDeclaration) { return resolveBinding(((EnumConstantDeclaration) node).resolveVariable()); } else if (node instanceof ClassInstanceCreation) { return resolveBinding(((ClassInstanceCreation) node).resolveConstructorBinding());