public final <T extends AstNode> Iterable<T> getAncestors(@NotNull final Class<T> type) { VerifyArgument.notNull(type, "type"); return ofType(getAncestors(), type); }
public final <T extends AstNode> Iterable<T> getAncestors(@NotNull final Class<T> type) { VerifyArgument.notNull(type, "type"); return ofType(getAncestors(), type); }
public final <T extends AstNode> Iterable<T> getAncestors(@NotNull final Class<T> type) { VerifyArgument.notNull(type, "type"); return ofType(getAncestors(), type); }
private static void removeUnreachableBlocks(final Block method) { final BasicBlock entryBlock = first(ofType(method.getBody(), BasicBlock.class)); final Set<Label> liveLabels = new LinkedHashSet<>();
private static void removeUnreachableBlocks(final Block method) { final BasicBlock entryBlock = first(ofType(method.getBody(), BasicBlock.class)); final Set<Label> liveLabels = new LinkedHashSet<>();
private static void removeUnreachableBlocks(final Block method) { final BasicBlock entryBlock = firstOrDefault(ofType(method.getBody(), BasicBlock.class));
@Override public Void visitArrayInitializerExpression(final ArrayInitializerExpression node, final Void data) { super.visitArrayInitializerExpression(node, data); final ArrayCreationExpression creation = firstOrDefault(ofType(node.getAncestors(), ArrayCreationExpression.class)); if (creation == null || !creation.getAdditionalArraySpecifiers().hasSingleElement()) { return null; } for (final Expression element : node.getElements()) { addCastForAssignment(creation.getType(), element); } return null; }
@Override public AstNode visitSwitchSection(final SwitchSection node, final Void p) { if (node.getStatements().size() != 1) { return super.visitSwitchSection(node, p); } final Statement firstStatement = node.getStatements().firstOrNullObject(); if (firstStatement instanceof BlockStatement) { final BlockStatement block = (BlockStatement) firstStatement; if (any(ofType(block.getStatements(), VariableDeclarationStatement.class))) { return super.visitSwitchSection(node, p); } block.remove(); block.getStatements().moveTo(node.getStatements()); } return super.visitSwitchSection(node, p); } }
final TypeDeclaration type = (TypeDeclaration) node; for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { if (!field.getVariables().isEmpty() && usesVariable(first(field.getVariables()), variableName)) { return true; for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { if (usesVariable(method.getBody(), variableName)) { return true;
final TypeDeclaration type = (TypeDeclaration) node; for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { if (!field.getVariables().isEmpty() && usesVariable(first(field.getVariables()), variableName)) { return true; for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { if (usesVariable(method.getBody(), variableName)) { return true;
final TypeDeclaration type = (TypeDeclaration) node; for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { if (!field.getVariables().isEmpty() && usesVariable(first(field.getVariables()), variableName)) { return true; for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { if (usesVariable(method.getBody(), variableName)) { return true;
final Statement statement = firstOrDefault(ofType(prev.getAncestorsAndSelf(), Statement.class));
final Statement statement = firstOrDefault(ofType(prev.getAncestorsAndSelf(), Statement.class));
final Statement statement = firstOrDefault(ofType(prev.getAncestorsAndSelf(), Statement.class));
for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { final FieldDefinition fieldDefinition = field.getUserData(Keys.FIELD_DEFINITION); for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { final MethodDefinition methodDefinition = method.getUserData(Keys.METHOD_DEFINITION);
for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { final FieldDefinition fieldDefinition = field.getUserData(Keys.FIELD_DEFINITION); for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { final MethodDefinition methodDefinition = method.getUserData(Keys.METHOD_DEFINITION);
for (final FieldDeclaration field : ofType(type.getMembers(), FieldDeclaration.class)) { final FieldDefinition fieldDefinition = field.getUserData(Keys.FIELD_DEFINITION); for (final MethodDeclaration method : ofType(type.getMembers(), MethodDeclaration.class)) { final MethodDefinition methodDefinition = method.getUserData(Keys.METHOD_DEFINITION);