-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix lambdas in anonymous classes referencing parameters from the root…
… method (#423) * Fix lambdas in anonymous classes referencing parameters from the root method * Update test
- Loading branch information
Showing
4 changed files
with
51 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pkg; | ||
|
||
public class TestAnonymousClassToLambda { | ||
public Object test1(final Object o) { | ||
return new Object() {// 5 | ||
public Runnable getRunnable() { | ||
return () -> System.out.println(o);// 7 | ||
} | ||
}; | ||
} | ||
} | ||
|
||
class 'pkg/TestAnonymousClassToLambda' { | ||
method 'test1 (Ljava/lang/Object;)Ljava/lang/Object;' { | ||
9 4 | ||
} | ||
} | ||
|
||
class 'pkg/TestAnonymousClassToLambda$1' { | ||
method 'getRunnable ()Ljava/lang/Runnable;' { | ||
9 6 | ||
} | ||
|
||
method 'lambda$getRunnable$0 (Ljava/lang/Object;)V' { | ||
0 6 | ||
1 6 | ||
2 6 | ||
3 6 | ||
4 6 | ||
5 6 | ||
6 6 | ||
7 6 | ||
} | ||
} | ||
|
||
Lines mapping: | ||
5 <-> 5 | ||
7 <-> 7 |
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 pkg; | ||
|
||
public class TestAnonymousClassToLambda { | ||
public Object test1(Object o) { | ||
return new Object() { | ||
public Runnable getRunnable() { | ||
return () -> System.out.println(o); | ||
} | ||
}; | ||
} | ||
} |