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 98167

Summary: [Push Down Field] Refactoring is forbidden even though it should be allowed
Product: editor Reporter: kely_garcia <kely_garcia>
Component: RefactoringAssignee: issues@java <issues>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description kely_garcia 2007-03-19 06:35:45 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Steps to reproduce: apply Push Down Field refactoring on the following program:

public class A {
    public int f;
    
    public void method_A(){
        class B extends A {
            public void method_B(){
                int aVal = 0;
                super.f = 0;
            }
        }
    }
}

The precondition phase reports back the message "Cannot push down any members.
The selected type has no subtypes in the currently opened projects".

This refactoring should be allowed to proceed because:
(a) the selected type does have a subtype (class B)
(b) the only reference to the field is coming from the subclass B (even though
this is then referenced from a method in class A)
Comment 1 Jiri Prox 2007-03-19 09:05:02 UTC
Is cursor located within class A when calling refactoring?
Comment 2 kely_garcia 2007-06-28 00:20:05 UTC
The field A.f is selected in order to apply the push down field refactoring
Comment 3 Jiri Prox 2007-06-28 11:39:57 UTC
This works for me in M10, the problem is "super.f=0" reference, but it is filed as another issue.