Bug 91078 - [search] Java search for package reference wrongly identifies inner class as package
Summary: [search] Java search for package reference wrongly identifies inner class as ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-12 01:42 EDT by Uwe Kubosch CLA
Modified: 2005-05-12 09:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Kubosch CLA 2005-04-12 01:42:23 EDT
Consider the following example:

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Example {
    private Map map = new HashMap();

    public void logAll() {
        for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            System.out.println(entry.getKey() + "->" + entry.getValue());
        }
    }
}

When selecting the class file and choosing Search->Java from the menu and entring 

pattern   : "*"
search for: package
limit to  : references
scope     : selected resources

Map.Entry is wrongly identified as a package.  It is a class.

This search is used in the Metrics project and causes confusion in the package
dependency analysis.

With kind regards,
Uwe Kubosch
Comment 1 Frederic Fusier CLA 2005-04-27 13:54:51 EDT
Fixed and released in HEAD.

Qualified type reference which does not include any package are now not reported
as match by search engine.

[jdt-core-internal]
Changes done in method matchReportReference(ASTNode,IJavaElement,Binding,int,
MatchLocator) of PackageReferenceLocator.
Test case added in JavaSearchBugsTests
Comment 2 Maxime Daniel CLA 2005-05-12 09:21:37 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.