Community
Participate
Working Groups
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
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...
*** Bug 95938 has been marked as a duplicate of this bug. ***
forgot previous comment. bug 95938 is not a duplicate of this bug
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
Verified in I20050526-2000