mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-152851 Extract Method Object: incompilable result in case of this and super and anonymous class creation
This commit is contained in:
+1
@@ -439,6 +439,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
|
||||
|
||||
final PsiCodeBlock methodBody = getMethod().getBody();
|
||||
LOG.assertTrue(methodBody != null);
|
||||
adjustTargetClassReferences(methodBody);
|
||||
return myElementFactory.createExpressionFromText("new Object(){ \n" +
|
||||
"private " +
|
||||
returnType.getPresentableText() +
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
public class XXX extends Base {
|
||||
int x = 5;
|
||||
|
||||
public void con<caret>text() {
|
||||
int a = this.x;
|
||||
int b = super.y;
|
||||
}
|
||||
}
|
||||
|
||||
class Base {
|
||||
int y = 7;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
public class XXX extends Base {
|
||||
int x = 5;
|
||||
|
||||
public void context() {
|
||||
new Object() {
|
||||
private void InnerClass() {
|
||||
int a = XXX.this.x;
|
||||
int b = XXX.super.y;
|
||||
}
|
||||
}.InnerClass();
|
||||
}
|
||||
}
|
||||
|
||||
class Base {
|
||||
int y = 7;
|
||||
}
|
||||
@@ -138,6 +138,10 @@ public class ExtractMethodObjectTest extends LightRefactoringTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testThisAndSuperAnon() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testWithPrivateMethodWhichCantBeMoved() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user