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.
Right clicking on methods such as clone() or toString() in any class that implements them, then selecting "Find usages", the clicking "Find" button, causes Netbeans6.0Beta2 CPU usage to spike to 100% according to "top" (normal finds are 30-40% on my machine). The progress bar never pops up in the search window, and the find never finishes. Pressing the "cancel" button causes the search window to disappear, but CPU usage remains high according to top and jconsole so the search thread is obviously still busy spinning madly. Worse, right clicking anywhere in the editor window for that or any other class after this has occured causes Netbeans to hang completely (no redraw), and it must be killed from console. Same thing with closing Netbeans after cancelling the problematic find, the Netbeans process still remains and must be killed manually. I had been adding @Override annotation to methods, and it was after doing "Find usages" on one of them that I found this bug. Removing the annotation did not change anything though. The following I found in the log, but I don't know if it is related. INFO [org.netbeans.core.ui.warmup.DiagnosticTask]: Total memory 1 591 296 000 WARNING [org.netbeans.modules.j2ee.metadata.model.api.support.annotation.AnnotationScanner]: findAnnotations: could not find type javax.persistence.Entity WARNING [org.netbeans.modules.j2ee.metadata.model.api.support.annotation.AnnotationScanner]: findAnnotations: could not find type javax.persistence.Embeddable WARNING [org.netbeans.modules.j2ee.metadata.model.api.support.annotation.AnnotationScanner]: findAnnotations: could not find type javax.persistence.MappedSuperclass WARNING [org.openide.loaders]: Please attach following information to the issue <http://www.netbeans.org/issues/show_bug.cgi?id=31227>: act ion org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction does not implement SystemAction.getName() or Action.getValue(NAME) properly. It returns null!
Please attach whole messages.log and do thread dump while CPU is at 100%. See http://wiki.netbeans.org/wiki/view/GenerateThreadDump Thanks
Created attachment 51768 [details] stacktrace
Created attachment 51769 [details] messages.log
In fact it does not fail. It is incredibly slow. I fixed the problem with cancel. Now it really stops the CPU. Checking in RetoucheUtils.java; /cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/RetoucheUtils.java,v <-- RetoucheUtils.java new revision: 1.39; previous revision: 1.38 done Checking in spi/JavaRefactoringPlugin.java; /cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/spi/JavaRefactoringPlugin.java,v <-- JavaRefactoringPlugin.java new revision: 1.20; previous revision: 1.19 done The real problem is missing ClassIndex.SearchKind.IMPLEMENTORS_RECUSRIVE. I have my own impl at RetoucheUtils.getImplementorsAsHandles(). This issue was caused by fix of issue 118102. Problem is, that find all methods, which overrides or implements given method in current project is not efficient. I must find all sublclasses, than their subclasses etc.. and it is really slow in case of toString().
Even in case the ClassIndex gives you list of recursive subclasses it will be slow in this case since everyone inherits from j.l.Object. There are two possible solutions: 1) Build index on method level rather than on Class level -> index will directly know who overrides the j.l.Object.toString 2) Index on the class level + index of idents as in NB 5.x -> will not be very fast in this case either you will need to parse nearly all since Set<PROJECT_CLASSES>.retainAll(allInheritedFromObject).retainAll(files_which_contain_toString) will be nearly the same as Set<PROJECT_CLASSES>. Not for 6.0.
*** Issue 123183 has been marked as a duplicate of this issue. ***
I just ran into this bug as well. Any chance it will get fixed in the near future?
Honzo, is there any recent improvements in this area?
AFAIK Tomas has been working on some improvements of ClassIndex. In NB 6.5 the index should contain all declarations of class members but I am not aware of any API through which the refactoring could access it. This would help in case of searching for all overriding methods of j.l.Object. For plain usages of Object's methods we would need full index that is in stage of prototype. tzezula should know more on this.
*** Issue 139042 has been marked as a duplicate of this issue. ***
*** Issue 142149 has been marked as a duplicate of this issue. ***
I have found a way how to speed it up in refactoring.java module. I can collect all java.lang.Object subclasses in ~10 seconds unlike the present implementation that needs hours to do the same. Reassigning.
Integrated into 'main-golden', will be available in build *200903060201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/49062a40ba46 User: Jan Pokorsky <jpokorsky@netbeans.org> Log: #120145: improving performance of tasks that collect subclasses
.
Still extremely slow in 6.8 Beta. Searched for usages of clone() in a project group which contains only very few usages of clone(), had to cancel it after ten minutes (it was still "initializing data"). It's pretty much unusable on larger projects.
Perhaps slightly different test case than the original, but very slow.
It is not extremely slow any more.