Bug 52361 [templates] linked mode not exited / annotations not redrawn when inserting anonymous completion
M7 0. Auto-closed parenthesis on 1. Insert this code: import java.lang.Runnable; void m() { method(<caret> } -> closing parenthesis gets inserted -> linked mode entered 2. type "new Runnable(" -> nested linked mode is entered for second parenthesis, also autoclosed 3. use code completion to complete the anonymous type -> you end up with this code: void m() { method(new Runnable() { public void run() { } }) } -> Linked mode is still drawn 4. Press <Tab> or <Enter> -> linked mode is not exited -> annotations keep being drawn The only way to get away with the annotations is to open a new parenthesis somewhere outside the initial code.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionAnnotations.java
private final static boolean markTargets= true;
	private final static boolean markSlaves= true;
	private final static boolean markFocus= true;
	private final static boolean markExitTarget= true;
	
	private Annotation fFocusAnnotation= null;
	private Annotation fExitAnnotation= null;
	private final Map fGroupAnnotations= new HashMap();
	private final Map fTargetAnnotations= new HashMap();
	private Position[] fTargets= new Position[0];
	private LinkedPosition fExitPosition= null;
	/**
	 * Sets the position that should be highlighted as the focus position, i.e. 
	 * as the position whose changes are propagated to all its linked positions
	 * by the linked environment.
	 * 
	 * @param position the new focus position, or <code>null</code> if no focus is set.
	 */
	private void setFocusPosition(Position position) throws BadLocationException {
		if (markFocus && getPosition(fFocusAnnotation) != position) {
			removeAnnotation(fFocusAnnotation, false);
			if (position != null) {
				fFocusAnnotation= new Annotation(FOCUS_ANNOTATION_TYPE, false, ""); 
				addAnnotation(fFocusAnnotation, position, false);
			} else
				fFocusAnnotation= null;
		}
	}
	
	/**