This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227607

Summary: Add ClassIndex.getDeclaredSymbols
Product: java Reporter: Jan Lahoda <jlahoda>
Component: SourceAssignee: apireviews <apireviews>
Status: RESOLVED FIXED    
Severity: normal Keywords: API, API_REVIEW_FAST
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 226064    
Attachments: Proposed API change.

Description Jan Lahoda 2013-03-18 11:36:04 UTC
Our ClassIndex is currently able to find all symbols (methods, contructors and fields) for a given simple name (or prefix/regexp of thereof). But there is not API method to invoke that functionality outside of java.source. I am proposing to add such a method (ClassIndex.getDeclaredSymbols), so that we can implement import resolution also for static imports.
Comment 1 Jan Lahoda 2013-03-18 11:36:49 UTC
Created attachment 132747 [details]
Proposed API change.
Comment 2 Jan Lahoda 2013-03-18 11:37:20 UTC
Please review. Thanks.
Comment 3 Tomas Zezula 2013-03-27 11:47:29 UTC
Seems Ok to me.
One possible change regarding the future inclusion of the full index which will introduce a new method like getSymbols(). If the getDeclaredSymbols() is changed to getSymbols(...,SymbolKind) where

enum SymbolKind {
      DECLARED
} 

the API can be extended to full index by just adding ALL to SymbolKind.
Comment 4 Jan Lahoda 2013-03-28 15:20:08 UTC
I think having a separate method for full text index would be better, so several reasons. First, it may not be appropriate to have it in ClassIndex/java.source. Second, the current getDeclaredSymbol returns ElementHandles containing a sub-element with the given name. For full text index, we will likely want to return FileObjects rather than ElementHandles.

Integrated:
http://hg.netbeans.org/jet-main/rev/69b858bd531b