Bug 95794

Summary: [1.5][search] Search for all occurrences does not find references in static imports
Product: [Eclipse Project] JDT Reporter: Tobias Widmer <tobias_widmer>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 RC1   
Hardware: PC   
OS: All   
Whiteboard:

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