private static boolean referencesType(final AstType reference, final TypeReference localType) { return reference != null && referencesType(reference.getUserData(Keys.TYPE_REFERENCE), localType); }
private static boolean referencesType(final AstType reference, final TypeReference localType) { return reference != null && referencesType(reference.getUserData(Keys.TYPE_REFERENCE), localType); }
private static boolean referencesType(final AstType reference, final TypeReference localType) { return reference != null && referencesType(reference.getUserData(Keys.TYPE_REFERENCE), localType); }
private static boolean canMoveLocalTypeIntoSubBlock( final Statement statement, final TypeReference localType, final boolean allowPassIntoLoops) { if (!allowPassIntoLoops && AstNode.isLoop(statement)) { return false; } // // We can move the local class into a sub-block only if the local class is used only in that // sub-block (and not in expressions such as the loop condition). // for (AstNode child = statement.getFirstChild(); child != null; child = child.getNextSibling()) { if (!(child instanceof BlockStatement) && referencesType(child, localType)) { if (hasNestedBlocks(child)) { // // Loops, catch clauses, switch sections, and labeled statements can contain nested blocks. // for (AstNode grandChild = child.getFirstChild(); grandChild != null; grandChild = grandChild.getNextSibling()) { if (!(grandChild instanceof BlockStatement) && referencesType(grandChild, localType)) { return false; } } } else { return false; } } } return true; }
private static boolean canMoveLocalTypeIntoSubBlock( final Statement statement, final TypeReference localType, final boolean allowPassIntoLoops) { if (!allowPassIntoLoops && AstNode.isLoop(statement)) { return false; } // // We can move the local class into a sub-block only if the local class is used only in that // sub-block (and not in expressions such as the loop condition). // for (AstNode child = statement.getFirstChild(); child != null; child = child.getNextSibling()) { if (!(child instanceof BlockStatement) && referencesType(child, localType)) { if (hasNestedBlocks(child)) { // // Loops, catch clauses, switch sections, and labeled statements can contain nested blocks. // for (AstNode grandChild = child.getFirstChild(); grandChild != null; grandChild = grandChild.getNextSibling()) { if (!(grandChild instanceof BlockStatement) && referencesType(grandChild, localType)) { return false; } } } else { return false; } } } return true; }
private static boolean canMoveLocalTypeIntoSubBlock( final Statement statement, final TypeReference localType, final boolean allowPassIntoLoops) { if (!allowPassIntoLoops && AstNode.isLoop(statement)) { return false; } // // We can move the local class into a sub-block only if the local class is used only in that // sub-block (and not in expressions such as the loop condition). // for (AstNode child = statement.getFirstChild(); child != null; child = child.getNextSibling()) { if (!(child instanceof BlockStatement) && referencesType(child, localType)) { if (hasNestedBlocks(child)) { // // Loops, catch clauses, switch sections, and labeled statements can contain nested blocks. // for (AstNode grandChild = child.getFirstChild(); grandChild != null; grandChild = grandChild.getNextSibling()) { if (!(grandChild instanceof BlockStatement) && referencesType(grandChild, localType)) { return false; } } } else { return false; } } } return true; }
private static boolean referencesType(final AstNode node, final TypeReference localType) { if (node instanceof AnonymousObjectCreationExpression) { for (final Expression argument : ((AnonymousObjectCreationExpression) node).getArguments()) { if (referencesType(argument, localType)) { return true; return referencesType(((LocalTypeDeclarationStatement) node).getTypeDeclaration(), localType); if (baseType != null && !baseType.isNull() && referencesType(baseType, localType)) { return true; if (referencesType(ifType, localType)) { return true; if (!field.getVariables().isEmpty() && referencesType(first(field.getVariables()), localType)) { return true; if (referencesType(method.getBody(), localType)) { return true; return referencesType((AstType) node, localType); if (referencesType(type, localType)) { return true; if (referencesType(forEach.getVariableType(), localType)) { return true; if (referencesType(resource.getType(), localType)) { return true;
private static boolean referencesType(final AstNode node, final TypeReference localType) { if (node instanceof AnonymousObjectCreationExpression) { for (final Expression argument : ((AnonymousObjectCreationExpression) node).getArguments()) { if (referencesType(argument, localType)) { return true; return referencesType(((LocalTypeDeclarationStatement) node).getTypeDeclaration(), localType); if (baseType != null && !baseType.isNull() && referencesType(baseType, localType)) { return true; if (referencesType(ifType, localType)) { return true; if (!field.getVariables().isEmpty() && referencesType(first(field.getVariables()), localType)) { return true; if (referencesType(method.getBody(), localType)) { return true; return referencesType((AstType) node, localType); if (referencesType(type, localType)) { return true; if (referencesType(forEach.getVariableType(), localType)) { return true; if (referencesType(resource.getType(), localType)) { return true;
private static boolean referencesType(final AstNode node, final TypeReference localType) { if (node instanceof AnonymousObjectCreationExpression) { for (final Expression argument : ((AnonymousObjectCreationExpression) node).getArguments()) { if (referencesType(argument, localType)) { return true; return referencesType(((LocalTypeDeclarationStatement) node).getTypeDeclaration(), localType); if (baseType != null && !baseType.isNull() && referencesType(baseType, localType)) { return true; if (referencesType(ifType, localType)) { return true; if (!field.getVariables().isEmpty() && referencesType(first(field.getVariables()), localType)) { return true; if (referencesType(method.getBody(), localType)) { return true; return referencesType((AstType) node, localType); if (referencesType(type, localType)) { return true; if (referencesType(forEach.getVariableType(), localType)) { return true; if (referencesType(resource.getType(), localType)) { return true;
if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; if (referencesType(nextNode, localType)) { return false;
if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; if (referencesType(nextNode, localType)) { return false;
if (referencesType(statement, localType)) { if (declarationPoint.get() != null) { return false; if (referencesType(nextNode, localType)) { return false;
final TypeReference bound = type.getExtendsBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; final TypeReference bound = type.getSuperBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true;
final TypeReference bound = type.getExtendsBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; final TypeReference bound = type.getSuperBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true;
final TypeReference bound = type.getExtendsBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; final TypeReference bound = type.getSuperBound(); if (!bound.isGenericParameter() && !MetadataHelper.isSameType(bound, type) && referencesType(bound, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true; if (!MetadataHelper.isSameType(typeArgument, type) && referencesType(typeArgument, localType)) { return true;
if (!referencesType(statement, typeDefinition)) { continue;
if (!referencesType(statement, typeDefinition)) { continue;
if (!referencesType(statement, typeDefinition)) { continue;