Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 98167 - [Push Down Field] Refactoring is forbidden even though it should be allowed
[Push Down Field] Refactoring is forbidden even though it should be allowed
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Refactoring
6.x
PC Windows XP
: P3 (vote)
: 6.x
Assigned To: issues@java
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
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
:


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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo