Rearranger: missing methods?

Dave,

I realized that Live Rearranger would occasionally miss methods
at times (they just don't appear in the tree).

Here's such a class (taken out of context and stripped down
to an ugly form just for sake of compactness, but the problem
is still there):

package com;
public class Foo {
private String m_name;
public String getName() { return m_name; }
public void setName(String name) { m_name = name; }
public String getReference() { return null; }
public void setReference(String reference) { }
}


When I live-rearrange, "setName(String)" doesn't appear in
the tree.

No exception thrown.

Thanks,

Vince.


4 comments

Thanks, I'll investigate.
-Dave

0

Hi Vince,

I can't reproduce the problem with the sample class you gave me. All five items appear (unless I choose not to display fields, then m_name doesn't appear).

I found a problem with class initializers which will be fixed in 2.8; if your file has one, give 2.8 a try (soon to be uploaded). If not, perhaps you could turn on debugging and send me the file being rearranged and the debug output (email to davek ]]> wrq.com is fine).

You enable debugging by adding
]]>to the /bin/log.xml file, just before the ]]> element. I also like to turn on console output by finding the three occurrences of "console" in idea.lax and following the instructions there. Then restart IDEA.

0

Hey Dave,

started idea; Ctrl-, ; alt-tab to capture console output.
"setReference()" is simply not on the tree (I have a snapshot,
just in case)


The class:

package foo;

public class Bar {
private String m_reference;
public void setReference(String reference) {
m_reference = reference;
}
public String getReference() {
return m_reference;
}
}


The log:

DEBUG - com.wrq.rearranger - constructor called for
Rearranger plugin version 2.8
DEBUG - com.wrq.rearranger - did not find class
org.intellij.psi.codeStyle.RearrangerUtility
DEBUG - com.wrq.rearranger -
rearranger.readExternal()
DEBUG - com.wrq.rearranger - element 'Rearranger'
seen; configuration loading
DEBUG - com.wrq.rearranger - element has 11 children
DEBUG - com.wrq.rearranger - initComponent()
DEBUG - er.LiveRearrangerActionHandler -
project=com.intellij.openapi.project.a.d@13887c2
DEBUG - er.LiveRearrangerActionHandler -
editor=com.intellij.openapi.editor.c.m@15128b4
DEBUG - er.LiveRearrangerActionHandler - inProgress=false
DEBUG - er.LiveRearrangerActionHandler - enter
liveRearrangeDocument on thread AWT-EventQueue-1
DEBUG - rq.rearranger.entry.ClassEntry - PsiJavaFile:Bar.java
child 1:PsiImportList
DEBUG - rq.rearranger.entry.ClassEntry - PsiJavaFile:Bar.java
child 2:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiJavaFile:Bar.java
child 3:PsiClass:Bar
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
0:PsiModifierList:public
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
1:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
2:PsiKeyword:class
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
3:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
4:PsiIdentifier:Bar
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
5:PsiTypeParameterList
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
6:PsiReferenceList
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
7:PsiReferenceList
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
8:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
9:PsiJavaToken:LBRACE
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
10:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
11:PsiField:m_reference
DEBUG - rq.rearranger.entry.ClassEntry - parseField:
name=m_reference, modifiers=2
DEBUG - rq.rearranger.entry.ClassEntry - parseField:
getLastChild=PsiJavaToken:SEMICOLON
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
12:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
13:PsiMethod:setReference
DEBUG - rq.rearranger.entry.ClassEntry - checking to see if
setReference of PsiClass:Bar is canonical
DEBUG - rq.rearranger.entry.ClassEntry - method
PsiMethod:setReference has 0 supermethods
DEBUG - rq.rearranger.entry.ClassEntry - method
PsiMethod:setReference is other
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
14:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
15:PsiMethod:getReference
DEBUG - rq.rearranger.entry.ClassEntry - checking to see if
getReference of PsiClass:Bar is canonical
DEBUG - rq.rearranger.entry.ClassEntry - method
PsiMethod:getReference has 0 supermethods
DEBUG - rq.rearranger.entry.ClassEntry - method
PsiMethod:getReference is other
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
16:PsiWhiteSpace
DEBUG - rq.rearranger.entry.ClassEntry - PsiClass:Bar child
17:PsiJavaToken:RBRACE
DEBUG - rq.rearranger.entry.ClassEntry - building method call &
getter-setter graph
DEBUG - q.rearranger.entry.MethodEntry - building method call &
getter-setter graph for setReference
DEBUG - q.rearranger.entry.MethodEntry - building method call &
getter-setter graph for getReference
DEBUG - rq.rearranger.entry.ClassEntry - identifying setters and
extracted (related) methods
DEBUG - q.rearranger.entry.MethodEntry - method
PsiMethod:getReference is getter; its setter is PsiMethod:setReference
DEBUG - rq.rearranger.entry.ClassEntry - relating extracted
methods
DEBUG - q.rearranger.entry.MethodEntry - PsiMethod:setReference
is getter/setter, not treated as extracted method
DEBUG - q.rearranger.entry.MethodEntry - determined
PsiMethod:setReference is extracted method? false
DEBUG - q.rearranger.entry.MethodEntry - PsiMethod:getReference
is getter/setter, not treated as extracted method
DEBUG - q.rearranger.entry.MethodEntry - determined
PsiMethod:getReference is extracted method? false
DEBUG - q.rearranger.entry.MethodEntry - entered
handleOverloadedMethods(): move overloaded methods together
DEBUG - earrangement.GenericRearranger - rule:]]>;
entry matched:PsiField:m_reference
DEBUG - earrangement.GenericRearranger - rule:]]>;
entry matched:PsiMethod:setReference
DEBUG - earrangement.GenericRearranger - rule:]]>;
entry matched:PsiMethod:getReference
DEBUG - earrangement.GenericRearranger -
rule:com.wrq.rearranger.settings.attributeGroups.TrailerRule@3bf703; entry
matched:PsiJavaToken:RBRACE
DEBUG - q.rearranger.entry.MethodEntry - rearrangeRelatedItems:
for getter method MethodEntry PsiMethod:getReference; calls 0, called by 0,
nParameters=0, corresponding setter is MethodEntry PsiMethod:setReference;
calls 0, called by 0, nParameters=1
DEBUG - q.rearranger.entry.MethodEntry -
DEBUG - earrangement.GenericRearranger -
rule:com.wrq.rearranger.settings.attributeGroups.HeaderRule@840613; entry
matched:PsiPackageStatement:foo
DEBUG - earrangement.GenericRearranger - rule:]]>;
entry matched:PsiJavaToken:LBRACE
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - earranger.popup.TreeDragSource - construct
TreeDragSource, actions=2
DEBUG - m.wrq.rearranger.util.IconUtil - imageIcon retrieved from
URL is 28 wide, 28 high
DEBUG - m.wrq.rearranger.util.IconUtil - imageIcon retrieved from
URL is 28 wide, 28 high
DEBUG - m.wrq.rearranger.util.IconUtil - imageIcon retrieved from
URL is 28 wide, 28 high
DEBUG - m.wrq.rearranger.util.IconUtil - imageIcon retrieved from
URL is 28 wide, 28 high
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - rq.rearranger.entry.ClassEntry - getTypeIconName: has
static modifier=false
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
end=PsiJavaToken:LBRACE; text={
DEBUG - rq.rearranger.entry.ClassEntry - getPLiconName:
modifierList=PsiModifierList:public
DEBUG - ger.popup.LiveRearrangerDialog - entered finish() on
thread AWT-EventQueue-1
DEBUG - ger.popup.LiveRearrangerDialog - no rearrangement
occurred, not rearranging document
DEBUG - ger.popup.LiveRearrangerDialog - exit liveRearranger
DEBUG - er.LiveRearrangerActionHandler - exit
liveRearrangeDocument on thread AWT-EventQueue-1
DEBUG - er.LiveRearrangerActionHandler - exit
buildLiveRearrangerData on thread AWT-EventQueue-1
DEBUG - com.wrq.rearranger -
rearranger.writeExternal()


Good luck :)

Vince.


0

It should be fixed in version 2.9 - give it a try!
-Dave

0

Please sign in to leave a comment.