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 254517

Summary: Extracting superclass with final fields results in compilation errors
Product: java Reporter: TheIndifferent
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description TheIndifferent 2015-08-19 15:19:48 UTC
Create following class:

package org.test.netbeans;

public class MainClass {

    private final String one;
    private final String two;

    public MainClass(String one, String two) {
        this.one = one;
        this.two = two;
    }

    protected String getOne() {
        return one;
    }

    protected String getTwo() {
        return two;
    }

}


Invoke "Extract superclass" dialog, mark "one" and "getOne()" for extraction and press "Refactor" button.

Superclass will have only no-args constructor and will leave final field "one" uninitialized. MainClass constructor will not be changed at all, showing error on assignment line.
Comment 1 TheIndifferent 2015-08-19 15:20:42 UTC
Forgot to add version info:

netbeans-beta> hg log -l 1
changeset:   290364:2d3f0b39773c
tag:         tip
parent:      290350:71e77bcc761e
parent:      290363:28f67ac056d0
user:        ffjre@netbeans.org
date:        Wed Aug 19 11:09:09 2015 +0000
summary:     Merge of http://hg.netbeans.org/jet-main/
Comment 2 Jiri Prox 2015-08-25 13:26:35 UTC
reproducible