Closed gavinking closed 9 years ago
Can you give me the whole stack trace? The non-suppressed exception is the interesting one.
Also, you obviously can’t set lineBreaksAfterSingleComment
to 0..0
, that would break the code. The IDE should prevent you from doing that – didn’t it?
EDIT: Oops, no, confused singleComment
and lineComment
. Sorry.
The IDE should prevent you from doing that – didn’t it?
It does. But it doesn't for the other two.
ceylon.language.AssertionError "Assertion failed
violated !intersect.decreasing"
at ceylon.formatter.FormattingWriter.intersectAllowedLineBreaks$canonical$(FormattingWriter.ceylon:429)
at ceylon.formatter.FormattingWriter.intersectAllowedLineBreaks(FormattingWriter.ceylon:382)
at ceylon.formatter.FormattingWriter.requireAtLeastLineBreaks$canonical$(FormattingWriter.ceylon:442)
at ceylon.formatter.FormattingWriter.requireAtLeastLineBreaks(FormattingWriter.ceylon)
at ceylon.formatter.FormattingVisitor.visitBody(FormattingVisitor.ceylon:307)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visitClassBody(VisitorAdaptor.java:122)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visit(VisitorAdaptor.java:123)
at com.redhat.ceylon.compiler.typechecker.tree.Tree$ClassBody.visit(Tree.java:1708)
at ceylon.formatter.FormattingVisitor.visitAnyClass(FormattingVisitor.ceylon:161)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visitClassDefinition(VisitorAdaptor.java:70)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visit(VisitorAdaptor.java:71)
at com.redhat.ceylon.compiler.typechecker.tree.Tree$ClassDefinition.visit(Tree.java:937)
at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkCompilationUnit(Walker.java:30)
at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visitChildren(Tree.java:30)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visitAny(VisitorAdaptor.java:10)
at ceylon.formatter.FormattingVisitor.visitAny(FormattingVisitor.ceylon:1951)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visitCompilationUnit(VisitorAdaptor.java:12)
at com.redhat.ceylon.compiler.typechecker.tree.VisitorAdaptor.visit(VisitorAdaptor.java:13)
at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visit(Tree.java:22)
at ceylon.formatter.format_.format(format.ceylon:72)
at ceylon.formatter.format_.format(format.ceylon)
at com.redhat.ceylon.eclipse.code.style.CeylonPreview.doFormatPreview(CeylonPreview.java:229)
at com.redhat.ceylon.eclipse.code.style.CeylonPreview.update(CeylonPreview.java:180)
at com.redhat.ceylon.eclipse.code.style.CeylonPreview.setPreviewText(CeylonPreview.java:260)
at com.redhat.ceylon.eclipse.code.style.FormatterTabLine.doUpdatePreview(FormatterTabLine.java:247)
at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$1.update(FormatterTabPage.java:103)
at java.util.Observable.notifyObservers(Observable.java:159)
at java.util.Observable.notifyObservers(Observable.java:115)
at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$NumberPreference.saveSelected(FormatterTabPage.java:435)
at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$NumberPreference.fieldModified(FormatterTabPage.java:427)
at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$NumberPreference$2.modifyText(FormatterTabPage.java:379)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
at org.eclipse.jface.window.Window.open(Window.java:808)
at com.redhat.ceylon.eclipse.code.style.FormatterConfigurationBlock$ButtonController.modifyButtonPressed(FormatterConfigurationBlock.java:447)
at com.redhat.ceylon.eclipse.code.style.FormatterConfigurationBlock$ButtonController.widgetSelected(FormatterConfigurationBlock.java:392)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
at org.eclipse.jface.window.Window.open(Window.java:808)
at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:160)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:122)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1087)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4184)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1504)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1500)
at org.eclipse.swt.widgets.Tree.sendKeyEvent(Tree.java:2572)
at org.eclipse.swt.widgets.Control.keyDown(Control.java:2396)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:607)
at org.eclipse.swt.widgets.Tree.keyDown(Tree.java:1971)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5629)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2105)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2329)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5691)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5128)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5277)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Suppressed: ceylon.language.Exception "Unexpected token 'String' ([@204,952:957='String',<125>,109:4]), expected '' instead"
at ceylon.formatter.FormattingWriter$11.$call$(FormattingWriter.ceylon:613)
at ceylon.formatter.FormattingWriter$11.$call$(FormattingWriter.ceylon:589)
at ceylon.formatter.FormattingWriter.fastForward$priv$(FormattingWriter.ceylon:1096)
at ceylon.formatter.FormattingWriter.writeToken$canonical$(FormattingWriter.ceylon:588)
at ceylon.formatter.FormattingWriter.writeToken(FormattingWriter.ceylon:464)
at ceylon.formatter.FormattingWriter.destroy(FormattingWriter.ceylon:1169)
at ceylon.formatter.FormattingVisitor.destroy(FormattingVisitor.ceylon:1955)
at ceylon.formatter.format_.format(format.ceylon:71)
... 103 more
Much more useful, thanks :)
Okay, I think we need to track in FormattingWriter
whether a range of allowed line breaks came from a comment or from a regular token, and handle empty intersections better if comments are involved, because
which in combination breaks, for example (here), visitBody
’s requireAtLeastLineBreaks(1)
.
If I set either of these options to
0..0
, I get hard crashes like this: