Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 429738 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs8Tests.java (+29 lines)
Lines 155-160 Link Here
155
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0028"));
155
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0028"));
156
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0029"));
156
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0029"));
157
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0030"));
157
	suite.addTest(new JavaSearchBugs8Tests("testBug400905_0030"));
158
	suite.addTest(new JavaSearchBugs8Tests("testBug429738"));
158
	return suite;
159
	return suite;
159
}
160
}
160
class TestCollector extends JavaSearchResultCollector {
161
class TestCollector extends JavaSearchResultCollector {
Lines 3530-3535 Link Here
3530
	search(this.workingCopies[0].getType("Y").getType("Z").getMethod("goo", new String[] { "I" }), IMPLICIT_THIS_REFERENCE);
3531
	search(this.workingCopies[0].getType("Y").getType("Z").getMethod("goo", new String[] { "I" }), IMPLICIT_THIS_REFERENCE);
3531
	assertSearchResults("");
3532
	assertSearchResults("");
3532
}
3533
}
3534
/**
3535
 * @bug 429738
3536
 * @test test finds Declarations (Ctrl + G) for type-less lambda parameter.
3537
 *		
3538
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=429738"
3539
 * 
3540
 */
3541
public void testBug429738() throws CoreException {
3542
	String buffer = "interface Foo {\n" +
3543
			"	int foo(int x);\n" +
3544
			"}\n" +
3545
			"public class X {\n" +
3546
			"	// Select 'x' and press Ctrl+G.\n" +
3547
			"	Foo f1 = x -> x;\n" +
3548
			"}\n";
3549
3550
	this.workingCopies = new ICompilationUnit[1];
3551
	this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b429738/X.java", buffer);
3552
	IType type = this.workingCopies[0].getType("X");
3553
	int start = buffer.indexOf("x;");
3554
	IJavaElement[] elements = this.workingCopies[0].codeSelect(start, 1);
3555
	assertEquals("Incorrect no of elements", 1, elements.length);
3556
	assertEquals("Incorrect element type", IJavaElement.LOCAL_VARIABLE, elements[0].getElementType());
3557
	search(elements[0],DECLARATIONS);
3558
	assertSearchResults(
3559
			"src/b429738/X.java int b429738.X.f1:Lambda(Foo).foo(int).x [x] EXACT_MATCH"
3560
	);	
3561
}
3533
// Add new tests in JavaSearchBugs8Tests
3562
// Add new tests in JavaSearchBugs8Tests
3534
}
3563
}
3535
3564
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java (+5 lines)
Lines 665-670 Link Here
665
	}
665
	}
666
}
666
}
667
667
668
protected void consumeTypeElidedLambdaParameter(boolean parenthesized) {
669
	super.consumeTypeElidedLambdaParameter(parenthesized);
670
	this.patternLocator.match((LocalDeclaration) this.astStack[this.astPtr], this.nodeSet);
671
}
672
668
protected void consumeTypeParameter1WithExtends() {
673
protected void consumeTypeParameter1WithExtends() {
669
	super.consumeTypeParameter1WithExtends();
674
	super.consumeTypeParameter1WithExtends();
670
	if ((this.patternFineGrain & IJavaSearchConstants.TYPE_VARIABLE_BOUND_TYPE_REFERENCE) != 0) {
675
	if ((this.patternFineGrain & IJavaSearchConstants.TYPE_VARIABLE_BOUND_TYPE_REFERENCE) != 0) {

Return to bug 429738