Java Code Examples for org.eclipse.jdt.core.dom.Assignment#getLeftHandSide()

The following examples show how to use org.eclipse.jdt.core.dom.Assignment#getLeftHandSide() . 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: ExtractTempRefactoring.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
private static boolean isLeftValue(ASTNode node) {
	ASTNode parent = node.getParent();
	if (parent instanceof Assignment) {
		Assignment assignment = (Assignment) parent;
		if (assignment.getLeftHandSide() == node) {
			return true;
		}
	}
	if (parent instanceof PostfixExpression) {
		return true;
	}
	if (parent instanceof PrefixExpression) {
		PrefixExpression.Operator op = ((PrefixExpression) parent).getOperator();
		if (op.equals(PrefixExpression.Operator.DECREMENT)) {
			return true;
		}
		if (op.equals(PrefixExpression.Operator.INCREMENT)) {
			return true;
		}
		return false;
	}
	return false;
}
 
Example 2
Source File: MethodObject.java    From JDeodorant with MIT License 6 votes vote down vote up
public FieldInstructionObject isSetter() {
	if(getMethodBody() != null) {
 	List<AbstractStatement> abstractStatements = getMethodBody().getCompositeStatement().getStatements();
 	if(abstractStatements.size() == 1 && abstractStatements.get(0) instanceof StatementObject) {
 		StatementObject statementObject = (StatementObject)abstractStatements.get(0);
 		Statement statement = statementObject.getStatement();
 		if(statement instanceof ExpressionStatement) {
 			ExpressionStatement expressionStatement = (ExpressionStatement)statement;
 			if(expressionStatement.getExpression() instanceof Assignment && statementObject.getFieldInstructions().size() == 1 && statementObject.getMethodInvocations().size() == 0 &&
     				statementObject.getLocalVariableDeclarations().size() == 0 && statementObject.getLocalVariableInstructions().size() == 1 && this.constructorObject.parameterList.size() == 1) {
 				Assignment assignment = (Assignment)expressionStatement.getExpression();
 				if((assignment.getLeftHandSide() instanceof SimpleName || assignment.getLeftHandSide() instanceof FieldAccess) && assignment.getRightHandSide() instanceof SimpleName)
 					return statementObject.getFieldInstructions().get(0);
 			}
 		}
 	}
	}
	return null;
}
 
Example 3
Source File: AbstractControlStructureUtilities.java    From JDeodorant with MIT License 6 votes vote down vote up
private static boolean isSameAssignee(Assignment assignment1, Assignment assignment2)
{
	Expression assignee1 = assignment1.getLeftHandSide();
	Expression assignee2 = assignment2.getLeftHandSide();
	IBinding binding1 = null;
	IBinding binding2 = null;
	if (assignee1 instanceof Name && assignee2 instanceof Name)
	{
		binding1 = ((Name)assignee1).resolveBinding();
		binding2 = ((Name)assignee2).resolveBinding();
	}
	else if (assignee1 instanceof FieldAccess && assignee2 instanceof FieldAccess)
	{
		binding1 = ((FieldAccess)assignee1).resolveFieldBinding();
		binding2 = ((FieldAccess)assignee2).resolveFieldBinding();
	}
	return (binding1 != null && binding2 != null &&
			binding1.getKind() == IBinding.VARIABLE && binding2.getKind() == IBinding.VARIABLE &&
			binding1.isEqualTo(binding2));
}
 
Example 4
Source File: Bindings.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 5
Source File: ExtractTempRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean isLeftValue(ASTNode node) {
	ASTNode parent= node.getParent();
	if (parent instanceof Assignment) {
		Assignment assignment= (Assignment) parent;
		if (assignment.getLeftHandSide() == node)
			return true;
	}
	if (parent instanceof PostfixExpression)
		return true;
	if (parent instanceof PrefixExpression) {
		PrefixExpression.Operator op= ((PrefixExpression) parent).getOperator();
		if (op.equals(PrefixExpression.Operator.DECREMENT))
			return true;
		if (op.equals(PrefixExpression.Operator.INCREMENT))
			return true;
		return false;
	}
	return false;
}
 
Example 6
Source File: SnippetFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private 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 7
Source File: InferTypeArgumentsConstraintCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void endVisit(Assignment node) {
	Expression lhs= node.getLeftHandSide();
	Expression rhs= node.getRightHandSide();

	ConstraintVariable2 left= getConstraintVariable(lhs);
	ConstraintVariable2 right= getConstraintVariable(rhs);
	if (node.resolveBoxing()) {
		ImmutableTypeVariable2 boxed= fTCModel.makeImmutableTypeVariable(node.resolveTypeBinding(), node);
		setConstraintVariable(node, boxed);
	} else {
		setConstraintVariable(node, left); // type of assignement is type of 'left'
	}
	if (left == null || right == null)
		return;

	Assignment.Operator op= node.getOperator();
	if (op == Assignment.Operator.PLUS_ASSIGN && (lhs.resolveTypeBinding() == node.getAST().resolveWellKnownType("java.lang.String"))) { //$NON-NLS-1$
		//Special handling for automatic String conversion: do nothing; the RHS can be anything.
	} else {
		fTCModel.createElementEqualsConstraints(left, right);
		fTCModel.createSubtypeConstraint(right, left); // left= right;  -->  [right] <= [left]
	}
	//TODO: other implicit conversions: numeric promotion, autoboxing?
}
 
Example 8
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean visit(final Assignment node) {
  final Expression leftSide = node.getLeftHandSide();
  Type type = null;
  if ((leftSide instanceof ArrayAccess)) {
    Expression _array = ((ArrayAccess)leftSide).getArray();
    if ((_array instanceof SimpleName)) {
      Expression _array_1 = ((ArrayAccess)leftSide).getArray();
      type = this._aSTFlattenerUtils.findDeclaredType(((SimpleName) _array_1));
    }
    this.handleAssignment(node, ((ArrayAccess)leftSide), type);
  } else {
    if ((leftSide instanceof SimpleName)) {
      type = this._aSTFlattenerUtils.findDeclaredType(((SimpleName)leftSide));
    }
    this.handleAssignment(node, leftSide, type);
  }
  return false;
}
 
Example 9
Source File: ExtractFieldRefactoring.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
private static boolean isLeftValue(ASTNode node) {
	ASTNode parent = node.getParent();
	if (parent instanceof Assignment) {
		Assignment assignment = (Assignment) parent;
		if (assignment.getLeftHandSide() == node) {
			return true;
		}
	}
	if (parent instanceof PostfixExpression) {
		return true;
	}
	if (parent instanceof PrefixExpression) {
		PrefixExpression.Operator op = ((PrefixExpression) parent).getOperator();
		if (op.equals(PrefixExpression.Operator.DECREMENT)) {
			return true;
		}
		if (op.equals(PrefixExpression.Operator.INCREMENT)) {
			return true;
		}
		return false;
	}
	return false;
}
 
Example 10
Source File: SnippetFinder.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
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 11
Source File: TempAssignmentFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isAssignmentToTemp(Assignment assignment){
	if (fTempBinding == null)
		return false;

	if (! (assignment.getLeftHandSide() instanceof Name))
		return false;
	Name ref= (Name)assignment.getLeftHandSide();
	return isNameReferenceToTemp(ref);
}
 
Example 12
Source File: NewVariableCorrectionProposal.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isForStatementInit(Statement statement, SimpleName name) {
	if (statement instanceof ForStatement) {
		ForStatement forStatement= (ForStatement) statement;
		List<Expression> list = forStatement.initializers();
		if (list.size() == 1 && list.get(0) instanceof Assignment) {
			Assignment assignment= (Assignment) list.get(0);
			return assignment.getLeftHandSide() == name;
		}
	}
	return false;
}
 
Example 13
Source File: NewVariableCorrectionProposal.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isAssigned(Statement statement, SimpleName name) {
	if (statement instanceof ExpressionStatement) {
		ExpressionStatement exstat= (ExpressionStatement) statement;
		if (exstat.getExpression() instanceof Assignment) {
			Assignment assignment= (Assignment) exstat.getExpression();
			return assignment.getLeftHandSide() == name;
		}
	}
	return false;
}
 
Example 14
Source File: NewVariableCorrectionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isAssigned(Statement statement, SimpleName name) {
	if (statement instanceof ExpressionStatement) {
		ExpressionStatement exstat= (ExpressionStatement) statement;
		if (exstat.getExpression() instanceof Assignment) {
			Assignment assignment= (Assignment) exstat.getExpression();
			return assignment.getLeftHandSide() == name;
		}
	}
	return false;
}
 
Example 15
Source File: MethodDeclarationUtility.java    From JDeodorant with MIT License 5 votes vote down vote up
public static SimpleName isSetter(MethodDeclaration methodDeclaration) {
	Block methodBody = methodDeclaration.getBody();
	List<SingleVariableDeclaration> parameters = methodDeclaration.parameters();
	if(methodBody != null) {
		List<Statement> statements = methodBody.statements();
		if(statements.size() == 1 && parameters.size() == 1) {
			Statement statement = statements.get(0);
    		if(statement instanceof ExpressionStatement) {
    			ExpressionStatement expressionStatement = (ExpressionStatement)statement;
    			Expression expressionStatementExpression = expressionStatement.getExpression();
    			if(expressionStatementExpression instanceof Assignment) {
    				Assignment assignment = (Assignment)expressionStatementExpression;
    				Expression rightHandSide = assignment.getRightHandSide();
    				if(rightHandSide instanceof SimpleName) {
    					SimpleName rightHandSideSimpleName = (SimpleName)rightHandSide;
    					if(rightHandSideSimpleName.resolveBinding().isEqualTo(parameters.get(0).resolveBinding())) {
    						Expression leftHandSide = assignment.getLeftHandSide();
    						if(leftHandSide instanceof SimpleName) {
    		    				return (SimpleName)leftHandSide;
    		    			}
    		    			else if(leftHandSide instanceof FieldAccess) {
    		    				FieldAccess fieldAccess = (FieldAccess)leftHandSide;
    		    				return fieldAccess.getName();
    		    			}
    					}
    				}
    			}
    		}
		}
	}
	return null;
}
 
Example 16
Source File: AbstractMethodFragment.java    From JDeodorant with MIT License 5 votes vote down vote up
private Set<Assignment> getMatchingAssignments(SimpleName simpleName, List<Expression> assignments) {
	Set<Assignment> matchingAssignments = new LinkedHashSet<Assignment>();
	for(Expression expression : assignments) {
		Assignment assignment = (Assignment)expression;
		Expression leftHandSide = assignment.getLeftHandSide();
		SimpleName leftHandSideName = MethodDeclarationUtility.getRightMostSimpleName(leftHandSide);
		if(leftHandSideName != null && leftHandSideName.equals(simpleName)) {
			matchingAssignments.add(assignment);
		}
	}
	return matchingAssignments;
}
 
Example 17
Source File: AccessAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(Assignment node) {
	Expression leftHandSide= node.getLeftHandSide();
	if (!considerBinding(resolveBinding(leftHandSide), leftHandSide))
		return true;

	checkParent(node);
	Expression rightHandSide= node.getRightHandSide();
	if (!fIsFieldFinal) {
		// Write access.
		AST ast= node.getAST();
		MethodInvocation invocation= ast.newMethodInvocation();
		invocation.setName(ast.newSimpleName(fSetter));
		fReferencingSetter= true;
		Expression receiver= getReceiver(leftHandSide);
		if (receiver != null)
			invocation.setExpression((Expression)fRewriter.createCopyTarget(receiver));
		List<Expression> arguments= invocation.arguments();
		if (node.getOperator() == Assignment.Operator.ASSIGN) {
			arguments.add((Expression)fRewriter.createCopyTarget(rightHandSide));
		} else {
			// This is the compound assignment case: field+= 10;
			InfixExpression exp= ast.newInfixExpression();
			exp.setOperator(ASTNodes.convertToInfixOperator(node.getOperator()));
			MethodInvocation getter= ast.newMethodInvocation();
			getter.setName(ast.newSimpleName(fGetter));
			fReferencingGetter= true;
			if (receiver != null)
				getter.setExpression((Expression)fRewriter.createCopyTarget(receiver));
			exp.setLeftOperand(getter);
			Expression rhs= (Expression)fRewriter.createCopyTarget(rightHandSide);
			if (NecessaryParenthesesChecker.needsParenthesesForRightOperand(rightHandSide, exp, leftHandSide.resolveTypeBinding())) {
				ParenthesizedExpression p= ast.newParenthesizedExpression();
				p.setExpression(rhs);
				rhs= p;
			}
			exp.setRightOperand(rhs);
			arguments.add(exp);
		}
		fRewriter.replace(node, invocation, createGroupDescription(WRITE_ACCESS));
	}
	rightHandSide.accept(this);
	return false;
}
 
Example 18
Source File: AbstractLoopUtilities.java    From JDeodorant with MIT License 4 votes vote down vote up
private static Integer assignmentUpdateValue(Assignment assignment)
{
	Integer updateValue          = null;
	Expression leftHandSide      = assignment.getLeftHandSide();
	Assignment.Operator operator = assignment.getOperator();
	Expression rightHandSide     = assignment.getRightHandSide();
	if (operator == Assignment.Operator.PLUS_ASSIGN)
	{			
		updateValue = AbstractLoopUtilities.getIntegerValue(rightHandSide);
	}
	else if (operator == Assignment.Operator.MINUS_ASSIGN)
	{
		Integer rightHandSideIntegerValue = AbstractLoopUtilities.getIntegerValue(rightHandSide);
		if (rightHandSideIntegerValue != null)
		{
			updateValue = (-1) * rightHandSideIntegerValue;
		}
	}
	else if (leftHandSide instanceof SimpleName && operator == Assignment.Operator.ASSIGN && rightHandSide instanceof InfixExpression)
	{
		SimpleName leftHandSideSimpleName      = (SimpleName) leftHandSide;
		IBinding leftHandSideBinding           = leftHandSideSimpleName.resolveBinding();
		InfixExpression infixExpression        = (InfixExpression) rightHandSide;
		InfixExpression.Operator infixOperator = infixExpression.getOperator();
		Expression rightOperand                = infixExpression.getRightOperand();
		Expression leftOperand                 = infixExpression.getLeftOperand();
		if (infixOperator.toString().equals("+") || infixOperator.toString().equals("-"))
		{
			if (leftOperand instanceof SimpleName)
			{
				SimpleName leftOperandSimpleName = (SimpleName) leftOperand;
				IBinding leftOperandBinding      = leftOperandSimpleName.resolveBinding();
				if (leftOperandBinding.isEqualTo(leftHandSideBinding))
				{
					Integer rightOperandIntegerValue = AbstractLoopUtilities.getIntegerValue(rightOperand);
					if (infixOperator.toString().equals("+") && rightOperandIntegerValue != null)
					{
						updateValue = rightOperandIntegerValue;
					}
					else if (infixOperator.toString().equals("-") && rightOperandIntegerValue != null)
					{
						updateValue = (-1) * rightOperandIntegerValue;
					}
				}
			}
			else if (rightOperand instanceof SimpleName)
			{
				SimpleName rightOperandSimpleName = (SimpleName) rightOperand;
				IBinding rightOperandBinding      = rightOperandSimpleName.resolveBinding();
				if (rightOperandBinding.isEqualTo(leftHandSideBinding))
				{
					Integer leftOperandIntegerValue = AbstractLoopUtilities.getIntegerValue(leftOperand);
					if (infixOperator.toString().equals("+") && leftOperandIntegerValue != null)
					{
						updateValue = leftOperandIntegerValue;
					}
				}
			}
		}
	}
	return updateValue;
}
 
Example 19
Source File: ASTNodeMatcher.java    From JDeodorant with MIT License 4 votes vote down vote up
public boolean match(ExpressionStatement node, Object other) {
	if (AbstractControlStructureUtilities.hasOneConditionalExpression(node) != null && other instanceof IfStatement)
	{
		TernaryControlStructure nodeTernaryControlStructure = new TernaryControlStructure(node);
		return ifMatch(nodeTernaryControlStructure, other);
	}
	else if(node.getExpression() instanceof Assignment && other instanceof VariableDeclarationStatement) {
		VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)other;
		List fragments = variableDeclarationStatement.fragments();
		if(fragments.size() == 1) {
			VariableDeclarationFragment fragment = (VariableDeclarationFragment)fragments.get(0);
			Assignment assignment = (Assignment)node.getExpression();
			Expression leftHandSide = assignment.getLeftHandSide();
			if(leftHandSide instanceof SimpleName) {
				SimpleName simpleName = (SimpleName)leftHandSide;
				boolean variableMatch = safeSubtreeMatch(simpleName, fragment.getName());
				boolean variableTypeMatch = false;
				IBinding simpleNameBinding = simpleName.resolveBinding();
				IBinding fragmentNameBinding = fragment.getName().resolveBinding();
				if(simpleNameBinding.getKind() == IBinding.VARIABLE && fragmentNameBinding.getKind() == IBinding.VARIABLE) {
					IVariableBinding simpleNameVariableBinding = (IVariableBinding)simpleNameBinding;
					IVariableBinding fragmentNameVariableBinding = (IVariableBinding)fragmentNameBinding;
					variableTypeMatch = simpleNameVariableBinding.getType().isEqualTo(fragmentNameVariableBinding.getType()) &&
							simpleNameVariableBinding.getType().getQualifiedName().equals(fragmentNameVariableBinding.getType().getQualifiedName());
				}
				boolean initializerMatch = false;
				boolean initializerTypeMatch = false;
				Expression initializer = fragment.getInitializer();
				Expression rightHandSide = assignment.getRightHandSide();
				if(initializer != null && initializer.getNodeType() == rightHandSide.getNodeType()) {
					initializerMatch = safeSubtreeMatch(rightHandSide, initializer);
					initializerTypeMatch = initializer.resolveTypeBinding().isEqualTo(rightHandSide.resolveTypeBinding()) &&
							initializer.resolveTypeBinding().getQualifiedName().equals(rightHandSide.resolveTypeBinding().getQualifiedName());
				}
				if(variableMatch && variableTypeMatch && initializerMatch && initializerTypeMatch) {
					VariableDeclaration variableDeclaration = AbstractLoopUtilities.getVariableDeclaration(simpleName);
					if(variableDeclaration != null && hasEmptyInitializer(variableDeclaration)) {
						safeSubtreeMatch(variableDeclaration.getName(), fragment.getName());
						List<ASTNode> astNodes = new ArrayList<ASTNode>();
						astNodes.add(variableDeclaration);
						ASTInformationGenerator.setCurrentITypeRoot(typeRoot1);
						reportAdditionalFragments(astNodes, this.additionallyMatchedFragments1);
						return true;
					}
				}
			}
		}
	}
	return super.match(node, other);
}
 
Example 20
Source File: ASTNodeMatcher.java    From JDeodorant with MIT License 4 votes vote down vote up
public boolean match(VariableDeclarationStatement node, Object other) {
	List fragments = node.fragments();
	if(fragments.size() == 1 && other instanceof ExpressionStatement) {
		VariableDeclarationFragment fragment = (VariableDeclarationFragment)fragments.get(0);
		ExpressionStatement expressionStatement = (ExpressionStatement)other;
		Expression expression = expressionStatement.getExpression();
		if(expression instanceof Assignment) {
			Assignment assignment = (Assignment)expression;
			Expression leftHandSide = assignment.getLeftHandSide();
			if(leftHandSide instanceof SimpleName) {
				SimpleName simpleName = (SimpleName)leftHandSide;
				boolean variableMatch = safeSubtreeMatch(fragment.getName(), simpleName);
				boolean variableTypeMatch = false;
				IBinding simpleNameBinding = simpleName.resolveBinding();
				IBinding fragmentNameBinding = fragment.getName().resolveBinding();
				if(simpleNameBinding.getKind() == IBinding.VARIABLE && fragmentNameBinding.getKind() == IBinding.VARIABLE) {
					IVariableBinding simpleNameVariableBinding = (IVariableBinding)simpleNameBinding;
					IVariableBinding fragmentNameVariableBinding = (IVariableBinding)fragmentNameBinding;
					variableTypeMatch = simpleNameVariableBinding.getType().isEqualTo(fragmentNameVariableBinding.getType()) &&
							simpleNameVariableBinding.getType().getQualifiedName().equals(fragmentNameVariableBinding.getType().getQualifiedName());;
				}
				boolean initializerMatch = false;
				boolean initializerTypeMatch = false;
				Expression initializer = fragment.getInitializer();
				Expression rightHandSide = assignment.getRightHandSide();
				if(initializer != null && initializer.getNodeType() == rightHandSide.getNodeType()) {
					initializerMatch = safeSubtreeMatch(initializer, rightHandSide);
					initializerTypeMatch = initializer.resolveTypeBinding().isEqualTo(rightHandSide.resolveTypeBinding()) &&
							initializer.resolveTypeBinding().getQualifiedName().equals(rightHandSide.resolveTypeBinding().getQualifiedName());
				}
				if(variableMatch && variableTypeMatch && initializerMatch && initializerTypeMatch) {
					VariableDeclaration variableDeclaration = AbstractLoopUtilities.getVariableDeclaration(simpleName);
					if(variableDeclaration != null && hasEmptyInitializer(variableDeclaration)) {
						safeSubtreeMatch(fragment.getName(), variableDeclaration.getName());
						List<ASTNode> astNodes = new ArrayList<ASTNode>();
						astNodes.add(variableDeclaration);
						ASTInformationGenerator.setCurrentITypeRoot(typeRoot2);
						reportAdditionalFragments(astNodes, this.additionallyMatchedFragments2);
						return true;
					}
				}
			}
		}
	}
	return super.match(node, other);
}