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.


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).


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

Assertion failed: anchorBefore == null || anchorBefore.getTreeParent() == parent
at com.intellij.openapi.diagnostic.Logger.assertTrue(
at com.intellij.psi.impl.source.tree.ChangeUtil.addChild(
at com.intellij.psi.impl.source.tree.CompositeElement.addChild(
at com.intellij.psi.impl.source.tree.ChangeUtil.addChildren(
at com.intellij.psi.impl.source.tree.CompositeElement.addChildren(
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.addChildren(
at com.intellij.psi.impl.source.tree.CompositeElement.addInternal(
at com.intellij.psi.impl.source.TreeWrapperPsiElement.addAfter(
at generate.tostring.config.InsertAtCaretPolicy.insertNewMethod(
at generate.tostring.config.DuplicatePolicy.applyMethod(
at generate.tostring.GenerateToStringActionHandlerImpl.createToStringMethod(
at generate.tostring.GenerateToStringActionHandlerImpl.executeGenerateAction(
at generate.tostring.GenerateToStringActionHandlerImpl.access$100(
at generate.tostring.GenerateToStringActionHandlerImpl$2$
at com.intellij.openapi.application.impl.ApplicationImpl$13.compute(
at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(
at generate.tostring.GenerateToStringActionHandlerImpl$
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(
at generate.tostring.psi.PsiAdapter.executeCommand(
at generate.tostring.GenerateToStringActionHandlerImpl.executeGenerateActionLater(
at generate.tostring.GenerateToStringActionHandlerImpl.access$000(
at generate.tostring.GenerateToStringActionHandlerImpl$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEvent(
at com.intellij.ide.IdeEventQueue.c(
at com.intellij.ide.IdeEventQueue.b(
at com.intellij.ide.IdeEventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(


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...


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.


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.


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:

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.



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


v4.0.5 just released.

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


Please sign in to leave a comment.