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

Bug 337563

Summary: IType#resolveType(String) on binary type with attached source doesn't find imported type
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, manju656, markus.kell.r, noopur_gupta
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dani Megert CLA 2011-02-18 08:39:02 EST
N20110217-2000.

1. import 'org.eclipse.core.resource' as binary
2. open 'org.eclipse.core.resources.IFileModificationValidator'
3. hover over the type declaration (IFileModificationValidator)
4. in the Javadoc click on the link 'FileModificationValidator'
==> nothing happens.
Comment 1 Markus Keller CLA 2011-02-18 10:35:55 EST
That's because IType#resolveType(String) doesn't find the typeName "FileModificationValidator" on the IType IFileModificationValidator.

You can also reproduce this in the JavaElement view when you focus on FileModificationValidator and then use context menu > resolveType(String)... . Works fine if I pass the fully-qualified name "org.eclipse.core.resources.team.FileModificationValidator".

The problem could be that FileModificationValidator.class doesn't need to contain the IFileModificationValidator type at all, since it is only referenced in Javadoc.
Comment 2 Noopur Gupta CLA 2013-06-25 07:27:08 EDT
Encountered the same issue in the following case also:
1. Open 'org.eclipse.core.runtime.Preferences' as .class file
2. Hover over the type declaration (Preferences)
3. In the Javadoc, click on the link 'IEclipsePreferences'
==> nothing happens.

The fix is probably to remove the workaround in org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks#resolveType(IType, String), see bug 206597.
Comment 3 Markus Keller CLA 2013-06-25 08:24:11 EDT
(In reply to comment #2)
> The fix is probably to remove the workaround in
> org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks#resolveType(IType,
> String), see bug 206597.

Sorry, I suggested this, but that's not actually the problem. That method already calls IType#resolveType(String) first.

The problem is that bug 206597 was not resolved completely. IType#resolveType(String) still doesn't seem to consider imports from attached source when we pass a simple name that has been imported. Adapted bug summary.
Comment 4 Markus Keller CLA 2014-05-06 11:19:25 EDT

*** This bug has been marked as a duplicate of bug 245689 ***