}
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;
}