-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inlining method with anonymous class and qualified this reference (…
…#1799) * Fix inlining method with anonymous class and qualified this reference - fix SourceAnalyzer to denote a qualified this receiver if the qualifier is a type and also to not denote an anonymous class instantiation for implicit receiver - add new test to InlineMethodTests - fixes #1780
- Loading branch information
Showing
4 changed files
with
61 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
22 changes: 22 additions & 0 deletions
22
...resources/InlineMethodWorkspace/TestCases/receiver_in/TestQualifiedAnonymousReceiver.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,22 @@ | ||
package receiver_in; | ||
|
||
public class TestQualifiedAnonymousReceiver { | ||
int x = 10; | ||
|
||
void superClassMethod() { | ||
System.out.println(x); | ||
} | ||
|
||
static void callingMethod(TestQualifiedAnonymousReceiver instance) { | ||
/*]*/instance.methodToBeInlined();/*[*/ | ||
} | ||
|
||
void methodToBeInlined() { | ||
int k = 0; | ||
new Object() { | ||
void execute() { | ||
TestQualifiedAnonymousReceiver.this.superClassMethod(); | ||
} | ||
}.execute(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...esources/InlineMethodWorkspace/TestCases/receiver_out/TestQualifiedAnonymousReceiver.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,27 @@ | ||
package receiver_out; | ||
|
||
public class TestQualifiedAnonymousReceiver { | ||
int x = 10; | ||
|
||
void superClassMethod() { | ||
System.out.println(x); | ||
} | ||
|
||
static void callingMethod(TestQualifiedAnonymousReceiver instance) { | ||
/*]*/int k = 0; | ||
new Object() { | ||
void execute() { | ||
instance.superClassMethod(); | ||
} | ||
}.execute();/*[*/ | ||
} | ||
|
||
void methodToBeInlined() { | ||
int k = 0; | ||
new Object() { | ||
void execute() { | ||
TestQualifiedAnonymousReceiver.this.superClassMethod(); | ||
} | ||
}.execute(); | ||
} | ||
} |
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