Bug 95000 CCE trying to use quickfix in an annotation type
Build ID: I20050510-0010 + HEAD of JDT/UI and JDT/Core. Steps to reproduce: 1) Create a class with this source: import java.lang.annotation.*; @Target(ElementType) @interface MyAnnotation { } ElementType is reported as an error. Try to use quickfix to fix it. Caused by: java.lang.ClassCastException: org.eclipse.jdt.core.dom.AnnotationTypeDeclaration at org.eclipse.jdt.internal.ui.text.correction.NewVariableCompletionProposal.evaluateFieldModifiers(NewVariableCompletionProposal.java:428) at org.eclipse.jdt.internal.ui.text.correction.NewVariableCompletionProposal.doAddField(NewVariableCompletionProposal.java:334) at org.eclipse.jdt.internal.ui.text.correction.NewVariableCompletionProposal.getRewrite(NewVariableCompletionProposal.java:74) at org.eclipse.jdt.internal.ui.text.correction.ASTRewriteCorrectionProposal.addEdits(ASTRewriteCorrectionProposal.java:61) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.initializeTextChange(CUCorrectionProposal.java:135) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getAdditionalProposalInfo(CUCorrectionProposal.java:181) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation(AdditionalInfoController.java:221) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:820) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:810) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run(AdditionalInfoController.java:173) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:118) ... 18 more
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewVariableCompletionProposal.java
if (newTypeDecl != null) {
			AST ast= newTypeDecl.getAST();
			ASTRewrite rewrite= ASTRewrite.create(ast);
			VariableDeclarationFragment fragment= ast.newVariableDeclarationFragment();
			fragment.setName(ast.newSimpleName(node.getIdentifier()));
			Type type= evaluateVariableType(ast, fSenderBinding);
			FieldDeclaration newDecl= ast.newFieldDeclaration(fragment);
			newDecl.setType(type);
			newDecl.modifiers().addAll(ASTNodeFactory.newModifiers(ast, evaluateFieldModifiers(newTypeDecl)));
			if (fSenderBinding.isInterface() || fVariableKind == CONST_FIELD) {
				fragment.setInitializer(ASTNodeFactory.newDefaultExpression(ast, type, 0));
			}
			ChildListPropertyDescriptor property= ASTNodes.getBodyDeclarationsProperty(newTypeDecl);
			List decls= (List) newTypeDecl.getStructuralProperty(property);
			int insertIndex= findFieldInsertIndex(decls, node.getStartPosition());
			ListRewrite listRewriter= rewrite.getListRewrite(newTypeDecl, property);
			listRewriter.insertAt(newDecl, insertIndex, null);
			addLinkedPosition(rewrite.track(newDecl.getType()), false, KEY_TYPE);
			if (!isInDifferentCU) {
				addLinkedPosition(rewrite.track(node), true, KEY_NAME);
			}
			addLinkedPosition(rewrite.track(fragment.getName()), false, KEY_NAME);
			if (fragment.getInitializer() != null) {
				addLinkedPosition(rewrite.track(fragment.getInitializer()), false, KEY_INITIALIZER);
			}
			return rewrite;
		}
		return null;
	}
	private int findFieldInsertIndex(List decls, int currPos) {