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 107691 - xRef infrastructure
Summary: xRef infrastructure
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-21 17:25 UTC by Vladimir Voskresensky
Modified: 2008-08-30 18:34 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2007-06-21 17:25:16 UTC
We need cross reference (xRef) infrastructure for find usages/rename features.
Comment 1 Vladimir Voskresensky 2007-06-21 17:26:57 UTC
Start with API/SPI and prototype simple Impl for evaluation of code model possibilities and needed infrastructure changes
Comment 2 Vladimir Voskresensky 2007-06-21 17:32:24 UTC
reference object presents the placement in file where model object was found.
we have resolver to find reference for position in file
we have repository to find all references of interested model's object

reference object itself could be not the part of code model, but it is the connection between token written in file and
code model object

cvs log:
Checking in modelapi/src/org/netbeans/modules/cnd/api/model/CsmReference.java;
/shared/data/ccvs/repository/cnd/modelapi/src/org/netbeans/modules/cnd/api/model/Attic/CsmReference.java,v  <-- 
CsmReference.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file:
/shared/data/ccvs/repository/cnd/modelservices/src/org/netbeans/modules/cnd/api/model/xref/Attic/CsmReferenceResolver.java,v
done
Checking in modelservices/src/org/netbeans/modules/cnd/api/model/xref/CsmReferenceResolver.java;
/shared/data/ccvs/repository/cnd/modelservices/src/org/netbeans/modules/cnd/api/model/xref/Attic/CsmReferenceResolver.java,v
 <--  CsmReferenceResolver.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file:
/shared/data/ccvs/repository/cnd/modelservices/src/org/netbeans/modules/cnd/api/model/xref/Attic/CsmReferenceRepository.java,v
done
Checking in modelservices/src/org/netbeans/modules/cnd/api/model/xref/CsmReferenceRepository.java;
/shared/data/ccvs/repository/cnd/modelservices/src/org/netbeans/modules/cnd/api/model/xref/Attic/CsmReferenceRepository.java,v
 <--  CsmReferenceRepository.java
new revision: 1.1.2.1; previous revision: 1.1
done
Comment 3 Vladimir Voskresensky 2007-06-29 19:07:16 UTC
tests for xRef infrastructure
- each file of project is checked
- each identifier in document is tryting to be resolved
- owner and referenced objects are traced
- trace is compared with golden files for each input file
Comment 4 Vladimir Voskresensky 2007-07-09 14:13:59 UTC
command line utility is prepared.
to use it make sure, that tests for core are built (there are needed DataLoaders are registered)
then use tracemodel script with special flag --xref:
$./tracemodel.sh "--xref#Quote/disk.cc#24#18" Quote
too look for object first and then references

or to find object by unique name
$./tracemodel.sh "--xref#C:Cpu" Quote

some helpfull flags for tracemodel:
-J-Dcnd.modelimpl.trace.xref.repository=true -t 

Comment 5 Vladimir Voskresensky 2007-07-09 17:42:19 UTC
Status: prototype is done.

Summary:
- looking for usage of word under cursor in Quote takes 1-3 sec
- looking for usage of word under cursor in MySQL with profiler penalty takes 300sec

Details:
- infrastructure is able to resolve elements in files/documents for specified position
-- service is used by hyperlink feature
-- service is used by "Inspect Hierarchy" feature
- infrastructure is able to find references/declarations/definitions of specified model object
- any object potentially could be found in project (no restriction by kinds). Results depend on accuracy of references
resolving. For simple project like Quote 5% of identifiers is not resolved

Known restrictions:
- the model elements created by expanding macros are not analyzed (=> Lucene should have poor accuracy)
- nothing is cached, all project files are analyzed

Performance details (from YourKit):
- mysql takes 300sec with following distributions:
-- look for object under cursor - 11 sec
-- "grep" all project files by name - 256 sec
-- resolve list of candidate-positions - 33 sec
=> having indexed dictionary of the project "search" itself takes 44 sec (35 of them is getting object from repository)

Accuracy:
- for Quote accuracy is about 85%
- for MySQL is not known

How to see working prototype in IDE:
-- test action "Find Usages" is added to context menu in editor with output to stderr
Comment 6 Vladimir Voskresensky 2008-08-30 18:34:25 UTC
xRef is in-place