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 103642 - Broken rewrite of ClassTree
Summary: Broken rewrite of ClassTree
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks: 76502
  Show dependency tree
 
Reported: 2007-05-10 13:05 UTC by Jan Pokorsky
Modified: 2007-11-01 21:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE (1.16 KB, application/octet-stream)
2007-10-31 14:57 UTC, Pavel Flaska
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pokorsky 2007-05-10 13:05:20 UTC
Having class A

class A extends B {
    A(int a) {
        super(a);
    }
    void m() {
    }
}

and class B

class B {
    B(int a) {
    }
}

if I run Extract Superclass refactoring, with method m() selected for
extraction, the new extracted class contains wrong members.

public class NewClass extends B {
    NewClass(int a) {
        super(a);
    }
    NewClass() { // <-- here should be method m()
    }
}

In debugger, the new ClassTree passed to WorkingCopy.rewrite looks OK.

You can find code creating NewClass in
org.netbeans.modules.refactoring.java.plugins.ExtractSuperclassRefactoringPlugin.CreateSuperclassElement.run
Comment 1 Pavel Flaska 2007-07-13 15:06:54 UTC
Works correctly in current trunk build.
Comment 2 Jan Pokorsky 2007-08-30 20:08:23 UTC
Still broken. Now it ignores super(...) statement.

public class NewClass extends B {
    NewClass(int a) {
        // <-- here should be method super(a);
    }
    void m() {
    }
}

Comment 3 Pavel Flaska 2007-10-31 14:57:20 UTC
Created attachment 52126 [details]
NPE
Comment 4 Pavel Flaska 2007-10-31 15:02:02 UTC
When I tried to reproduce the current behavior, I got the exception above.

Although, I expect once the exception will be fixed, the issue will come back to java/source. 

Perhaps I will remove guess if the super is synthetic or not and will move responsibility to API clients. Once NPE will
be fixed, please, reassign it back.

Comment 5 Jan Pokorsky 2007-11-01 17:36:34 UTC
The NPE seems to be fixed. Reassigning back.
Comment 6 Pavel Flaska 2007-11-01 21:41:57 UTC
Checking in src/org/netbeans/modules/java/source/pretty/VeryPretty.java;
/cvs/java/source/src/org/netbeans/modules/java/source/pretty/VeryPretty.java,v  <--  VeryPretty.java
new revision: 1.71; previous revision: 1.70
done