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 - Add ClassIndex.getDeclaredSymbols
Summary: Add ClassIndex.getDeclaredSymbols
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 226064
  Show dependency tree
 
Reported: 2013-03-18 11:36 UTC by Jan Lahoda
Modified: 2013-03-28 15:20 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed API change. (9.09 KB, patch)
2013-03-18 11:36 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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