This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 162554 - method refactoring issue
Summary: method refactoring issue
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: PC All
: P3 blocker with 1 vote (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 162555 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-14 06:46 UTC by alex108
Modified: 2012-10-17 15:59 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alex108 2009-04-14 06:46:17 UTC
There is an code position error after method refactoring in java class.
The problem appears as it showed in follows examples:
public class Test
{
  public void method1()
  {
    System.out.println("method1");
  } // end of <public void method1()>
  
  public void method2()
  {
     System.out.println("method2");
  } // end of <public void method2()>

  public void method3()
  {
    System.out.println("method3");
  } // end of <public void method3()>
} // end of <public class Test>

If I try to refactor method method2() to method22() the body of new method22() is pasted in wrong manner:

public class Test
{
  public void method1()
  {
    System.out.println("method1");
  } // end of <public void method1()>


  public void method22()
  {
    System.out.println("method2");
  } // end of <public void method22()>
  public void method3()
  {
    System.out.println("method3");
  } // end of <public void method3()>
} // end of <public class Test>

The problem is that there is two empty lines before method22() and no empty lines after this method.
That's all. 
I'll be glad if this report help you to improve this beautiful and comprehensive IDE.
Comment 1 Jiri Prox 2009-04-14 15:19:17 UTC
reproducible

Product Version: NetBeans IDE Dev (Build 200904090200)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
System: Linux version 2.6.24-23-generic running on i386; UTF-8; en_US (nb)
Comment 2 Jan Pokorsky 2009-04-14 16:29:28 UTC
*** Issue 162555 has been marked as a duplicate of this issue. ***
Comment 3 Jan Pokorsky 2009-04-14 17:17:11 UTC
A java generator issue. Simplified steps of the rename refactoring look as follows:

TreeMaker make = ...;
MethodTree tree = ...;
Tree nju = make.setLabel(tree, newName);
workingCopy.rewrite(oldTree, newTree);

Reassigning
Comment 4 Rastislav Komara 2009-04-29 12:54:43 UTC
Workaround: Use reformat after rename. 
Comment 5 Jan Lahoda 2009-08-20 10:01:47 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 6 Marian Mirilovic 2012-10-17 15:59:45 UTC
It works fine in 
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01
System: Linux version 3.2.0-32-generic running on i386; UTF-8; en_US (nb)