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 221939 - [Replace constructor with factory] There is no check if constructor is called from subclass constructor
Summary: [Replace constructor with factory] There is no check if constructor is called...
Status: REOPENED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
: 233761 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-12 10:16 UTC by Jiri Prox
Modified: 2015-11-18 12:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2012-11-12 10:16:16 UTC
There is no check if the replaced constructor is called from subclass constructor.


Steps to reproduce:
1) have a classes
public class RplWithFactory { 
    public RplWithFactory(double x) {
    } 
}

public class SubClass extends RplWithFactory {
    public SubClass(double x) {
        super(x);
    }
}

2) replace constructor with factory

-> there is error at line super(x); the constructor has private access.


Product Version: NetBeans IDE Dev (Build 201211120001)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b15
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Jiri Prox 2013-08-05 11:41:05 UTC
*** Bug 233761 has been marked as a duplicate of this bug. ***
Comment 2 Martin Balin 2015-09-17 11:15:57 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.
Comment 3 Jiri Prox 2015-09-17 16:51:36 UTC
still valid

Product Version: NetBeans IDE Dev (Build 201509170002)
Updates: Updates available
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 4 Jachym_Vojtek 2015-11-18 12:59:23 UTC
I was hit by this too. 
The solution could be:
. package private modifier for super() called from constructors in the same package 
. use protected modifier on the refactored constructor if super() is called in different package