-
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.
Fix pull up scenario referring to outer this type (#1854)
- modify PullUpRefactoring.CheckInvalidOuterFieldAccess checker to also look for class.this references that won't be accessible after pulling up the method - add new test to PullUpTests - fixes #1823
- Loading branch information
Showing
3 changed files
with
57 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
org.eclipse.jdt.ui.tests.refactoring/resources/PullUp/testFail37/in/A.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,24 @@ | ||
package p; | ||
|
||
public class A { | ||
public class BaseInner { | ||
void innerMethodLambda(Outer outer) { | ||
Runnable r = () -> { | ||
System.out.println(outer.x); | ||
outer.foo(); | ||
}; | ||
r.run(); | ||
} | ||
} | ||
|
||
public class Outer { | ||
public int x = 0; | ||
public void foo(){}; | ||
|
||
public class Inner extends BaseInner { | ||
void innerMethod() { // Pull this method up to class BaseInner | ||
innerMethodLambda(Outer.this); | ||
} | ||
} | ||
} | ||
} |
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