Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 103642 - Broken rewrite of ClassTree
Broken rewrite of ClassTree
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Source
6.x
PC Linux
: P3 (vote)
: 6.x
Assigned To: Pavel Flaska
issues@java
:
Depends on:
Blocks: 76502
  Show dependency treegraph
 
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
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo