Bug 95117 Quick fix: Create constructor with type parameter throws BadLocationException
Against I20050513-0010. Given code: public class Exposer<DECORATED> { public static <DECORATED> Exposer<DECORATED> createAnnotationTest( Class<? extends DECORATED> clazz, String methodName) { return new Exposer<DECORATED>(clazz, methodName); } } There's a compile error because of the nonexistent constructor. Quick fix to create the constructor, and you get the below error logged and an error dialog. The quick fix is actually correctly applied, however. org.eclipse.core.runtime.CoreException[4]: org.eclipse.jface.text.BadLocationException at org.eclipse.jface.text.link.LinkedPositionGroup.enforceEqualContent(LinkedPositionGroup.java:128) at org.eclipse.jface.text.link.LinkedPositionGroup.addPosition(LinkedPositionGroup.java:110) at org.eclipse.jdt.internal.ui.text.correction.LinkedCorrectionProposal.enterLinkedMode(LinkedCorrectionProposal.java:249) at org.eclipse.jdt.internal.ui.text.correction.LinkedCorrectionProposal.performChange(LinkedCorrectionProposal.java:218) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.apply(CUCorrectionProposal.java:303) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:457) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.selectProposalWithMask(CompletionProposalPopup.java:399) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:822) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:630) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:415) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:55) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:659) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5135) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4870) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:879) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:875) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1182) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3135) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3038) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3513) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1650) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2552) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1601) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1565) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:315) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:371) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:160) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:330) at org.eclipse.core.launcher.Main.basicRun(Main.java:274) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewMethodCompletionProposal.java
super(label, targetCU, invocationNode, binding, relevance, image);
		fArguments= arguments;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.ui.text.correction.AbstractMethodCompletionProposal#evaluateModifiers(org.eclipse.jdt.core.dom.ASTNode)
	 */
	protected int evaluateModifiers(ASTNode targetTypeDecl) {
		if (getSenderBinding().isAnnotation()) {
			return 0;
		}
		if (getSenderBinding().isInterface()) {
			
			MethodDeclaration[] methodDecls= ((TypeDeclaration) targetTypeDecl).getMethods();
			if (methodDecls.length > 0) {
				return methodDecls[0].getModifiers();
			}
			return 0;
		}
		ASTNode invocationNode= getInvocationNode();
		if (invocationNode instanceof MethodInvocation) {
			int modifiers= 0;
			Expression expression= ((MethodInvocation)invocationNode).getExpression();
			if (expression != null) {
				if (expression instanceof Name && ((Name) expression).resolveBinding().getKind() == IBinding.TYPE) {
					modifiers |= Modifier.STATIC;
				}
			} else if (ASTResolving.isInStaticContext(invocationNode)) {
				modifiers |= Modifier.STATIC;
			}
			ASTNode node= ASTResolving.findParentType(invocationNode);