-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use strict patterns for synthetic methods inline (#1829)
- Loading branch information
Showing
4 changed files
with
129 additions
and
2 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
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
61 changes: 61 additions & 0 deletions
61
jadx-core/src/test/java/jadx/tests/integration/java8/TestLambdaReturn.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,61 @@ | ||
package jadx.tests.integration.java8; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.tests.api.IntegrationTest; | ||
import jadx.tests.api.extensions.profiles.TestProfile; | ||
import jadx.tests.api.extensions.profiles.TestWithProfiles; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
public class TestLambdaReturn extends IntegrationTest { | ||
|
||
@SuppressWarnings("unused") | ||
public static class TestCls { | ||
interface Function0<R> { | ||
R apply(); | ||
} | ||
|
||
public static class T2 { | ||
public long l; | ||
|
||
public T2(long l) { | ||
this.l = l; | ||
} | ||
|
||
public void w() { | ||
} | ||
} | ||
|
||
public Byte test(Byte b1) { | ||
Function0<Void> f1 = () -> { | ||
new T2(94L).w(); | ||
return null; | ||
}; | ||
f1.apply(); | ||
return null; | ||
} | ||
} | ||
|
||
@TestWithProfiles(TestProfile.DX_J8) | ||
public void test() { | ||
assertThat(getClassNode(TestCls.class)) | ||
.code() | ||
.containsLines(2, | ||
"Function0<Void> f1 = () -> {", | ||
indent() + "new T2(94L).w();", | ||
indent() + "return null;", | ||
"};"); | ||
} | ||
|
||
@TestWithProfiles(TestProfile.D8_J11_DESUGAR) | ||
public void testLambda() { | ||
getClassNode(TestCls.class); | ||
} | ||
|
||
@Test | ||
public void testNoDebug() { | ||
noDebugInfo(); | ||
getClassNode(TestCls.class); | ||
} | ||
} |