Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View Macro Expansion > "java.lang.AssertionError: Wrong line separators" #739

Closed
ryanbw opened this issue Feb 11, 2015 · 10 comments
Closed
Milestone

Comments

@ryanbw
Copy link

ryanbw commented Feb 11, 2015

Windows 7 x64
JRE 1.7.0_71-b14 amd64
IDEA 14.0.3
Cursive 0.1.45

When running Tools > REPL > View Macro Expansion, I get this:

Wrong line separators: '(deftest\r\n  route-...' at offset 8
java.lang.AssertionError: Wrong line separators: '(deftest\r\n  route-...' at offset 8
    at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:66)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:115)
    at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2418)
    at com.intellij.openapi.editor.impl.DocumentImpl.assertValidSeparators(DocumentImpl.java:629)
    at com.intellij.openapi.editor.impl.DocumentImpl.<init>(DocumentImpl.java:126)
    at com.intellij.openapi.editor.impl.DocumentImpl.<init>(DocumentImpl.java:121)
    at com.intellij.openapi.editor.impl.DocumentImpl.<init>(DocumentImpl.java:113)
    at com.intellij.psi.formatter.FormattingDocumentModelImpl.createOn(FormattingDocumentModelImpl.java:74)
    at com.intellij.formatting.FormatterImpl.createFormattingModelForPsiFile(FormatterImpl.java:783)
    at com.intellij.formatting.FormattingModelProvider.createFormattingModelForPsiFile(FormattingModelProvider.java:49)
    at plugin.formatting$initialise$reify__6156.createModel(formatting.clj:474)
    at com.intellij.formatting.CoreFormatterUtil.buildModel(CoreFormatterUtil.java:48)
    at com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade.doProcessRange(CodeFormatterFacade.java:128)
    at com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade.processRange(CodeFormatterFacade.java:95)
    at com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade.processElement(CodeFormatterFacade.java:91)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformat(CodeStyleManagerImpl.java:102)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformat(CodeStyleManagerImpl.java:89)
    at plugin.psi$reformat_BANG_.invoke(psi.clj:483)
    at plugin.macroexpand$formatted_element.invoke(macroexpand.clj:289)
    at plugin.macroexpand$current_elements.invoke(macroexpand.clj:348)
    at plugin.macroexpand$update_text_BANG_$fn__7126.invoke(macroexpand.clj:376)
    at clojure.lang.AFn.run(AFn.java:24)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:977)
    at com.intellij.util.DocumentUtil$1.run(DocumentUtil.java:64)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.runUndoTransparentAction(CoreCommandProcessor.java:296)
    at com.intellij.util.DocumentUtil.writeInRunUndoTransparentAction(DocumentUtil.java:61)
    at plugin.macroexpand$update_text_BANG_.invoke(macroexpand.clj:374)
    at plugin.macroexpand$make_expander.invoke(macroexpand.clj:536)
    at plugin.macroexpand$show_expander.invoke(macroexpand.clj:579)
    at plugin.repl.actions$view_macro_expansion.invoke(actions.clj:429)
    at clojure.lang.Var.invoke(Var.java:415)
    at plugin.actions$dumb_aware$fn__1341.invoke(actions.clj:145)
    at plugin.actions.proxy$com.intellij.openapi.project.DumbAwareAction$ClojureAction$WithShortcutSet$12bedcdc.actionPerformed(Unknown Source)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:266)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:926)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:236)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:105)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:512)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:44)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:532)
    at java.awt.Component.processMouseEvent(Component.java:6516)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
    at java.awt.Component.processEvent(Component.java:6281)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4872)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:708)
    at java.awt.EventQueue$4.run(EventQueue.java:706)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:573)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.Throwable
    ... 76 more
@cursive-ide cursive-ide added this to the 0.1.46 milestone Feb 11, 2015
@cursive-ide
Copy link
Owner

Thanks, I'll take a look at this.

BTW on the exception popup window, there's now a button to send exceptions straight to me, so you don't have to file issues. If you want to file an issue that's fine of course, but that might be easier for you.

@cursive-ide
Copy link
Owner

I can't reproduce this, even by setting my line.separator property. Do you have anything in your JVM settings related to line separators? Does this happen every time for you, or just occasionally?

@ryanbw
Copy link
Author

ryanbw commented Feb 11, 2015

It seems to happen every time with certain forms, but not with all forms. Double-checked my JVM settings but I'm pretty sure none of them are relevant.

I'm working on a minimal repro for you. The criteria for getting the exception are non-trivial.

@cursive-ide
Copy link
Owner

If it's easier, I think I've made a change that will fix the problem. If you'd like to try a dev build, drop me a mail at cursive@cursiveclojure.com.

@ryanbw
Copy link
Author

ryanbw commented Feb 11, 2015

There'd be some cost to me trying that, unfortunately. Might resort to it if it's the only way for us to diagnose but for now, can you repro with this?

(defn foo [x] `(vector ~x))

@cursive-ide
Copy link
Owner

Yes, I can, thanks.

@cursive-ide
Copy link
Owner

I fixed your original problem based on your reproduction case. I also found another problem with it but didn't have time to fix that since I need to get a release out for an unrelated problem. I'll fix that for the next drop.

@ryanbw
Copy link
Author

ryanbw commented Feb 17, 2015

Cool, thanks! I can confirm that this works on my original code now in 0.1.46.

@cursive-ide
Copy link
Owner

Great! Feedback is useful on whether the macroexpansion UI is useful and understandable, too, since it's pretty new. Let me know if anything isn't working well - I actually don't use this much myself since I don't use a lot of macros.

@ryanbw
Copy link
Author

ryanbw commented Feb 18, 2015

I'm finding it to be very useful. I'll toss a few usability thoughts in a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants