private boolean isInLocalTypeInsideInputType(ASTNode node, AbstractTypeDeclaration declaration) { final TypeDeclarationStatement statement= (TypeDeclarationStatement) ASTNodes.getParent(node, TypeDeclarationStatement.class); return statement != null && ASTNodes.isParent(statement, declaration); }
private boolean isInAnonymousTypeInsideInputType(ASTNode node, AbstractTypeDeclaration declaration) { final AnonymousClassDeclaration anonymous= (AnonymousClassDeclaration) ASTNodes.getParent(node, AnonymousClassDeclaration.class); return anonymous != null && ASTNodes.isParent(anonymous, declaration); }
@Override public int compare(ToStaticAccessOperation o1, ToStaticAccessOperation o2) { if (ASTNodes.isParent(o1.fQualifier, o2.fQualifier)) { return -1; } else if (ASTNodes.isParent(o2.fQualifier, o1.fQualifier)) { return 1; } else { return o1.fQualifier.getStartPosition() - o2.fQualifier.getStartPosition(); } } });
@Override public int compare(ToStaticAccessOperation o1, ToStaticAccessOperation o2) { if (ASTNodes.isParent(o1.fQualifier, o2.fQualifier)) { return -1; } else if (ASTNodes.isParent(o2.fQualifier, o1.fQualifier)) { return 1; } else { return o1.fQualifier.getStartPosition() - o2.fQualifier.getStartPosition(); } } });
public boolean visit(ContinueStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
public boolean visit(BreakStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
@Override public boolean visit(BreakStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
@Override public boolean visit(ContinueStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
@Override public boolean visit(ContinueStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
private ASTNode getCommonParent(ASTNode node1, ASTNode node2) { ASTNode parent= node1.getParent(); while (parent != null && !ASTNodes.isParent(node2, parent)) { parent= parent.getParent(); } return parent; }
public static boolean isDeclaredIn(VariableDeclaration tempDeclaration, Class<? extends ASTNode> astNodeClass) { ASTNode initializer= ASTNodes.getParent(tempDeclaration, astNodeClass); if (initializer == null) return false; AnonymousClassDeclaration anonymous= ASTNodes.getParent(tempDeclaration, AnonymousClassDeclaration.class); if (anonymous == null) return true; // stupid code. Is to find out if the variable declaration isn't a field. if (ASTNodes.isParent(anonymous, initializer)) return false; return true; } }
private ASTNode getCommonParent(ASTNode node1, ASTNode node2) { ASTNode parent= node1.getParent(); while (parent != null && !ASTNodes.isParent(node2, parent)) { parent= parent.getParent(); } return parent; }
public boolean visit(LabeledStatement node) { if (fDefiningLabel == null) { SimpleName label= node.getLabel(); if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) { fDefiningLabel= node; fResult.add(label); } } node.getBody().accept(this); return false; } }
private boolean isInNonStaticMemberTypeInsideInputType(ASTNode node, AbstractTypeDeclaration declaration) { final AbstractTypeDeclaration nested= ASTNodes.getParent(node, AbstractTypeDeclaration.class); return nested != null && !declaration.equals(nested) && !Modifier.isStatic(nested.getFlags()) && ASTNodes.isParent(nested, declaration); }
private boolean isBindingToTemp(IVariableBinding variable) { if (variable.isField()) return false; if (!Modifier.isFinal(variable.getModifiers())) return false; ASTNode declaringNode= fCompilationUnitNode.findDeclaringNode(variable); if (declaringNode == null) return false; if (ASTNodes.isParent(declaringNode, fAnonymousInnerClassNode)) return false; return true; }
private boolean isBindingToTemp(IVariableBinding variable) { if (variable.isField()) return false; if (!Modifier.isFinal(variable.getModifiers())) return false; ASTNode declaringNode= fCompilationUnitNode.findDeclaringNode(variable); if (declaringNode == null) return false; if (ASTNodes.isParent(declaringNode, fAnonymousInnerClassNode)) return false; return true; }
private boolean isInsideSubclassOfDeclaringType(ASTNode node) { Assert.isTrue((node instanceof ClassInstanceCreation) || (node instanceof SuperConstructorInvocation)); final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(node, AbstractTypeDeclaration.class); Assert.isNotNull(declaration); final AnonymousClassDeclaration anonymous= (AnonymousClassDeclaration) ASTNodes.getParent(node, AnonymousClassDeclaration.class); boolean isAnonymous= anonymous != null && ASTNodes.isParent(anonymous, declaration); if (isAnonymous) return anonymous != null && isSubclassBindingOfEnclosingType(anonymous.resolveBinding()); return isSubclassBindingOfEnclosingType(declaration.resolveBinding()); }
private boolean isInsideSubclassOfDeclaringType(ASTNode node) { Assert.isTrue((node instanceof ClassInstanceCreation) || (node instanceof SuperConstructorInvocation)); final AbstractTypeDeclaration declaration= ASTNodes.getParent(node, AbstractTypeDeclaration.class); Assert.isNotNull(declaration); final AnonymousClassDeclaration anonymous= ASTNodes.getParent(node, AnonymousClassDeclaration.class); boolean isAnonymous= anonymous != null && ASTNodes.isParent(anonymous, declaration); if (isAnonymous) return anonymous != null && isSubclassBindingOfEnclosingType(anonymous.resolveBinding()); return isSubclassBindingOfEnclosingType(declaration.resolveBinding()); }
private boolean isInsideSubclassOfDeclaringType(ASTNode node) { Assert.isTrue((node instanceof ClassInstanceCreation) || (node instanceof SuperConstructorInvocation)); final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(node, AbstractTypeDeclaration.class); Assert.isNotNull(declaration); final AnonymousClassDeclaration anonymous= (AnonymousClassDeclaration) ASTNodes.getParent(node, AnonymousClassDeclaration.class); boolean isAnonymous= anonymous != null && ASTNodes.isParent(anonymous, declaration); if (isAnonymous) return anonymous != null && isSubclassBindingOfEnclosingType(anonymous.resolveBinding()); return isSubclassBindingOfEnclosingType(declaration.resolveBinding()); }
private boolean isBindingToTemp(IVariableBinding variable) { if (variable.isField()) return false; if (!Modifier.isFinal(variable.getModifiers()) && !JavaModelUtil.is18OrHigher(fCu.getJavaProject())) return false; ASTNode declaringNode= fCompilationUnitNode.findDeclaringNode(variable); if (declaringNode == null) return false; if (ASTNodes.isParent(declaringNode, fAnonymousInnerClassNode)) return false; return true; }