diff options
| author | Gayan Perera | 2021-07-06 18:43:07 +0000 |
|---|---|---|
| committer | Sarika Sinha | 2021-07-07 09:57:08 +0000 |
| commit | 4cb87a554926ffffff65f4d6c9e38453c31f6777 (patch) | |
| tree | 6fbcca1ad6f35015d5d442ed04d318cc695d0872 | |
| parent | 49c4e4a47440242e27a6571b325b5b0e585e9699 (diff) | |
| download | eclipse.jdt.debug-4cb87a554926ffffff65f4d6c9e38453c31f6777.tar.gz eclipse.jdt.debug-4cb87a554926ffffff65f4d6c9e38453c31f6777.tar.xz eclipse.jdt.debug-4cb87a554926ffffff65f4d6c9e38453c31f6777.zip | |
Bug 571310 - update tests for new lambda eval supportS4_21_0_M1I20210724-1800I20210723-1800I20210722-1800I20210721-1800I20210721-0530I20210720-1800I20210719-1800I20210718-1800I20210717-1800I20210716-1800I20210716-0020I20210715-2200I20210715-1800I20210714-1800I20210713-1800I20210712-1800I20210712-0340I20210712-0240I20210711-1800I20210710-1800I20210710-0000I20210709-0030I20210707-1800I20210707-0600
Update the FunctionalCaptureTest18 with all supported scenarios with
this fix. Add new debug tests to test the new support.
Change-Id: Iea00763c44b2fe0db14b02f304a279ddcd16c2a8
Signed-off-by: Gayan Perera <gayanper@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/182821
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Reviewed-by: Sarika Sinha <sarika.sinha@in.ibm.com>
4 files changed, 47 insertions, 4 deletions
diff --git a/org.eclipse.jdt.debug.tests/java8/Bug571310.java b/org.eclipse.jdt.debug.tests/java8/Bug571310.java new file mode 100644 index 000000000..6d0329c42 --- /dev/null +++ b/org.eclipse.jdt.debug.tests/java8/Bug571310.java @@ -0,0 +1,25 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +public class Bug571310 { + public static void main(String[] args) { + (new Bug571310()).run(); + } + + public void run() { + Stream.of("2") + .map(f -> this.selfAppend(f) + ".0") + .map(f -> this.appendDollar(f) + "0") + .forEach(System.out::print); + } + + public String selfAppend(String val) { + return val.concat(val); + } + + private String appendDollar(String val) { + return "$".concat(val); + } + +}
\ No newline at end of file diff --git a/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java b/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java index 1a35ce407..9dc34a256 100644 --- a/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java +++ b/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java @@ -114,13 +114,12 @@ public class FunctionalCaptureTest18 { /* Capture methods */ assertFunctionalExpression(s -> Integer.valueOf(s, 16), "0B", 11); - /* But not yet directlt on the instance */ assertFunctionalExpression(obj -> obj.publicMethod() + 7, this, 12); assertFunctionalExpression(obj -> this.publicMethod() + 8, this, 13); assertFunctionalExpression(obj -> publicMethod() + 8, this, 13); - assertFunctionalExpression(obj -> obj.privateMethod() + 8, this, 14);/* SKIP */ - assertFunctionalExpression(obj -> this.privateMethod() + 9, this, 15);/* SKIP */ - assertFunctionalExpression(obj -> privateMethod() + 9, this, 15);/* SKIP */ + assertFunctionalExpression(obj -> obj.privateMethod() + 8, this, 14); + assertFunctionalExpression(obj -> this.privateMethod() + 9, this, 15); + assertFunctionalExpression(obj -> privateMethod() + 9, this, 15); /* Constructor references */ assertFunctionalExpression(String::new, new char[] { 'a','b','c' }, "abc"); diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java index d8b5f63c7..685087aad 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java @@ -497,6 +497,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation cfgs.add(createLaunchConfiguration(jp, "Bug569413")); cfgs.add(createLaunchConfiguration(jp, "Bug573589")); cfgs.add(createLaunchConfiguration(jp, "Bug574395")); + cfgs.add(createLaunchConfiguration(jp, "Bug571310")); loaded18 = true; waitForBuild(); } diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java index 21ab19ad8..b332795e1 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java @@ -84,6 +84,24 @@ public class LambdaExpressionEvalTest extends AbstractDebugTest { } } + public void testBug571310_EvalLambdaWithPublicMethodInvocation_ExpectSuccessfulEval() throws Exception { + debugWithBreakpoint("Bug571310", 12); + resume(javaThread); + IValue value = doEval(javaThread, "this.selfAppend(f) + \".00\""); + + assertNotNull("value is null", value); + assertEquals("value is not 22.00", "22.00", value.getValueString()); + } + + public void testBug571310_EvalLambdaWithPrivateMethodInvocation_ExpectSuccessfulEval() throws Exception { + debugWithBreakpoint("Bug571310", 13); + resume(javaThread); + IValue value = doEval(javaThread, "this.appendDollar(f) + \"0\""); + + assertNotNull("value is null", value); + assertEquals("value is not $22.00", "$22.00", value.getValueString()); + } + private void debugWithBreakpoint(String testClass, int lineNumber) throws Exception { createLineBreakpoint(lineNumber, testClass); javaThread = launchToBreakpoint(testClass); |
