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 170010 - Generate Constructor should propose to take super constructor parameters into account
Summary: Generate Constructor should propose to take super constructor parameters into...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker with 2 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-06 21:22 UTC by matthies
Modified: 2015-04-12 15:02 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2009-08-06 21:22:11 UTC
Example:

    public class Foo
    {
        public Foo(int n) { }
    }
    
    public class Bar extends Foo
    {
        private final String s;
        private final boolean b;        
    }

Code completion within Bar proposes to generate Bar() or Bar(String s, boolean b), but the generated constructors will 
be insufficient because the super constructor requires an argument. It's often the case that super constructor 
arguments are also arguments passed to the current constructor, hence it would be useful to also propose the generation 
of Bar(int n) and Bar(int n, String s, boolean b) in the example above.

This would also be useful regardless of the presence of instance fields, for example in subclasses of 
java.lang.Exception, which often have the same four constructors as java.lang.Exception, which then would be available 
for automatic generation.
Comment 1 Max Sauer 2009-08-07 08:58:10 UTC
Code completion issue -- reassigning to Dusan.