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 252992 - Get binary resources from ClassIndex
Summary: Get binary resources from ClassIndex
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Ralph Ruijs
URL: http://wiki.netbeans.org/FindUsagesDe...
Keywords: API, API_REVIEW_FAST
Depends on: 253353
Blocks: 55291
  Show dependency tree
 
Reported: 2015-06-15 07:42 UTC by Ralph Ruijs
Modified: 2015-07-08 09:51 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Ruijs 2015-06-15 07:42:51 UTC
To support Find usages in Dependencies, we need a way to get all resources from the ClassIndex.

ClassIndex returns a set of source files containing reference(s) to given type element. If the source file is not found in one of the sourceroots, it will fallback to the binaryroots.
Comment 1 Ralph Ruijs 2015-06-15 07:48:50 UTC
Please review the apichange on the find-in-dependencies branch.

api:
  http://hg.netbeans.org/jet-main/rev/48a472537592

impl:
  http://hg.netbeans.org/jet-main/rev/4132bb5a8a0d
Comment 2 Tomas Zezula 2015-06-16 13:36:58 UTC
TCA: The CI.getResources(...,sources) method may break project types like freeform. I will fix this.

TCR: The sources parameter is strange.
<cite>@param sources true if references should be from a source root</cite>
otherwise from what?

TCA: boolean API parameter is evil, related ti previous TCR. Consider to use Set<ResourceType> where enum ResourceType {SOURCE, BINARY}. There is already similar ClassIndexImpl.Type.

TCR: Is the method needed at all?
What the UI will do with usages for which the source is not found. The usage just tells that given class uses the type but it's unknown where and how many times the type is used (quite different from current Find Usages View).
Comment 3 Ralph Ruijs 2015-06-22 10:39:10 UTC
(In reply to Tomas Zezula from comment #2)
> TCA: The CI.getResources(...,sources) method may break project types like
> freeform. I will fix this.

Thanks!

> TCR: The sources parameter is strange.
> <cite>@param sources true if references should be from a source root</cite>
> otherwise from what?
> 
> TCA: boolean API parameter is evil, related ti previous TCR. Consider to use
> Set<ResourceType> where enum ResourceType {SOURCE, BINARY}. There is already
> similar ClassIndexImpl.Type.

Added ResourceType enum to ClassIndex and updated the calls to it.
http://hg.netbeans.org/jet-main/shortlog/9237e9736f51

> TCR: Is the method needed at all?
> What the UI will do with usages for which the source is not found. The usage
> just tells that given class uses the type but it's unknown where and how
> many times the type is used (quite different from current Find Usages View).

Yes :-) Knowing something is used and from which library/class gives a lot of information. It is different from the current Find Usages view as there are no class files in a project's source root. Adding support for dependencies changes this, as there are normally only class files in a dependency.
Comment 4 Ralph Ruijs 2015-06-24 08:10:11 UTC
Any more comments on the two TCRs? I'd like to integrate tomorrow. Thanks!
Comment 5 Tomas Zezula 2015-06-24 13:01:05 UTC
Thanks Ralph.
Fine for me, feel free to integrate.
Comment 6 Ralph Ruijs 2015-06-27 10:29:32 UTC
Fixed in jet-main 3384f2391053 & 6ee6524fa347
Comment 7 Quality Engineering 2015-06-30 01:21:14 UTC
Integrated into 'main-silver', will be available in build *201506300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6ee6524fa347
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #252992 - Get binary resources from ClassIndex