Bug 54094 Assertion failed in auto indent strategy
(in HEAD) The snippet editor subclasses the JavaSourceViewerConfiguration, and inherits its autoindent strategy. This is causing the following exception, when I attempt to enter a carriage return at the end of a snippet editor. For example, my editor cantained the following text. Placing the cursor at the end and pressing 'Enter' results in the stack trace. Should we not use the indent strategy? or can JUI allow us to continue using it? java.util.Vector v = null; v.add("Sam"); for (int i = 0; i < 100; i++) { } v.toString() org.eclipse.jface.text.Assert$AssertionFailedException: Assertion failed: at org.eclipse.jface.text.Assert.isTrue(Assert.java:175) at org.eclipse.jface.text.Assert.isTrue(Assert.java:160) at org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.scanForward (JavaHeuristicScanner.java:638) at org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner.findNonWhitespaceForwardI nAnyPartition(JavaHeuristicScanner.java:607) at org.eclipse.jdt.internal.ui.text.JavaIndenter.skipToPreviousListItemOrListStart (JavaIndenter.java:759) at org.eclipse.jdt.internal.ui.text.JavaIndenter.findReferencePosition (JavaIndenter.java:559) at org.eclipse.jdt.internal.ui.text.JavaIndenter.findReferencePosition (JavaIndenter.java:405) at org.eclipse.jdt.internal.ui.text.JavaIndenter.getReferenceIndentation (JavaIndenter.java:105) at org.eclipse.jdt.internal.ui.text.JavaIndenter.computeIndentation (JavaIndenter.java:138) at org.eclipse.jdt.internal.ui.text.JavaIndenter.computeIndentation (JavaIndenter.java:124) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.smartIndentAfterNe wLine(JavaAutoIndentStrategy.java:261) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.customizeDocumentC ommand(JavaAutoIndentStrategy.java:996) at org.eclipse.jface.text.TextViewer.customizeDocumentCommand (TextViewer.java:3132) at org.eclipse.jface.text.TextViewer.handleVerifyEvent (TextViewer.java:3160) at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText (TextViewer.java:322) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:193) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:650) at org.eclipse.swt.custom.StyledText.modifyContent (StyledText.java:5951) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6935) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2557) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5304) at org.eclipse.swt.custom.StyledText.handleKeyDown (StyledText.java:5327) at org.eclipse.swt.custom.StyledText$7.handleEvent (StyledText.java:5070) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1716) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1712) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3037) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2940) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2880) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1376) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2031) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1509) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1480) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:257) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:48) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:260) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:173) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:106) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:305) at org.eclipse.core.launcher.Main.run(Main.java:745) at org.eclipse.core.launcher.Main.main(Main.java:713)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaIndenter.java
}
	/**
	 * Returns the reference position for a list element. The algorithm
	 * tries to match any previous indentation on the same list. If there is none,
	 * the reference position returned is determined depending on the type of list:
	 * The indentation will either match the list scope introducer (e.g. for
	 * method declarations), so called deep indents, or simply increase the
	 * indentation by a number of standard indents. See also {@link #handleScopeIntroduction(int)}.
	 * 
	 * @return the reference position for a list item: either a previous list item
	 * that has its own indentation, or the list introduction start.
	 */
	private int skipToPreviousListItemOrListStart() {
		int startLine= fLine;
		int startPosition= fPosition;
		while (true) {
			nextToken();
			
			
			if (fLine < startLine) {
				try {
					int lineOffset= fDocument.getLineOffset(startLine);
					fAlign= fScanner.findNonWhitespaceForwardInAnyPartition(lineOffset, startPosition + 1);
				} catch (BadLocationException e) {
					
				}
				return startPosition;
			}
			
			switch (fToken) {