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 242720 - Generate constructor dont check on scope of parent constructor
Summary: Generate constructor dont check on scope of parent constructor
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2014-03-09 18:08 UTC by akobberup
Modified: 2015-10-02 15:55 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description akobberup 2014-03-09 18:08:00 UTC
When extending a class and using the context menu hint "Generate: Constructor" (alt + insert to open context menu) a window is shown with the constructors that can be created from looking at the super class.

If any of these constructors on the super class is protected, it is indicated via a small key on the icon (like protected method in navigator). However when selecting to create a constructor that will "override" this constructor on the parent class, it is assumed that the constructor in the overriding class should not be protected, but public.

Would it not be fair to assume that if the constructor is protected in the super class, it should also be so in the extending class - and that it is being implemented to allow using this constructor on the child, not because it should be publicly available?

Maybe the golden middle-ground would be adding a Checkbox in the window, so that one could "keep scope from super"..?
Comment 1 Svata Dedic 2015-10-02 15:55:59 UTC
Dusane is it yours ?