View | Details | Raw Unified | Return to bug 569413
Collapse All | Expand All

(-)a/org.eclipse.jdt.debug.tests/java8/Bug569413.java (+40 lines)
Added Link Here
1
import java.util.Arrays;
2
import java.util.HashMap;
3
import java.util.HashSet;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.Set;
7
8
public class Bug569413 {
9
10
	public static void main(String[] args) {
11
		new Bug569413().test();
12
	}
13
14
	List<TestClass> packageProcessors = Arrays.asList(new TestClass());
15
	Map<String, TestClass> basePackages = new HashMap<>();
16
17
	void test() {
18
		// no Working for 'p'
19
		packageProcessors.forEach(pp -> {
20
			pp.getPackagesToMap().forEach(p -> {
21
				basePackages.put(p, pp); // breakpoint here, expression for p
22
			});
23
		});
24
25
		// Working for 'p'
26
		packageProcessors.forEach(pp -> {
27
			pp.getPackagesToMap().forEach(p -> {
28
				basePackages.put(p, null); // breakpoint here, expression for p
29
			});
30
		});
31
	}
32
33
	static class TestClass {
34
35
		public Set<String> getPackagesToMap() {
36
			return new HashSet<>(Arrays.asList("ab", "b", "c"));
37
		}
38
39
	}
40
}
(-)a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java (+1 lines)
Lines 492-497 Link Here
492
				cfgs.add(createLaunchConfiguration(jp, "Bug564801"));
492
				cfgs.add(createLaunchConfiguration(jp, "Bug564801"));
493
				cfgs.add(createLaunchConfiguration(jp, "Bug567801"));
493
				cfgs.add(createLaunchConfiguration(jp, "Bug567801"));
494
				cfgs.add(createLaunchConfiguration(jp, "Bug571230"));
494
				cfgs.add(createLaunchConfiguration(jp, "Bug571230"));
495
				cfgs.add(createLaunchConfiguration(jp, "Bug569413"));
495
	    		loaded18 = true;
496
	    		loaded18 = true;
496
	    		waitForBuild();
497
	    		waitForBuild();
497
	        }
498
	        }
(-)a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java (+3 lines)
Lines 36-41 Link Here
36
import org.eclipse.jdt.debug.tests.eval.IntOperatorsTests;
36
import org.eclipse.jdt.debug.tests.eval.IntOperatorsTests;
37
import org.eclipse.jdt.debug.tests.eval.Java8Tests;
37
import org.eclipse.jdt.debug.tests.eval.Java8Tests;
38
import org.eclipse.jdt.debug.tests.eval.LabelTests;
38
import org.eclipse.jdt.debug.tests.eval.LabelTests;
39
import org.eclipse.jdt.debug.tests.eval.LambdaNestedVariableTest;
39
import org.eclipse.jdt.debug.tests.eval.LocalVarAssignmentTests;
40
import org.eclipse.jdt.debug.tests.eval.LocalVarAssignmentTests;
40
import org.eclipse.jdt.debug.tests.eval.LocalVarValueTests;
41
import org.eclipse.jdt.debug.tests.eval.LocalVarValueTests;
41
import org.eclipse.jdt.debug.tests.eval.LongAssignmentOperatorsTests;
42
import org.eclipse.jdt.debug.tests.eval.LongAssignmentOperatorsTests;
Lines 238-243 Link Here
238
239
239
		addTest(new TestSuite(DebugShellVariableTests.class));
240
		addTest(new TestSuite(DebugShellVariableTests.class));
240
241
242
		addTest(new TestSuite(LambdaNestedVariableTest.class));
243
241
	}
244
	}
242
245
243
	/**
246
	/**
(-)a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaNestedVariableTest.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2020 Gayan Perera and others.
3
 *
4
 * This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License 2.0
6
 * which accompanies this distribution, and is available at
7
 * https://www.eclipse.org/legal/epl-2.0/
8
 *
9
 * SPDX-License-Identifier: EPL-2.0
10
 *
11
 *******************************************************************************/
12
package org.eclipse.jdt.debug.tests.eval;
13
14
import org.eclipse.debug.core.model.IValue;
15
import org.eclipse.jdt.core.IJavaProject;
16
import org.eclipse.jdt.debug.core.IJavaThread;
17
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
18
19
public class LambdaNestedVariableTest extends AbstractDebugTest {
20
21
	@Override
22
	protected IJavaProject getProjectContext() {
23
		return get18Project();
24
	}
25
26
	public LambdaNestedVariableTest(String name) {
27
		super(name);
28
	}
29
30
	public void testEvaluate_LambdaCapturedParameter() throws Exception {
31
		IJavaThread thread = null;
32
		try {
33
			String type = "Bug569413";
34
			createLineBreakpoint(21, type);
35
			thread = launchToBreakpoint(type);
36
37
			IValue value = doEval(thread, "p");
38
			assertEquals("wrong type : ", "java.lang.String", value.getReferenceTypeName());
39
			assertEquals("wrong result : ", "ab", value.getValueString());
40
41
			assertNotNull("The program did not suspend", thread);
42
		} finally {
43
			removeAllBreakpoints();
44
			terminateAndRemove(thread);
45
		}
46
	}
47
48
	public void testEvaluate_LambdaCapturedParameterAndNull() throws Exception {
49
		IJavaThread thread = null;
50
		try {
51
			String type = "Bug569413";
52
			createLineBreakpoint(28, type);
53
			thread = launchToBreakpoint(type);
54
55
			IValue value = doEval(thread, "p");
56
			assertEquals("wrong type : ", "java.lang.String", value.getReferenceTypeName());
57
			assertEquals("wrong result : ", "ab", value.getValueString());
58
59
			assertNotNull("The program did not suspend", thread);
60
		} finally {
61
			removeAllBreakpoints();
62
			terminateAndRemove(thread);
63
		}
64
	}
65
66
}

Return to bug 569413