-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for extracting method to outer class (#1479)
- add new findFieldReferencesForType() method to ExtractMethodAnalyzer to find field references in the inner type where selection is made - add new logic to ExtractMethodRefactoring to recognize a move to an outer class where fields are referenced in inner in which case pass an extra parameter of the inner type and qualify any field references using this extra parameter - add new test to ExtractMethodTests - fixes #1458
- Loading branch information
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
....refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/nested_in/A_test655.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package nested_in; | ||
|
||
public class A_test655 { | ||
public static class NestedStatic { | ||
private int i= 0; | ||
|
||
public void foo() { | ||
/*[*/System.out.println("Greetings" + ++i);/*]*/ | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/nested_out/A_test655.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package nested_in; | ||
|
||
public class A_test655 { | ||
public static class NestedStatic { | ||
private int i= 0; | ||
|
||
public void foo() { | ||
extracted(this); | ||
} | ||
} | ||
|
||
protected static void extracted(NestedStatic passedNestedStatic) { | ||
/*[*/System.out.println("Greetings" + ++passedNestedStatic.i);/*]*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters