public static CompilationUnit upToTop(Node node) { while (node != null && !(node instanceof CompilationUnit)) node = node.getParent(); return (CompilationUnit) node; } }
public static CompilationUnit upToTop(Node node) { while (node != null && !(node instanceof CompilationUnit)) node = node.getParent(); return (CompilationUnit) node; } }
public static CompilationUnit upToTop(Node node) { while (node != null && !(node instanceof CompilationUnit)) node = node.getParent(); return (CompilationUnit) node; } }
@Override public boolean contains(Node source) { if (source == null) return false; if (source.getParent() != parent) return false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == source) return true; } return false; }
@Override public boolean contains(Node source) { if (source == null) return false; if (source.getParent() != parent) return false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == source) return true; } return false; }
@Override public boolean contains(Node source) { if (source == null) return false; if (source.getParent() != parent) return false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == source) return true; } return false; }
private void updateRestrictionFlags(lombok.ast.Node node, NameReference ref) { ref.bits &= ~ASTNode.RestrictiveFlagMASK; ref.bits |= Binding.VARIABLE; if (node.getParent() instanceof lombok.ast.MethodInvocation) { if (((lombok.ast.MethodInvocation)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } if (node.getParent() instanceof lombok.ast.Select) { if (((lombok.ast.Select)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } }
private void updateRestrictionFlags(lombok.ast.Node node, NameReference ref) { ref.bits &= ~ASTNode.RestrictiveFlagMASK; ref.bits |= Binding.VARIABLE; if (node.getParent() instanceof lombok.ast.MethodInvocation) { if (((lombok.ast.MethodInvocation)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } if (node.getParent() instanceof lombok.ast.Select) { if (((lombok.ast.Select)node.getParent()).astOperand() == node) { ref.bits |= Binding.TYPE; } } }
@Override public void remove(Node source) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.remove(source)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
@Override public void replace(Node source, T replacement) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.replace(source, replacement)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
@Override public void remove(Node source) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.remove(source)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
@Override public void replace(Node source, T replacement) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.replace(source, replacement)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
@Override public void remove(Node source) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.remove(source)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
@Override public void replace(Node source, T replacement) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.replace(source, replacement)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
/** Returns the parent method of the given AST node */ @Nullable public static lombok.ast.Node getParentMethod(@NonNull lombok.ast.Node node) { lombok.ast.Node current = node.getParent(); while (current != null && !(current instanceof MethodDeclaration) && !(current instanceof ConstructorDeclaration)) { current = current.getParent(); } return current; }
@Override public boolean remove(Node source) { if (source == null) return false; if (source.getParent() != parent) return false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == source) { parent.disown((AbstractNode)source); fixEscaped(); list.remove(i); return true; } } return false; }
@Override public boolean remove(Node source) { if (source == null) return false; if (source.getParent() != parent) return false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == source) { parent.disown((AbstractNode)source); fixEscaped(); list.remove(i); return true; } } return false; }
@Nullable private static NormalTypeBody findSurroundingTypeBody(Node scope) { while (scope != null) { Class<? extends Node> type = scope.getClass(); // The Lombok AST uses a flat hierarchy of node type implementation classes // so no need to do instanceof stuff here. if (type == NormalTypeBody.class) { return (NormalTypeBody) scope; } scope = scope.getParent(); } return null; }
private static boolean isAncestor( @NonNull lombok.ast.Node ancestor, @Nullable lombok.ast.Node node) { while (node != null) { if (node == ancestor) { return true; } node = node.getParent(); } return false; }
private void checkStaticChain(Modifiers modifiers) { if (!modifiers.isStatic()) return; Node p = modifiers.getParent(); while (p != null) { if (p instanceof CompilationUnit) return; if (p instanceof TypeDeclaration) { Modifiers pMods = ((TypeDeclaration)p).astModifiers(); if (!pMods.isStatic()) { modifiers.getParent().addMessage(error(MODIFIERS_STATIC_CHAIN, "This declaration is (effectively) static; static declarations or only legal in top-level and static declarations.")); } } p = p.getParent(); } }