comparator);
final Map annotationToQualifiedNameMap = new HashMap();
for (final Iterator cit = constants.iterator(); cit.hasNext();) {
final IField constantField = (IField) cit.next();
final FieldDeclaration originalFieldDeclaration = (FieldDeclaration) this.removedFieldNodes
.get(constantField);
// Get annotations.
final Collection annotationCollection = new LinkedHashSet();
for (final Iterator mit = originalFieldDeclaration.modifiers()
.iterator(); mit.hasNext();) {
final Object o = mit.next();
if (o instanceof Annotation) {
final Annotation oldAnnotation = (Annotation) o;
final Annotation newAnnotation = (Annotation) ASTNode
.copySubtree(ast, oldAnnotation);
annotationToQualifiedNameMap.put(newAnnotation,
oldAnnotation.resolveTypeBinding()
.getQualifiedName());
annotationCollection.add(newAnnotation);
}
}
// Get the javadoc.
final Javadoc originalJavadoc = originalFieldDeclaration
.getJavadoc();
final Javadoc newJavadoc = (Javadoc) ASTNode.copySubtree(ast,
originalJavadoc);
final EnumConstantDeclaration constDecl = createNewEnumConstantDeclarataion(
ast, ast.newSimpleName(constantField.getElementName()),
newJavadoc, annotationCollection);
newEnumConstantToOldConstantFieldMap.put(constDecl, constantField);
enumConstantDeclarationCollection.add(constDecl);
}