Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 76502 - [Extract Super Class] Necessary constructor not created when extracting form class with super calls
[Extract Super Class] Necessary constructor not created when extracting form...
Status: VERIFIED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
5.x
All All
: P3 (vote)
: 6.x
Assigned To: Jan Pokorsky
issues@java
:
Depends on: 99968 103642
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-17 16:43 UTC by Jiri Prox
Modified: 2007-10-04 13:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2006-05-17 16:43:35 UTC
NB 5.5 beta 200605090801
JDK 1.6.0 b84

Necessary constructors not created when extracting super class from class which
already extends other class and uses super calls in constructors. The newly
created class has only default constructor.

Steps to reproduce:
1) try to extract super class named NewClass from following class (SuperClass
has one constructor with one argument of type String):

public class Main extends SuperClass {   
    public Main(String text) {
        super(text);    
    }        
}

-> super(text) is invalid while NewClass has only default constructor
-> default constructor in NewClass requires default construcotr in SuperClass
but it does not exist

Solution can be to add all required constructor which only propagates their
arguments to former super class by calling super

e.g in out case:
protected NewClass(String text) {
  super(text);
}
Comment 1 Jan Becicka 2006-11-22 10:52:25 UTC
Not implemented in trunk so far.
Comment 2 Jan Pokorsky 2007-04-24 16:14:13 UTC
Checking existing constructors for super(...) and generating adequate
constructors should help.
Comment 3 Jan Pokorsky 2007-05-10 13:07:09 UTC
fixed in

/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/ExtractSuperclassRefactoringPlugin.java
new revision: 1.5; previous revision: 1.3
Comment 4 Jiri Prox 2007-05-31 15:26:44 UTC
Only part of issue seem to be fixed. The extracted class (named NewClass in this
test case) still have default constructor, with implicit super() call 
Comment 5 Jan Pokorsky 2007-08-30 20:05:14 UTC
It is a generator issue. I will reopen the issue #103642.
Comment 6 Jan Pokorsky 2007-08-31 11:12:17 UTC
Closing. There is nothing what can be done on the refactoring side. The issue #103642 tracks this problem.
Comment 7 Jiri Prox 2007-10-04 13:03:32 UTC
ok -> v.


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