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 - Extracting superclass with final fields results in compilation errors
Summary: Extracting superclass with final fields results in compilation errors
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-19 15:19 UTC by TheIndifferent
Modified: 2015-08-25 13:26 UTC (History)
0 users

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 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