[ANN] - Generate toString() v2.15 released

v2.15 of the toString() plugin has been released at the offical homepage for this plugin at:

http://www.intellij.org/twiki/bin/view/Main/ToStringPlugin

Or using the pluginmanager from within IDEA 4.x.

This version supports the new EAP build 2013, IDEA 4.x and IDEA 3.x as well (not compiled for this yet, but v2.12 is avail for 3.x).

For a release supporting IDEA 3.x download it from the official homepage. The IDEA pluginmanager is only a feature in IDEA 4.x.


About the plugin
================
GenerateToString is a action plugin for IDEA that is used to create or update java classes toString() method. The reason is valuebeans usually needs to dump their fieldvalues for debug purpose, and it's tedious to write the dump code for this. So this action plugin generates the code to dump all the fields in a simple manner.

v2.15 for IDEA 3.x/4.x (mar-10-2004)
====================================
- New feature: getters for code generation
http://www.intellij.net/forums/thread.jsp?nav=false&forum=18&thread=84580&start=0&msRange=15
- Apply button in Settings now work correctly
- Lowered height of textarea for velocity template from 400 to 300
- Some debug System.out removed
- Refactored PsiAdapter to support both PsiField and PsiMethod
- Refactored element package to have Element, FieldElement and MethodElement


/Claus, the author

7 comments
Comment actions Permalink

Bug report:

The plugin is no longer working for static inner classes.

Nothing happens on right-click | GenerateToString and the following error messages appears in the IDEA log file.

-Brian


2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl -
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - IntelliJ IDEA 4.0 Build #1179
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - JDK: 1.4.2_03
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - VM: Java HotSpot(TM) Client VM
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - Vendor: Sun Microsystems Inc.
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - OS: Windows XP
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - Last Action: Actions.ActionsPlugin.GenerateToString
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl - Current Command: Generate toString()
2004-05-12 08:01:44,061 ERROR - mand.impl.CommandProcessorImpl -
java.lang.NullPointerException
at org.intellij.idea.plugin.tostring.psi.idea4.PsiAdapterIdea4.isPrimitiveType(PsiAdapterIdea4.java:93)
at org.intellij.idea.plugin.tostring.psi.PsiAdapter.getTypeQualifiedClassName(PsiAdapter.java:602)
at org.intellij.idea.plugin.tostring.psi.PsiAdapter.getTypeClassName(PsiAdapter.java:620)
at org.intellij.idea.plugin.tostring.element.ElementFactory.setElementInfo(ElementFactory.java:121)
at org.intellij.idea.plugin.tostring.element.ElementFactory.newMethodElement(ElementFactory.java:85)
at org.intellij.idea.plugin.tostring.GenerateToStringActionHandler.filterAvailableMethods(GenerateToStringActionHandler.java:575)
at org.intellij.idea.plugin.tostring.GenerateToStringActionHandler.executeWriteAction(GenerateToStringActionHandler.java:97)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java)
at com.intellij.openapi.application.a.b.runWriteAction(b.java:299)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:5)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java)
at com.intellij.openapi.command.impl.a.executeCommand(a.java:94)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:19)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:24)
at com.intellij.openapi.actionSystem.b.n$b_.actionPerformed(n$b_.java:13)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at com.intellij.openapi.actionSystem.b.n.fireActionPerformed(n.java:55)
at com.intellij.ui.b.a.h.doClick(h.java:157)
at com.intellij.ui.b.a.h.access$300(h.java:124)
at com.intellij.ui.b.a.h$a_.mouseReleased(h$a_.java:3)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at com.intellij.ide.q.b(q.java:36)
at com.intellij.ide.q.a(q.java:34)
at com.intellij.ide.q.dispatchEvent(q.java:48)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

0
Comment actions Permalink

Cheers for the bug report. I will look into it.

/Claus

0
Comment actions Permalink

I can not reproduce this bug in build 2013 or 1179.

Can you attach an example with this error?

/Claus

0
Comment actions Permalink

I can not reproduce this bug in build 2013 or 1179.


I am not able to reproduce that problem now either. Weird.

A different problem illustrated in Foo below. The toString() generated when clicking in Foo does not include the x property. It works if the class has at least one field such as in Bar.

public class Foo{
public int getX(){
return 0;
}
}

//works here
public class Bar{
double d;
public int getX(){
return 0;
}
}

Brian

0
Comment actions Permalink

I tried the code below:


It seems it works okay even though there is no fields.
What template are you using? You have to use the "Default concat incl. getters".

/Claus

0
Comment actions Permalink

> What template are you using? You have to use the
> "Default concat incl. getters".

Thanks. Switching to this template fixed matters.

0
Comment actions Permalink

I released v2.16 that has a fix for the NPE in the stacktrace.

/Claus

0

Please sign in to leave a comment.