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

(-)model/org/eclipse/jdt/internal/core/SelectionRequestor.java (-2 / +2 lines)
Lines 723-729 Link Here
723
			false);
723
			false);
724
		// iterate type lookup in each package fragment
724
		// iterate type lookup in each package fragment
725
		for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
725
		for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
726
			type= this.nameLookup.findType(new String(typeName), pkgs[i], false, acceptFlags);
726
			type= this.nameLookup.findType(new String(typeName), pkgs[i], false, acceptFlags, true/*consider secondary types*/);
727
			if (type != null) break;	
727
			if (type != null) break;	
728
		}
728
		}
729
		if (type == null) {
729
		if (type == null) {
Lines 803-809 Link Here
803
			false);
803
			false);
804
		// iterate type lookup in each package fragment
804
		// iterate type lookup in each package fragment
805
		for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
805
		for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
806
			type= this.nameLookup.findType(new String(typeName), pkgs[i], false, acceptFlags);
806
			type= this.nameLookup.findType(new String(typeName), pkgs[i], false, acceptFlags, true/*consider secondary types*/);
807
			if (type != null) break;	
807
			if (type != null) break;	
808
		}
808
		}
809
		if (type == null) {
809
		if (type == null) {
(-)model/org/eclipse/jdt/internal/core/NameLookup.java (+7 lines)
Lines 579-584 Link Here
579
	 * @see #ACCEPT_ENUMS
579
	 * @see #ACCEPT_ENUMS
580
	 * @see #ACCEPT_ANNOTATIONS
580
	 * @see #ACCEPT_ANNOTATIONS
581
	 */
581
	 */
582
	public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes) {
583
		IType type = findType(name, pkg, partialMatch, acceptFlags);
584
		if (type == null && considerSecondaryTypes) {
585
			type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), false, null);
586
		}
587
		return type;
588
	}
582
	public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags) {
589
	public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags) {
583
		if (pkg == null) return null;
590
		if (pkg == null) return null;
584
591
(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-1 / +1 lines)
Lines 1278-1284 Link Here
1278
		acceptFlag = NameLookup.ACCEPT_CLASSES;
1278
		acceptFlag = NameLookup.ACCEPT_CLASSES;
1279
	}
1279
	}
1280
	for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
1280
	for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
1281
		IType type = this.nameLookup.findType(typeName, pkgs[i],  false,  acceptFlag);
1281
		IType type = this.nameLookup.findType(typeName, pkgs[i],  false,  acceptFlag, true/*consider secondary types*/);
1282
		if (type != null) return type;
1282
		if (type != null) return type;
1283
	}
1283
	}
1284
1284
(-)src/org/eclipse/jdt/core/tests/model/ResolveTests.java (-6 / +21 lines)
Lines 19-31 Link Here
19
	ICompilationUnit wc = null;
19
	ICompilationUnit wc = null;
20
	WorkingCopyOwner owner = null; 
20
	WorkingCopyOwner owner = null; 
21
21
22
static {
23
//	TESTS_NAMES = new String[] { "testSecondaryTypes" };
24
}
22
public static Test suite() {
25
public static Test suite() {
23
	if (false) {
26
	return buildTestSuite(ResolveTests.class);
24
		TestSuite suite = new Suite(ResolveTests.class.getName());
25
		suite.addTest(new ResolveTests("testLocalNameForClassFile"));
26
		return suite;
27
	}
28
	return new Suite(ResolveTests.class);
29
}
27
}
30
28
31
public ResolveTests(String name) {
29
public ResolveTests(String name) {
Lines 1620-1623 Link Here
1620
		}
1618
		}
1621
	}
1619
	}
1622
}
1620
}
1621
/**
1622
 * Bug 120350: [model] Secondary type not found by code resolve
1623
 * @throws JavaModelException
1624
 */
1625
public void testSecondaryTypes() throws JavaModelException {
1626
	waitUntilIndexesReady();
1627
	ICompilationUnit cu = getCompilationUnit("Resolve", "src", "b120350", "X.java");
1628
	String str = cu.getSource();
1629
	int start = str.indexOf("Secondary");
1630
	int length = "Secondary".length();
1631
	IJavaElement[] elements = cu.codeSelect(start, length);
1632
	assertElementsEqual(
1633
		"Unexpected elements",
1634
		"Secondary [in Test.java [in b120350 [in src [in Resolve]]]]",
1635
		elements
1636
	);
1637
}
1623
}
1638
}
(-)workspace/Resolve/src/b120350/X.java (+1 lines)
Added Link Here
1
public class X extends Secondary {}
(-)workspace/Resolve/src/b120350/Test.java (+3 lines)
Added Link Here
1
public class Test {
2
}
3
class Secondary {}

Return to bug 120350