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.
We need cross reference (xRef) infrastructure for find usages/rename features.
Start with API/SPI and prototype simple Impl for evaluation of code model possibilities and needed infrastructure changes
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
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
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
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
xRef is in-place