GenerateToString doesn't work in 7.0.1

Anyone else have a problem with GenerateToString not working in 7.0.1? The option is available in the generate menu and it lets me select which properties I want to include in my toString() but then doesn't actually do anything.

评论操作 固定链接

I am having this problem with a 7.0.2 EAP. GenerateToString is actually throwing an Exception (can't remember what exactly, but I can run it tomorrow and grab the Exception). I was going to track down contact info for th plug-in author and let him know. Just hadn't gotten a chance yet.

0
评论操作 固定链接

Actually the strangest thing is that it works fine now.

I did change my template from the default template to the StringBuilder template...that possibly had something to do with it?

Prior to that I was getting an exception as well (red blinking ! point at the bottom).

0
评论操作 固定链接

Weird, now it has stopped working again, the thrown exception

Assertion failed: anchorBefore == null || anchorBefore.getTreeParent() == parent
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:89)
at com.intellij.psi.impl.source.tree.ChangeUtil.addChild(ChangeUtil.java:278)
at com.intellij.psi.impl.source.tree.CompositeElement.addChild(CompositeElement.java:215)
at com.intellij.psi.impl.source.tree.ChangeUtil.addChildren(ChangeUtil.java:128)
at com.intellij.psi.impl.source.tree.CompositeElement.addChildren(CompositeElement.java:219)
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.addChildren(CodeEditUtil.java:187)
at com.intellij.psi.impl.source.tree.CompositeElement.addInternal(CompositeElement.java:93)
at com.intellij.psi.impl.source.tree.java.ClassElement.addInternal(ClassElement.java:132)
at com.intellij.psi.impl.source.TreeWrapperPsiElement.addAfter(TreeWrapperPsiElement.java:58)
at generate.tostring.config.InsertAtCaretPolicy.insertNewMethod(InsertAtCaretPolicy.java:51)
at generate.tostring.config.DuplicatePolicy.applyMethod(DuplicatePolicy.java:46)
at generate.tostring.GenerateToStringActionHandlerImpl.createToStringMethod(GenerateToStringActionHandlerImpl.java:360)
at generate.tostring.GenerateToStringActionHandlerImpl.executeGenerateAction(GenerateToStringActionHandlerImpl.java:260)
at generate.tostring.GenerateToStringActionHandlerImpl.access$100(GenerateToStringActionHandlerImpl.java:56)
at generate.tostring.GenerateToStringActionHandlerImpl$2$1.run(GenerateToStringActionHandlerImpl.java:281)
at com.intellij.openapi.application.impl.ApplicationImpl$13.compute(ApplicationImpl.java:3)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:109)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:214)
at generate.tostring.GenerateToStringActionHandlerImpl$2.run(GenerateToStringActionHandlerImpl.java:278)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:67)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:68)
at generate.tostring.psi.PsiAdapter.executeCommand(PsiAdapter.java:1255)
at generate.tostring.GenerateToStringActionHandlerImpl.executeGenerateActionLater(GenerateToStringActionHandlerImpl.java:290)
at generate.tostring.GenerateToStringActionHandlerImpl.access$000(GenerateToStringActionHandlerImpl.java:56)
at generate.tostring.GenerateToStringActionHandlerImpl$1.run(GenerateToStringActionHandlerImpl.java:164)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:111)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:53)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:92)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

0
评论操作 固定链接

This exception is not something specific to API change. What it says is the abuse of PSI: the anchor given is not a child of the element to which new element is added...

0
评论操作 固定链接

Found some additional information, if I have a single project open it works correctly. However, if I have a second IntelliJ window open (with a different project in it) that is when it starts throwing exceptions.

I have two monitors, I haven't tested it to see if it matters the windows are on a different monitor from each other.

0
评论操作 固定链接

Yeah, the problem defintely starts occuring when the second project is opened. It doesn't matter which monitor they are on (same behavior whether the windows are on seperate or the same monitors).

The plugin seems confused as to which window it needs to write into.

0
评论操作 固定链接

Thanks for the reports.

During the holidays I will have a go at fixing the 2 or more projects open bug problem.

The bug has been reported to the issue tracker at:
http://code.google.com/p/generate-tostring/issues/list

I am currently downloading build 7613 as the version I wanna use during the fixing. I am going back home to my parents and thus no internet connection so I am preparing by downloading a bunch of stuff from the net to get me occupied.

/Claus

0
评论操作 固定链接

Okay I got it fixed now. I will release a new version shortly.

0
评论操作 固定链接

v4.0.5 just released.

Let me know if it also works for your guys now.

0

请先登录再写评论。