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 100308 - [Move Inner To Outer Level] Move Inner does not work with statically imported methods
Summary: [Move Inner To Outer Level] Move Inner does not work with statically imported...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Rastislav Komara
URL:
Keywords:
Depends on:
Blocks: 152192
  Show dependency tree
 
Reported: 2007-04-08 01:19 UTC by kely_garcia
Modified: 2009-05-23 06:55 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-04-08 01:19:20 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Steps To Reproduce:
Move Inner Class 'Inner' on the following:
import static java.lang.Math.E;
public class A {
	class Inner {
		public void doit() {
			foo();			
			double e= E;			
		}
	}
	static void foo(){};
}

yields the following refactored 'Inner' class:
class Inner {
    public Inner(A a) {
        this.a = a;
    }

    private final A a;

    public void doit() {
        this.a.foo();			
        double e = E;			
    }
}

Note: the problem is only with the static imported method 'E' but not with 
static method 'foo'
Comment 1 Jan Becicka 2007-04-23 09:41:25 UTC
Move Inner To Outer Level not implemented in 6.0 so far.
Comment 2 Daniel Prusa 2008-02-25 16:31:50 UTC
reproducible in nb 6.1
Comment 3 Jan Pokorsky 2008-11-18 16:54:48 UTC
GeneratorUtilities.importFQNs() does not work for static imports.

Basically, the refactorings removes ClassTree 'Inner', adds it to new CompilationUnitTree, takes existing IdentifierTree
'E' from 'double e= E;', calls GeneratorUtilities.importFQNs() passing the tree.

The same works for non-static imports as expected.
Comment 4 Rastislav Komara 2009-02-03 10:54:21 UTC
Overtake.
Comment 5 Sergey Petrov 2009-04-14 11:58:19 UTC
reproducible with 090413
Comment 6 Rastislav Komara 2009-05-19 11:47:10 UTC
The source code after refactoring is compilable. 

jet-main: #dbac5af29086
Comment 7 Quality Engineering 2009-05-23 06:55:56 UTC
Integrated into 'main-golden', will be available in build *200905230201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dbac5af29086
User: Rastislav Komara <moonko@netbeans.org>
Log: #100308: [Move Inner To Outer Level] Move Inner does not work with statically imported methods