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 148080

Summary: org.netbeans.api.ruby.platform.RubyPlatform is loaded on NetBeans startup with LimeWire project
Product: ruby Reporter: Alexander Kouznetsov <mrkam>
Component: ProjectAssignee: Erno Mononen <emononen>
Status: RESOLVED INCOMPLETE    
Severity: blocker CC: issues, jtulach, pjiricka
Priority: P3 Keywords: PERFORMANCE, TEST
Version: 6.x   
Hardware: All   
OS: All   
URL: http://wiki.netbeans.org/FitnessViaWhiteAndBlackList
Issue Type: DEFECT Exception Reporter:
Attachments: Stacktraces

Description Alexander Kouznetsov 2008-09-23 18:14:30 UTC
Performance test reports that the following classes are loaded on NetBeans startup with LimeWare project:

    org.netbeans.api.ruby.platform.RubyPlatform
    org.netbeans.api.ruby.platform.RubyPlatform$Info
    org.netbeans.api.ruby.platform.RubyPlatformManager

Please don't load these classes unless they are really necessary.
Comment 1 Alexander Kouznetsov 2008-09-23 18:15:19 UTC
Created attachment 70351 [details]
Stacktraces
Comment 2 Martin Krauskopf 2008-09-23 22:33:49 UTC
Tor, BootClassPathProvider (which scans all Ruby platforms) is in the global lookup, thus is 'seen' by
o.n.m.gsfpath.api.classpath.ClassPath. Likely this is for Go To Type alike functionality to work for Ruby platform
classes/modules (core/gems)? So should be moved to white-list?
Comment 3 Torbjorn Norbye 2008-09-23 23:07:55 UTC
I'm not sure. We want to support the use case that if you are in a Java SE project, and you open a Ruby file, and you
try to use code completion, you find SOME of the related Ruby apis -- at least the core library stuff (from rubystubs).
Ditto for JavaScript files.  

I think that relies upon the boot class path provider. But it would be good if this was only initialized when necessary.
If you move it, make sure you test functionality of that sort, along with the Go To Type/Symbol dialogs with open Ruby
projects etc. to make sure things are working as expected. This specific part (code completion of gems/platform stuff
outside of the rubystubs) is not tested well by the testing infrastructure because I haven't gotten indices working
properly from unit tests. 
Comment 4 Martin Krauskopf 2008-09-25 13:44:49 UTC
What BootClassPathProvider does is that it:

- registers itself to the default lookup since it is not project sensitive
- replies to request about core libraries (likely gems as well - I did not
  check) when somebody asked it. In this case it is asked by GSF (not sure in
  what context)

It:

- could probably check whether there is some Ruby project opened (through
  OpenProjects) and in the case it is not, ignore the request (until the result
  are cached by the above layers).
- could move the logic to the project sensitive ClassPathProvider. I'm not sure
  here, since it was provided in this (global lookup) way for some reason

Likely the former is the right way.
Comment 5 Martin Krauskopf 2008-09-25 14:01:48 UTC
This seems to be rather general problem. Since during e.g. creating PHP project, there are flows like this:

  "GSF Source Worker Thread" daemon prio=1 tid=0x08296a80 nid=0x6655 runnable [0x89219000..0x8921a140]
    at org.netbeans.modules.ruby.RubyLanguage.getCoreLibraries(RubyLanguage.java:117)
    at org.netbeans.modules.gsf.LanguageRegistry.getLibraryFos(LanguageRegistry.java:275)
    at org.netbeans.modules.gsfret.source.usages.Index.getPreindexRoots(Index.java:260)
    at org.netbeans.modules.gsfret.source.usages.Index.getDataFolder(Index.java:303)

where GSF iterates through all registered languages which triggers loading of a bunch of classes specific to each
language implementations.
Comment 6 Erno Mononen 2008-09-30 14:03:39 UTC
*** Issue 148181 has been marked as a duplicate of this issue. ***
Comment 7 Erno Mononen 2008-09-30 14:06:45 UTC
In addition the following classes are listed in issue 148181 (closed as a duplicate of this):

    org.netbeans.modules.ruby.RubyIndexer
    org.netbeans.modules.ruby.RubyLanguage
    org.netbeans.modules.ruby.modules.project.rake.FileChangeSupport
    org.netbeans.modules.ruby.modules.project.rake.FileChangeSupport$Holder
    org.netbeans.modules.ruby.modules.project.rake.FileChangeSupportEvent
    org.netbeans.modules.ruby.platform.gems.GemManager
    org.netbeans.modules.ruby.rhtml.RhtmlLanguage
    org.netbeans.modules.ruby.rhtml.editor.completion.RubyEmbeddingModel
    org.netbeans.modules.ruby.rubyproject.BootClassPathProvider
    org.netbeans.modules.ruby.spi.project.support.rake.PropertyEvaluator
    org.netbeans.modules.ruby.spi.project.support.rake.PropertyProvider
    org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils
    org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils$FilePropertyProvider
    org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils$SequentialPropertyEvaluator

See desc6 for reasoning on why these issues are duplicates.
Comment 8 Alexander Kouznetsov 2008-09-30 16:23:31 UTC
The following class was not loaded with 080929:

    org.netbeans.modules.ruby.modules.project.rake.FileChangeSupportEvent
Comment 9 Alexander Kouznetsov 2008-10-06 12:55:39 UTC
The following class were not loaded with 081004:
org.netbeans.api.ruby.platform.RubyPlatform
org.netbeans.api.ruby.platform.RubyPlatform$Info
org.netbeans.api.ruby.platform.RubyPlatformManager
org.netbeans.modules.ruby.RubyIndexer
org.netbeans.modules.ruby.modules.project.rake.FileChangeSupport
org.netbeans.modules.ruby.modules.project.rake.FileChangeSupport$Holder
org.netbeans.modules.ruby.platform.gems.GemManager
org.netbeans.modules.ruby.rhtml.editor.completion.RubyEmbeddingModel
org.netbeans.modules.ruby.rubyproject.BootClassPathProvider
org.netbeans.modules.ruby.spi.project.support.rake.PropertyEvaluator
org.netbeans.modules.ruby.spi.project.support.rake.PropertyProvider
org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils
org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils$FilePropertyProvider
org.netbeans.modules.ruby.spi.project.support.rake.PropertyUtils$SequentialPropertyEvaluator


The following two classes are still being loaded:
org.netbeans.modules.ruby.RubyLanguage
org.netbeans.modules.ruby.rhtml.RhtmlLanguage
Comment 10 Martin Krauskopf 2008-10-09 14:15:05 UTC
Reassigning to Tor:

  org.netbeans.modules.ruby.RubyLanguage
  org.netbeans.modules.ruby.rhtml.RhtmlLanguage
Comment 11 Erno Mononen 2009-05-21 13:56:41 UTC
Can you please update the issue with a current list (a lot of changes since the last update, e.g. GSF -> CSL). Thanks.