private static boolean isInnerClass(@Nullable ClassDeclaration node) { return node == null || // null class declarations means anonymous inner class JavaContext.getParentOfType(node, ClassDeclaration.class, true) != null; }
/** * Returns the first ancestor node of the given type * * @param element the element to search from * @param clz the target node type * @param <T> the target node type * @return the nearest ancestor node in the parent chain, or null if not found * @deprecated Use {@link PsiTreeUtil#getParentOfType} instead */ @Deprecated @Nullable public static <T extends Node> T getParentOfType( @Nullable Node element, @NonNull Class<T> clz) { return getParentOfType(element, clz, true); }
Statement statement = getParentOfType(node, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator();
Try tryCatch = context.getParentOfType(parent, Try.class); if (tryCatch == null) { break;
Statement statement = getParentOfType(argument, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator();
checkTypeDefConstant(context, annotation, argument, errorNode, flag, resolved); } else if (argument instanceof VariableReference) { Statement statement = getParentOfType(argument, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator();
Statement statement = getParentOfType(node, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator();
Node parent = node; while (true) { Try tryCatch = getParentOfType(parent, Try.class); if (tryCatch == null) { break; MethodDeclaration declaration = getParentOfType(parent, MethodDeclaration.class); if (declaration != null) { for (TypeReference typeReference : declaration.astThrownTypeReferences()) {