Bug 95794 - [1.5][search] Search for all occurrences does not find references in static imports
Summary: [1.5][search] Search for all occurrences does not find references in static i...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-18 12:27 EDT by Tobias Widmer CLA
Modified: 2005-05-27 10:32 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 Tobias Widmer CLA 2005-05-18 12:27:21 EDT
N20050518-0010:

Steps to reproduce:
- Use following snippet

package pack;
import static pack.Test.Color.WHITE;
import static pack.Test.Color.BLACK;
public class Test {
    enum Color {WHITE, BLACK}
    Test there;
    public static void main(String[] args) {
        Color c = BLACK;
        switch(c) {
        case BLACK:
            System.out.println("Black");
            break;
        case WHITE:
            System.out.println("White");
            break;
        }
    }
}

-> Using Ctrl+H, search once for all occurrences of 'pack.Test' and once for 
references only.
-> Search result for reference search includes occurrences in static imports, 
whereas the all occurrence search does not
Comment 1 Frederic Fusier CLA 2005-05-19 08:36:19 EDT
Problem comes from OrLocator.matchLevelAndReportImportRef method (an occurences
types search uses an OrPattern made of TypeDeclarationPattern and
TypeReferencePattern).

This method needs to take into account import static reference as
matchLevelAndReportImportRef does in TypeReferenceLocator...
Comment 2 Frederic Fusier CLA 2005-05-19 11:02:45 EDT
*** Bug 95938 has been marked as a duplicate of this bug. ***
Comment 3 Frederic Fusier CLA 2005-05-19 11:25:26 EDT
forgot previous comment. bug 95938 is not a duplicate of this bug
Comment 4 Frederic Fusier CLA 2005-05-19 12:22:14 EDT
Fixed and released in HEAD.

Type references in static import are now also find with all occurrences.

[jdt-core internal]
Changes done in OrLocator.matchLevelAndReportImportRef method.

Test cases added in JavaSearchBugsTests
Comment 5 Olivier Thomann CLA 2005-05-27 10:32:50 EDT
Verified in I20050526-2000