Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 103642

Summary: Broken rewrite of ClassTree
Product: java Reporter: Jan Pokorsky <jpokorsky>
Component: SourceAssignee: Pavel Flaska <pflaska>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3    
Version: 6.x   
Target Milestone: 6.x   
Hardware: PC   
OS: Linux   
Whiteboard:
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 76502    
Attachments: NPE

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