Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 431191

Summary: nameLookup#findType not reporting the closest match with secondary type switched on
Product: [Eclipse Project] JDT Reporter: shankha banerjee <shankhba>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact: Jay Arthanareeswaran <jarthana>
Severity: normal    
Priority: P3 CC: jarthana, manoj.palat, shankhba
Version: 4.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description shankha banerjee CLA 2014-03-26 01:47:37 EDT
Please consider the following test case:

--------------------------------------------------------------------------
public void test405026a() throws CoreException, IOException {
	try {
		JavaProject project = (JavaProject) createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5");
		String source = "package p;\n"  +
				"\n" +
				"public interface test13 {\n"  +
				"}\n"  +
				"\n"  +
				"/**\n" +
				" * @noreference\n"  +
				" */\n"  +
				"interface test13outer {}\n"  +
				"interface test13ou {}\n"  +
				"class Foo {}\n";
		createFolder("/P/src/p");
		createFile("/P/src/p/test13.java", source);
		waitForAutoBuild();
		IType itype = project.findType("p.test13");
		assertNotNull(itype);
		itype = project.findType("p.test13outer");
		assertNull("Should be a null", itype);

		ICompilationUnit[] workingCopy = new ICompilationUnit[1];
		workingCopy[0] = getWorkingCopy("/P/src/p/test13.java", source);
		NameLookup nameLookup = project.newNameLookup(workingCopy);

		IPackageFragment[] packageFragments = project.newNameLookup(workingCopy[0].getOwner()).findPackageFragments("p", false);
		assertNotNull(packageFragments[0]);


// ---------------------------  See Here -----------------------
		itype = nameLookup.findType("test13o", packageFragments[0], true, NameLookup.ACCEPT_ALL, true);
		assertEquals(itype.getElementName(), "test13ou");
// -------------------------------------------------------------
	} finally {
		deleteProject("P");
	}
}
----------------------------------------------------------------------------

You could use the test case in TypeResolveTests.java

itype = nameLookup.findType("test13o", packageFragments[0], true, NameLookup.ACCEPT_ALL, true);
		assertEquals(itype.getElementName(), "test13ou");

Should it return the closest match test13ou instead of test13outer.

Note: Secondrytypes is switched on.

Thanks
Comment 1 Eclipse Genie CLA 2020-02-12 18:05:10 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.