Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 98848 - [Move Inner To Outer Level] Move Inner Class B which has an expression that involves field A.f yields compilation error
[Move Inner To Outer Level] Move Inner Class B which has an expression that i...
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
5.x
PC Windows XP
: P3 (vote)
: 6.x
Assigned To: issues@java
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-23 20:17 UTC by kely_garcia
Modified: 2008-11-18 16:35 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-23 20:17:27 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Steps To Reproduce:
Move Inner Class B on the following declaring field "a" for the outer class

public class A {
    public int f;        
    class B {
        public void dummyMethod_B(){                        
            int g= f;
        }
    }
}

Yields the following refactored class B:
class B {
    public B(A a) {
        this.a = a;
    }

    private final A a;

    public void dummyMethod_B(){                        
        int g = f;
    }
}

Compilation error is the following: "cannot find symbol: variable f"
Comment 1 kely_garcia 2007-04-08 00:32:53 UTC
Note: The same problem happens with methods. For example: Move Inner 
Class 'Inner' on the following:
class A 
{
	private int foo() {return 0;}
	public class Inner
	{
		Inner() {
			int f= foo();
		}
	}	
}

yields the following refactored class Inner:
public class Inner
{
    private final A a;

    Inner(A a) {
        this.a = a;
        int f = foo();
    }
}
Compilation error is the following: "cannot find symbol: method foo"
Comment 2 Jan Becicka 2007-04-23 09:38:53 UTC
Move Inner To Outer Level not implemented in 6.0 so far.
Comment 3 Jiri Prox 2008-04-11 01:49:35 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 4 Jan Pokorsky 2008-11-18 16:35:50 UTC
fixed in NB 6.5


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