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
oneIndent.append('\t');
			else
				oneIndent.append('\t'); 
		}
		return oneIndent;
	}
	/**
	 * Returns the reference position regarding to indentation for <code>offset</code>,
	 * or <code>NOT_FOUND</code>. This method calls
	 * {@link #findReferencePosition(int, int) findReferencePosition(offset, nextChar)} where
	 * <code>nextChar</code> is the next character after <code>offset</code>.
	 * 
	 * @param offset the offset for which the reference is computed
	 * @return the reference statement relative to which <code>offset</code>
	 *         should be indented, or {@link JavaHeuristicScanner#NOT_FOUND}
	 */
	public int findReferencePosition(int offset) {
		return findReferencePosition(offset, peekChar(offset));
	}
	
	/**
	 * Peeks the next char in the document that comes after <code>offset</code>
	 * on the same line as <code>offset</code>.
	 * 
	 * @param offset the offset into document
	 * @return the token symbol of the next element, or TokenEOF if there is none
	 */
	private int peekChar(int offset) {
		if (offset < fDocument.getLength()) {
			try {