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 - [Push Down Field] Refactoring is forbidden even though it should be allowed
Summary: [Push Down Field] Refactoring is forbidden even though it should be allowed
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-19 06:35 UTC by kely_garcia
Modified: 2007-06-28 11:39 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 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.