Java Code Examples for org.eclipse.jdt.core.dom.ASTNode#QUALIFIED_NAME
The following examples show how to use
org.eclipse.jdt.core.dom.ASTNode#QUALIFIED_NAME .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name= token.getNode(); ASTNode node= name.getParent(); int nodeType= node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.ANNOTATION_TYPE_DECLARATION && nodeType != ASTNode.MARKER_ANNOTATION && nodeType != ASTNode.NORMAL_ANNOTATION && nodeType != ASTNode.SINGLE_MEMBER_ANNOTATION) return false; while (nodeType == ASTNode.QUALIFIED_NAME) { node= node.getParent(); nodeType= node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) return false; } // 2: match annotations IBinding binding= token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isAnnotation(); }
Example 2
Source File: SemanticHighlightings.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name = token.getNode(); ASTNode node = name.getParent(); int nodeType = node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.THIS_EXPRESSION && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION && nodeType != ASTNode.METHOD_INVOCATION) { return false; } while (nodeType == ASTNode.QUALIFIED_NAME) { node = node.getParent(); nodeType = node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) { return false; } } // 2: match classes IBinding binding = token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isClass(); }
Example 3
Source File: SemanticHighlightings.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name = token.getNode(); ASTNode node = name.getParent(); int nodeType = node.getNodeType(); if (nodeType != ASTNode.METHOD_INVOCATION && nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.ENUM_DECLARATION) { return false; } while (nodeType == ASTNode.QUALIFIED_NAME) { node = node.getParent(); nodeType = node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) { return false; } } // 2: match enums IBinding binding = token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isEnum(); }
Example 4
Source File: SemanticHighlightings.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name = token.getNode(); ASTNode node = name.getParent(); int nodeType = node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION) { return false; } while (nodeType == ASTNode.QUALIFIED_NAME) { node = node.getParent(); nodeType = node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) { return false; } } // 2: match interfaces IBinding binding = token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isInterface(); }
Example 5
Source File: SemanticHighlightings.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name = token.getNode(); ASTNode node = name.getParent(); int nodeType = node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.ANNOTATION_TYPE_DECLARATION && nodeType != ASTNode.MARKER_ANNOTATION && nodeType != ASTNode.NORMAL_ANNOTATION && nodeType != ASTNode.SINGLE_MEMBER_ANNOTATION) { return false; } while (nodeType == ASTNode.QUALIFIED_NAME) { node = node.getParent(); nodeType = node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) { return false; } } // 2: match annotations IBinding binding = token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isAnnotation(); }
Example 6
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name= token.getNode(); ASTNode node= name.getParent(); int nodeType= node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION) return false; while (nodeType == ASTNode.QUALIFIED_NAME) { node= node.getParent(); nodeType= node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) return false; } // 2: match interfaces IBinding binding= token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isInterface(); }
Example 7
Source File: SnippetFinder.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
static boolean isLeftHandSideOfAssignment(ASTNode node) { Assignment assignment = (Assignment) ASTNodes.getParent(node, ASTNode.ASSIGNMENT); if (assignment != null) { Expression leftHandSide = assignment.getLeftHandSide(); if (leftHandSide == node) { return true; } if (ASTNodes.isParent(node, leftHandSide)) { switch (leftHandSide.getNodeType()) { case ASTNode.SIMPLE_NAME: return true; case ASTNode.FIELD_ACCESS: return node == ((FieldAccess) leftHandSide).getName(); case ASTNode.QUALIFIED_NAME: return node == ((QualifiedName) leftHandSide).getName(); case ASTNode.SUPER_FIELD_ACCESS: return node == ((SuperFieldAccess) leftHandSide).getName(); default: return false; } } } return false; }
Example 8
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name= token.getNode(); ASTNode node= name.getParent(); int nodeType= node.getNodeType(); if (nodeType != ASTNode.METHOD_INVOCATION && nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.ENUM_DECLARATION) return false; while (nodeType == ASTNode.QUALIFIED_NAME) { node= node.getParent(); nodeType= node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) return false; } // 2: match enums IBinding binding= token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isEnum(); }
Example 9
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name= token.getNode(); ASTNode node= name.getParent(); int nodeType= node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.THIS_EXPRESSION && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION && nodeType != ASTNode.METHOD_INVOCATION) return false; while (nodeType == ASTNode.QUALIFIED_NAME) { node= node.getParent(); nodeType= node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) return false; } // 2: match classes IBinding binding= token.getBinding(); return binding instanceof ITypeBinding && ((ITypeBinding) binding).isClass(); }
Example 10
Source File: Bindings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Returns the binding of the variable written in an Assignment. * @param assignment The assignment * @return The binding or <code>null</code> if no bindings are available. */ public static IVariableBinding getAssignedVariable(Assignment assignment) { Expression leftHand = assignment.getLeftHandSide(); switch (leftHand.getNodeType()) { case ASTNode.SIMPLE_NAME: return (IVariableBinding) ((SimpleName) leftHand).resolveBinding(); case ASTNode.QUALIFIED_NAME: return (IVariableBinding) ((QualifiedName) leftHand).getName().resolveBinding(); case ASTNode.FIELD_ACCESS: return ((FieldAccess) leftHand).resolveFieldBinding(); case ASTNode.SUPER_FIELD_ACCESS: return ((SuperFieldAccess) leftHand).resolveFieldBinding(); default: return null; } }
Example 11
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name= token.getNode(); ASTNode node= name.getParent(); int nodeType= node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.THIS_EXPRESSION && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION && nodeType != ASTNode.METHOD_INVOCATION) return false; while (nodeType == ASTNode.QUALIFIED_NAME) { node= node.getParent(); nodeType= node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) return false; } // 2: match classes IBinding binding= token.getBinding(); if (binding instanceof ITypeBinding) { ITypeBinding typeBinding= (ITypeBinding) binding; // see also ClassHighlighting return typeBinding.isClass() && (typeBinding.getModifiers() & Modifier.ABSTRACT) != 0; } return false; }
Example 12
Source File: ExtractClassRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Expression getQualifier(ASTNode parent) { switch (parent.getNodeType()) { case ASTNode.FIELD_ACCESS: return ((FieldAccess) parent).getExpression(); case ASTNode.QUALIFIED_NAME: return ((QualifiedName)parent).getQualifier(); case ASTNode.SUPER_FIELD_ACCESS: return ((SuperFieldAccess)parent).getQualifier(); default: return null; } }
Example 13
Source File: ASTResolving.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static boolean isWriteAccess(Name selectedNode) { ASTNode curr= selectedNode; ASTNode parent= curr.getParent(); while (parent != null) { switch (parent.getNodeType()) { case ASTNode.QUALIFIED_NAME: if (((QualifiedName) parent).getQualifier() == curr) { return false; } break; case ASTNode.FIELD_ACCESS: if (((FieldAccess) parent).getExpression() == curr) { return false; } break; case ASTNode.SUPER_FIELD_ACCESS: break; case ASTNode.ASSIGNMENT: return ((Assignment) parent).getLeftHandSide() == curr; case ASTNode.VARIABLE_DECLARATION_FRAGMENT: case ASTNode.SINGLE_VARIABLE_DECLARATION: return ((VariableDeclaration) parent).getName() == curr; case ASTNode.POSTFIX_EXPRESSION: return true; case ASTNode.PREFIX_EXPRESSION: PrefixExpression.Operator op= ((PrefixExpression) parent).getOperator(); return op == PrefixExpression.Operator.DECREMENT || op == PrefixExpression.Operator.INCREMENT; default: return false; } curr= parent; parent= curr.getParent(); } return false; }
Example 14
Source File: AccessAnalyzer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private Expression getReceiver(Expression expression) { int type = expression.getNodeType(); switch (type) { case ASTNode.SIMPLE_NAME: return null; case ASTNode.QUALIFIED_NAME: return ((QualifiedName) expression).getQualifier(); case ASTNode.FIELD_ACCESS: return ((FieldAccess) expression).getExpression(); case ASTNode.PARENTHESIZED_EXPRESSION: return getReceiver(((ParenthesizedExpression) expression).getExpression()); } return null; }
Example 15
Source File: SemanticHighlightings.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public boolean consumes(SemanticToken token) { // 1: match types SimpleName name = token.getNode(); ASTNode node = name.getParent(); int nodeType = node.getNodeType(); if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.THIS_EXPRESSION && nodeType != ASTNode.QUALIFIED_TYPE && nodeType != ASTNode.QUALIFIED_NAME && nodeType != ASTNode.TYPE_DECLARATION && nodeType != ASTNode.METHOD_INVOCATION) { return false; } while (nodeType == ASTNode.QUALIFIED_NAME) { node = node.getParent(); nodeType = node.getNodeType(); if (nodeType == ASTNode.IMPORT_DECLARATION) { return false; } } // 2: match classes IBinding binding = token.getBinding(); if (binding instanceof ITypeBinding) { ITypeBinding typeBinding = (ITypeBinding) binding; // see also ClassHighlighting return typeBinding.isClass() && (typeBinding.getModifiers() & Modifier.ABSTRACT) != 0; } return false; }
Example 16
Source File: ASTResolving.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static Type guessTypeForReference(AST ast, ASTNode node) { ASTNode parent= node.getParent(); while (parent != null) { switch (parent.getNodeType()) { case ASTNode.VARIABLE_DECLARATION_FRAGMENT: if (((VariableDeclarationFragment) parent).getInitializer() == node) { return ASTNodeFactory.newType(ast, (VariableDeclaration) parent); } return null; case ASTNode.SINGLE_VARIABLE_DECLARATION: if (((VariableDeclarationFragment) parent).getInitializer() == node) { return ASTNodeFactory.newType(ast, (VariableDeclaration) parent); } return null; case ASTNode.ARRAY_ACCESS: if (!((ArrayAccess) parent).getIndex().equals(node)) { Type type= guessTypeForReference(ast, parent); if (type != null) { return ASTNodeFactory.newArrayType(type); } } return null; case ASTNode.FIELD_ACCESS: if (node.equals(((FieldAccess) parent).getName())) { node= parent; parent= parent.getParent(); } else { return null; } break; case ASTNode.SUPER_FIELD_ACCESS: case ASTNode.PARENTHESIZED_EXPRESSION: node= parent; parent= parent.getParent(); break; case ASTNode.QUALIFIED_NAME: if (node.equals(((QualifiedName) parent).getName())) { node= parent; parent= parent.getParent(); } else { return null; } break; default: return null; } } return null; }
Example 17
Source File: CompilationUnitBuilder.java From j2cl with Apache License 2.0 | 4 votes |
private Expression convert(org.eclipse.jdt.core.dom.Expression expression) { switch (expression.getNodeType()) { case ASTNode.ARRAY_ACCESS: return convert((org.eclipse.jdt.core.dom.ArrayAccess) expression); case ASTNode.ARRAY_CREATION: return convert((org.eclipse.jdt.core.dom.ArrayCreation) expression); case ASTNode.ARRAY_INITIALIZER: return convert((org.eclipse.jdt.core.dom.ArrayInitializer) expression); case ASTNode.ASSIGNMENT: return convert((org.eclipse.jdt.core.dom.Assignment) expression); case ASTNode.BOOLEAN_LITERAL: return convert((org.eclipse.jdt.core.dom.BooleanLiteral) expression); case ASTNode.CAST_EXPRESSION: return convert((org.eclipse.jdt.core.dom.CastExpression) expression); case ASTNode.CHARACTER_LITERAL: return convert((org.eclipse.jdt.core.dom.CharacterLiteral) expression); case ASTNode.CLASS_INSTANCE_CREATION: return convert((org.eclipse.jdt.core.dom.ClassInstanceCreation) expression); case ASTNode.CONDITIONAL_EXPRESSION: return convert((org.eclipse.jdt.core.dom.ConditionalExpression) expression); case ASTNode.EXPRESSION_METHOD_REFERENCE: return convert((org.eclipse.jdt.core.dom.ExpressionMethodReference) expression); case ASTNode.CREATION_REFERENCE: return convert((org.eclipse.jdt.core.dom.CreationReference) expression); case ASTNode.TYPE_METHOD_REFERENCE: return convert((org.eclipse.jdt.core.dom.TypeMethodReference) expression); case ASTNode.SUPER_METHOD_REFERENCE: return convert((org.eclipse.jdt.core.dom.SuperMethodReference) expression); case ASTNode.FIELD_ACCESS: return convert((org.eclipse.jdt.core.dom.FieldAccess) expression); case ASTNode.INFIX_EXPRESSION: return convert((org.eclipse.jdt.core.dom.InfixExpression) expression); case ASTNode.INSTANCEOF_EXPRESSION: return convert((org.eclipse.jdt.core.dom.InstanceofExpression) expression); case ASTNode.LAMBDA_EXPRESSION: return convert((org.eclipse.jdt.core.dom.LambdaExpression) expression); case ASTNode.METHOD_INVOCATION: return convert((org.eclipse.jdt.core.dom.MethodInvocation) expression); case ASTNode.NULL_LITERAL: return NullLiteral.get(); case ASTNode.NUMBER_LITERAL: return convert((org.eclipse.jdt.core.dom.NumberLiteral) expression); case ASTNode.PARENTHESIZED_EXPRESSION: return convert((org.eclipse.jdt.core.dom.ParenthesizedExpression) expression); case ASTNode.POSTFIX_EXPRESSION: return convert((org.eclipse.jdt.core.dom.PostfixExpression) expression); case ASTNode.PREFIX_EXPRESSION: return convert((org.eclipse.jdt.core.dom.PrefixExpression) expression); case ASTNode.QUALIFIED_NAME: return convert((org.eclipse.jdt.core.dom.QualifiedName) expression); case ASTNode.SIMPLE_NAME: return convert((org.eclipse.jdt.core.dom.SimpleName) expression); case ASTNode.STRING_LITERAL: return convert((org.eclipse.jdt.core.dom.StringLiteral) expression); case ASTNode.SUPER_FIELD_ACCESS: return convert((org.eclipse.jdt.core.dom.SuperFieldAccess) expression); case ASTNode.SUPER_METHOD_INVOCATION: return convert((org.eclipse.jdt.core.dom.SuperMethodInvocation) expression); case ASTNode.THIS_EXPRESSION: return convert((org.eclipse.jdt.core.dom.ThisExpression) expression); case ASTNode.TYPE_LITERAL: return convert((org.eclipse.jdt.core.dom.TypeLiteral) expression); case ASTNode.VARIABLE_DECLARATION_EXPRESSION: return convert((org.eclipse.jdt.core.dom.VariableDeclarationExpression) expression); default: throw internalCompilerError( "Unexpected type for Expression: %s", expression.getClass().getName()); } }
Example 18
Source File: Bindings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Resolve the binding (<em>not</em> the type binding) for the expression or a nested expression * (e.g. nested in parentheses, cast, ...). * * @param expression an expression node * @param goIntoCast iff <code>true</code>, go into a CastExpression's expression to resolve * @return the expression binding, or <code>null</code> if the expression has no binding or the * binding could not be resolved * * @see StubUtility#getVariableNameSuggestions(int, IJavaProject, ITypeBinding, Expression, java.util.Collection) * @since 3.5 */ public static IBinding resolveExpressionBinding(Expression expression, boolean goIntoCast) { //TODO: search for callers of resolve*Binding() methods and replace with call to this method // similar to StubUtility#getVariableNameSuggestions(int, IJavaProject, ITypeBinding, Expression, Collection) switch (expression.getNodeType()) { case ASTNode.SIMPLE_NAME: case ASTNode.QUALIFIED_NAME: return ((Name) expression).resolveBinding(); case ASTNode.FIELD_ACCESS: return ((FieldAccess) expression).resolveFieldBinding(); case ASTNode.SUPER_FIELD_ACCESS: return ((SuperFieldAccess) expression).resolveFieldBinding(); case ASTNode.METHOD_INVOCATION: return ((MethodInvocation) expression).resolveMethodBinding(); case ASTNode.SUPER_METHOD_INVOCATION: return ((SuperMethodInvocation) expression).resolveMethodBinding(); case ASTNode.CLASS_INSTANCE_CREATION: return ((ClassInstanceCreation) expression).resolveConstructorBinding(); case ASTNode.MARKER_ANNOTATION: case ASTNode.SINGLE_MEMBER_ANNOTATION: case ASTNode.NORMAL_ANNOTATION: return ((Annotation) expression).resolveAnnotationBinding(); case ASTNode.ARRAY_ACCESS: return resolveExpressionBinding(((ArrayAccess) expression).getArray(), goIntoCast); case ASTNode.CAST_EXPRESSION: if (goIntoCast) { return resolveExpressionBinding(((CastExpression) expression).getExpression(), true); } else { return null; } case ASTNode.PARENTHESIZED_EXPRESSION: return resolveExpressionBinding(((ParenthesizedExpression) expression).getExpression(), goIntoCast); case ASTNode.PREFIX_EXPRESSION: return resolveExpressionBinding(((PrefixExpression) expression).getOperand(), goIntoCast); case ASTNode.POSTFIX_EXPRESSION: return resolveExpressionBinding(((PostfixExpression) expression).getOperand(), goIntoCast); default: return null; } }
Example 19
Source File: ASTResolving.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public static Type guessTypeForReference(AST ast, ASTNode node) { ASTNode parent= node.getParent(); while (parent != null) { switch (parent.getNodeType()) { case ASTNode.VARIABLE_DECLARATION_FRAGMENT: if (((VariableDeclarationFragment) parent).getInitializer() == node) { return ASTNodeFactory.newType(ast, (VariableDeclaration) parent); } return null; case ASTNode.SINGLE_VARIABLE_DECLARATION: if (((VariableDeclarationFragment) parent).getInitializer() == node) { return ASTNodeFactory.newType(ast, (VariableDeclaration) parent); } return null; case ASTNode.ARRAY_ACCESS: if (!((ArrayAccess) parent).getIndex().equals(node)) { Type type = guessTypeForReference(ast, parent); if (type != null) { return ASTNodeFactory.newArrayType(type); } } return null; case ASTNode.FIELD_ACCESS: if (node.equals(((FieldAccess) parent).getName())) { node = parent; parent = parent.getParent(); } else { return null; } break; case ASTNode.SUPER_FIELD_ACCESS: case ASTNode.PARENTHESIZED_EXPRESSION: node= parent; parent= parent.getParent(); break; case ASTNode.QUALIFIED_NAME: if (node.equals(((QualifiedName) parent).getName())) { node = parent; parent = parent.getParent(); } else { return null; } break; default: return null; } } return null; }
Example 20
Source File: JavaASTVisitor.java From SnowGraph with Apache License 2.0 | 4 votes |
private void parseExpression(MethodInfo methodInfo, Expression expression) { if (expression == null) { return; }//System.out.println(expression.toString()+" "+Annotation.nodeClassForType(expression.getNodeType())); if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) { List<Expression> expressions = ((ArrayInitializer) expression).expressions(); for (Expression expression2 : expressions) { parseExpression(methodInfo, expression2); } } if (expression.getNodeType() == ASTNode.CAST_EXPRESSION) { parseExpression(methodInfo, ((CastExpression) expression).getExpression()); } if (expression.getNodeType() == ASTNode.CONDITIONAL_EXPRESSION) { parseExpression(methodInfo, ((ConditionalExpression) expression).getExpression()); parseExpression(methodInfo, ((ConditionalExpression) expression).getElseExpression()); parseExpression(methodInfo, ((ConditionalExpression) expression).getThenExpression()); } if (expression.getNodeType() == ASTNode.INFIX_EXPRESSION) { parseExpression(methodInfo, ((InfixExpression) expression).getLeftOperand()); parseExpression(methodInfo, ((InfixExpression) expression).getRightOperand()); } if (expression.getNodeType() == ASTNode.INSTANCEOF_EXPRESSION) { parseExpression(methodInfo, ((InstanceofExpression) expression).getLeftOperand()); } if (expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION) { parseExpression(methodInfo, ((ParenthesizedExpression) expression).getExpression()); } if (expression.getNodeType() == ASTNode.POSTFIX_EXPRESSION) { parseExpression(methodInfo, ((PostfixExpression) expression).getOperand()); } if (expression.getNodeType() == ASTNode.PREFIX_EXPRESSION) { parseExpression(methodInfo, ((PrefixExpression) expression).getOperand()); } if (expression.getNodeType() == ASTNode.THIS_EXPRESSION) { parseExpression(methodInfo, ((ThisExpression) expression).getQualifier()); } if (expression.getNodeType() == ASTNode.METHOD_INVOCATION) { List<Expression> arguments = ((MethodInvocation) expression).arguments(); IMethodBinding methodBinding = ((MethodInvocation) expression).resolveMethodBinding(); if (methodBinding != null) methodInfo.methodCalls.add(methodBinding); for (Expression exp : arguments) parseExpression(methodInfo, exp); parseExpression(methodInfo, ((MethodInvocation) expression).getExpression()); } if (expression.getNodeType() == ASTNode.ASSIGNMENT) { parseExpression(methodInfo, ((Assignment) expression).getLeftHandSide()); parseExpression(methodInfo, ((Assignment) expression).getRightHandSide()); } if (expression.getNodeType() == ASTNode.QUALIFIED_NAME) { if (((QualifiedName) expression).getQualifier().resolveTypeBinding() != null) { String name = ((QualifiedName) expression).getQualifier().resolveTypeBinding().getQualifiedName() + "." + ((QualifiedName) expression).getName().getIdentifier(); methodInfo.fieldUsesSet.add(name); } parseExpression(methodInfo, ((QualifiedName) expression).getQualifier()); } }