### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.ui Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInnerToTopRefactoring.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInnerToTopRefactoring.java,v retrieving revision 1.189 diff -u -r1.189 MoveInnerToTopRefactoring.java --- core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInnerToTopRefactoring.java 5 Mar 2010 17:36:50 -0000 1.189 +++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInnerToTopRefactoring.java 28 Jul 2010 17:09:38 -0000 @@ -90,6 +90,8 @@ import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; import org.eclipse.jdt.core.dom.rewrite.ListRewrite; +import org.eclipse.jdt.core.dom.rewrite.TargetSourceRangeComputer; +import org.eclipse.jdt.core.dom.rewrite.TargetSourceRangeComputer.SourceRange; import org.eclipse.jdt.core.refactoring.CompilationUnitChange; import org.eclipse.jdt.core.refactoring.IJavaRefactorings; import org.eclipse.jdt.core.refactoring.descriptors.ConvertMemberTypeDescriptor; @@ -1033,7 +1035,8 @@ parser.setResolveBindings(false); parser.setSource(source.toCharArray()); final AbstractTypeDeclaration declaration= findTypeDeclaration(fType, (CompilationUnit) parser.createAST(null)); - return source.substring(declaration.getStartPosition(), ASTNodes.getExclusiveEnd(declaration)); + SourceRange sourceRange= new TargetSourceRangeComputer().computeSourceRange(declaration); + return source.substring(sourceRange.getStartPosition(), sourceRange.getStartPosition() + sourceRange.getLength()); } private Expression createQualifiedReadAccessExpressionForEnclosingInstance(AST ast) { #P org.eclipse.jdt.ui.tests.refactoring Index: resources/MoveInnerToTopLevel/test35/out/Inner.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test35/out/Inner.java,v retrieving revision 1.1 diff -u -r1.1 Inner.java --- resources/MoveInnerToTopLevel/test35/out/Inner.java 11 Nov 2005 10:23:59 -0000 1.1 +++ resources/MoveInnerToTopLevel/test35/out/Inner.java 28 Jul 2010 17:09:41 -0000 @@ -1,4 +1,6 @@ package p; + +// move to top class Inner { private String a; } \ No newline at end of file Index: resources/MoveInnerToTopLevel/test36/out/Inner.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test36/out/Inner.java,v retrieving revision 1.1 diff -u -r1.1 Inner.java --- resources/MoveInnerToTopLevel/test36/out/Inner.java 11 Nov 2005 10:23:59 -0000 1.1 +++ resources/MoveInnerToTopLevel/test36/out/Inner.java 28 Jul 2010 17:09:41 -0000 @@ -1,4 +1,6 @@ package p; + +// move to top class Inner { String b= A.SomeInner.a; Index: resources/MoveInnerToTopLevel/test_nonstatic_45/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_45/in/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_45/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_45/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,14 @@ +package p; + +class A { + /* + * A very important comment. + */ + + + + class B { + + } + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_45/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_45/out/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_45/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_45/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,12 @@ +package p; + +class A { + /* + * A very important comment. + */ + + + + + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_45/out/B.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_45/out/B.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_45/out/B.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_45/out/B.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +package p; +class B { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_46/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_46/in/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_46/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_46/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +package p; + +class A { + + class B { + + } + // A very important comment. + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_46/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_46/out/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_46/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_46/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,5 @@ +package p; + +class A { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_46/out/B.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_46/out/B.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_46/out/B.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_46/out/B.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,5 @@ +package p; +class B { + +} +// A very important comment. \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_47/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_47/in/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_47/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_47/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ +package p; + +class A { + + class B { + + } + + /** A very important comment.*/ + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_47/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_47/out/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_47/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_47/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,7 @@ +package p; + +class A { + + /** A very important comment.*/ + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_47/out/B.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_47/out/B.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_47/out/B.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_47/out/B.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +package p; +class B { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_48/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_48/in/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_48/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_48/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +package p; + +class A { + int i; + + + // comment in A + + // second comment in A + + // comment move to B + // second comment move to B + class B { + + } + /* comment move to B */ + /* second comment move to B */ + + /* comment in A */ + /* second comment in A */ + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_48/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_48/out/A.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_48/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_48/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +package p; + +class A { + int i; + + + // comment in A + + // second comment in A + + + /* comment in A */ + /* second comment in A */ + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_nonstatic_48/out/B.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_nonstatic_48/out/B.java diff -N resources/MoveInnerToTopLevel/test_nonstatic_48/out/B.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_nonstatic_48/out/B.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +package p; + +// comment move to B +// second comment move to B +class B { + +} +/* comment move to B */ +/* second comment move to B */ \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_10/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_10/in/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_10/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_10/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ +package p; +class A { + +} + +/* + * A very important comment. + */ +class Secondary { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_10/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_10/out/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_10/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_10/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +package p; +class A { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_10/out/Secondary.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_10/out/Secondary.java diff -N resources/MoveInnerToTopLevel/test_secondary_10/out/Secondary.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_10/out/Secondary.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +package p; + +/* + * A very important comment. + */ +class Secondary { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_11/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_11/in/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_11/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_11/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ +package p; + +class A { + +} + +class Secondary { + +} + + // A very important comment. \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_11/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_11/out/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_11/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_11/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,7 @@ +package p; + +class A { + +} + + // A very important comment. \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_11/out/Secondary.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_11/out/Secondary.java diff -N resources/MoveInnerToTopLevel/test_secondary_11/out/Secondary.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_11/out/Secondary.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +package p; +class Secondary { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_12/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_12/in/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_12/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_12/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +package p; + +class A { + +} + +class Secondary { + +} +/* A very important comment.*/ \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_12/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_12/out/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_12/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_12/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,5 @@ +package p; + +class A { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_12/out/Secondary.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_12/out/Secondary.java diff -N resources/MoveInnerToTopLevel/test_secondary_12/out/Secondary.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_12/out/Secondary.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,5 @@ +package p; +class Secondary { + +} +/* A very important comment.*/ \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_13/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_13/in/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_13/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_13/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,21 @@ +package p; +class A { + +} +// comment in A +// second comment in A + +/* + * comment move to Secondary + */ +/* Another comment move to Secondary*/ +class Secondary { + +} +/* + * comment move to Secondary + */ +/* Another comment move to Secondary*/ + +// comment in A +//second comment in A \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_13/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_13/out/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_13/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_13/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +package p; +class A { + +} +// comment in A +// second comment in A + +// comment in A +//second comment in A \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_13/out/Secondary.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_13/out/Secondary.java diff -N resources/MoveInnerToTopLevel/test_secondary_13/out/Secondary.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_13/out/Secondary.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,13 @@ +package p; + +/* + * comment move to Secondary + */ +/* Another comment move to Secondary*/ +class Secondary { + +} +/* + * comment move to Secondary + */ +/* Another comment move to Secondary*/ \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_9/in/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_9/in/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_9/in/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_9/in/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,12 @@ +package p; +class A { + +} + +/* + * A very important comment. + */ + +class Secondary { + +} \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_9/out/A.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_9/out/A.java diff -N resources/MoveInnerToTopLevel/test_secondary_9/out/A.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_9/out/A.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +package p; +class A { + +} + +/* + * A very important comment. + */ \ No newline at end of file Index: resources/MoveInnerToTopLevel/test_secondary_9/out/Secondary.java =================================================================== RCS file: resources/MoveInnerToTopLevel/test_secondary_9/out/Secondary.java diff -N resources/MoveInnerToTopLevel/test_secondary_9/out/Secondary.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/MoveInnerToTopLevel/test_secondary_9/out/Secondary.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +package p; +class Secondary { + +} \ No newline at end of file Index: test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java,v retrieving revision 1.61 diff -u -r1.61 MoveInnerToTopLevelTests.java --- test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java 21 May 2010 07:24:54 -0000 1.61 +++ test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java 28 Jul 2010 17:09:44 -0000 @@ -531,6 +531,22 @@ validatePassingTest("A", "Inner", "MoreInner", "p2", new String[]{"A"}, new String[]{"p2"}, "p", true, true, false, true); } + public void test_nonstatic_45() throws Exception { + validatePassingTest("A", "B", "p", new String[] { "A" }, new String[] { "p" }, null, false, true, false, false); + } + + public void test_nonstatic_46() throws Exception { + validatePassingTest("A", "B", "p", new String[] { "A" }, new String[] { "p" }, null, false, true, false, false); + } + + public void test_nonstatic_47() throws Exception { + validatePassingTest("A", "B", "p", new String[] { "A" }, new String[] { "p" }, null, false, true, false, false); + } + + public void test_nonstatic_48() throws Exception { + validatePassingTest("A", "B", "p", new String[] { "A" }, new String[] { "p" }, null, false, true, false, false); + } + public void testFail_nonstatic_0() throws Exception{ validateFailingTest("A", "Inner", new String[]{"A"}, new String[]{"p"}, "a", RefactoringStatus.ERROR); } @@ -594,4 +610,20 @@ public void test_secondary_8() throws Exception { validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A", "S", "T" }, new String[] { "p", "q", "q" }, null, false, false, false, false); } + + public void test_secondary_9() throws Exception { + validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false); + } + + public void test_secondary_10() throws Exception { + validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false); + } + + public void test_secondary_11() throws Exception { + validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false); + } + + public void test_secondary_12() throws Exception { + validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false); + } }