this.processExpression(assignment.getRightHandSide());
}
else if (!Util.isSuspiciousAssignmentOperator(assignment
.getOperator()))
throw new DefinitelyNotEnumerizableOperationException(
Messages.ASTNodeProcessor_IllegalAssignmentExpression, assignment
.getOperator(), node);
else
throw new NonEnumerizableASTException(
Messages.ASTNodeProcessor_IllegalAssignmentExpression, node);
break;
}
case ASTNode.VARIABLE_DECLARATION_STATEMENT: {
final VariableDeclarationStatement vds = (VariableDeclarationStatement) node;
for (final Iterator it = vds.fragments().iterator(); it.hasNext();) {
final VariableDeclarationFragment vdf = (VariableDeclarationFragment) it
.next();
final IJavaElement elem = vdf.resolveBinding().getJavaElement();
if (elem.isReadOnly() || vdf.getName().resolveBoxing())
throw new DefinitelyNotEnumerizableException(
Messages.ASTNodeProcessor_SourceNotPresent, vdf);
if (vdf.resolveBinding().getType().isEqualTo(
node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
throw new NonEnumerizableASTException(
Messages.ASTNodeProcessor_IllegalArrayUpcast, vdf);
this.found.add(elem);
this.processExpression(vdf.getInitializer());
}
break;
}
case ASTNode.VARIABLE_DECLARATION_FRAGMENT: {
final VariableDeclarationFragment vdf = (VariableDeclarationFragment) node;
final IJavaElement elem = vdf.resolveBinding().getJavaElement();
if (!this.constFields.contains(elem)) {
if (elem == null || vdf == null || vdf.getName() == null)
throw new DefinitelyNotEnumerizableException(
Messages.ASTNodeProcessor_SourceNotPresent, node);
if (elem.isReadOnly() || vdf.getName().resolveBoxing())
throw new DefinitelyNotEnumerizableException(
Messages.ASTNodeProcessor_SourceNotPresent, node);
if (vdf.resolveBinding().getType().isEqualTo(
node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
throw new NonEnumerizableASTException(
Messages.ASTNodeProcessor_IllegalArrayUpcast, vdf);
this.found.add(elem);
this.processExpression(vdf.getInitializer());
}
break;
}
case ASTNode.FIELD_DECLARATION: {
final FieldDeclaration fd = (FieldDeclaration) node;
for (final Iterator it = fd.fragments().iterator(); it.hasNext();) {
final VariableDeclarationFragment vdf = (VariableDeclarationFragment) it
.next();
final IJavaElement elem = vdf.resolveBinding().getJavaElement();
if (!this.constFields.contains(elem)) {
if (elem.isReadOnly() || vdf.getName().resolveBoxing())
throw new DefinitelyNotEnumerizableException(
Messages.ASTNodeProcessor_SourceNotPresent, vdf);
if (vdf.resolveBinding().getType().isEqualTo(
node.getAST().resolveWellKnownType(
"java.lang.Object"))) //$NON-NLS-1$
throw new NonEnumerizableASTException(
Messages.ASTNodeProcessor_IllegalArrayUpcast, vdf);
this.found.add(elem);
this.processExpression(vdf.getInitializer());
}
}
break;
}
case ASTNode.INFIX_EXPRESSION: {
final InfixExpression iexp = (InfixExpression) node;
final InfixExpression.Operator op = iexp.getOperator();
if (Util.isLegalInfixOperator(op)) {
if (Util.inNeedOfTransformation(op)) {
final ISourceRange range = new SourceRange(iexp
.getStartPosition(), iexp.getLength());
this.legalEncounteredInfixExpressionSourceLocations
.add(range);
}
this.processExpression(iexp.getLeftOperand());
this.processExpression(iexp.getRightOperand());
}
else if (!Util.isSuspiciousInfixOperator(op))
throw new DefinitelyNotEnumerizableOperationException(
Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
else
throw new NonEnumerizableOperationException(
Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
break;