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 47481 - [40cat] Run large j2seproject with no main class set takes long time to initialize list of possible main classes
Summary: [40cat] Run large j2seproject with no main class set takes long time to initi...
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Jiri Rechtacek
: 45422 (view as bug list)
Depends on:
Blocks: 44105
  Show dependency tree
Reported: 2004-08-19 14:46 UTC by meliandra
Modified: 2006-03-24 10:20 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Bild 1 (18.75 KB, image/jpeg)
2004-08-19 15:05 UTC, meliandra
Bild 2 (19.87 KB, image/jpeg)
2004-08-19 15:05 UTC, meliandra

Note You need to log in before you can comment on or make changes to this bug.
Description meliandra 2004-08-19 14:46:56 UTC
[ BUILD # : 200408121535 ]
[ JDK VERSION : J2SE 1.5.0 ]

To test a jdialog I used F6 to run it.
(Netbeans 3.6)

In the project is no main class set - so it takes a long time until all available classes are shown.
The project have nearly 4,000 classes.
Comment 1 Marian Mirilovic 2004-08-19 14:58:31 UTC
> In the project is no main class set - so it takes a long time until
all available classes are shown

what do you mean by "all available classes are shown"?
Comment 2 meliandra 2004-08-19 15:05:07 UTC
Created attachment 16956 [details]
Bild 1
Comment 3 meliandra 2004-08-19 15:05:19 UTC
Created attachment 16957 [details]
Bild 2
Comment 4 meliandra 2004-08-19 15:06:41 UTC
I've attached a picture of the dialog.

I've also stopped the time - 2:30.

At least you can cancel this job.

Nobody will do this twice.
Comment 5 Marian Mirilovic 2004-08-19 15:36:01 UTC
thanks for explanation ...

reassigne to appropriate module for evaluation
Comment 6 Jesse Glick 2004-08-19 18:01:35 UTC
Doubt there is anything to be done from the j2seproject side; it just
asks JMI for a list of classes with a main method. If JMI takes a long
time to report back, the dialog just waits.

Of course you can just type in the specific main class you want in the
project's properties dialog, so this is hardly a priority bug IMHO,
especially since the choice of main class is normally intended to be a
one-time decision, not each time you run. (If you want to run a
particular class on a one-off basis without setting it as the main
class, you can, just using Shift-F6.)
Comment 7 Martin Matula 2004-08-19 18:59:09 UTC
Jesse, could you please point me to the code in projects that
retrieves the list so that I could check whether it could use javacore
more effectively?
Comment 8 Martin Matula 2004-08-19 19:04:44 UTC
...I mean efficiently :)
Comment 9 Jesse Glick 2004-08-19 19:07:24 UTC
MainClassChooser.getAllMainClasses (in java/j2seproject). Actually it
looks like it is using the old srcmodel - is this going to add
overhead? All Jirka's code I believe, adding him to CC though I think
I heard he was on vacation.

Note that the search is just a depth-first enumeration of all classes
in the source root, so without some kind of index it is going to be O(n).

Note also that the project in question probably has to be open, so the
source root should be in the merged classpath.
Comment 10 Martin Matula 2004-08-19 19:31:59 UTC
Wow! I believe this can be improved very significantly. At least we
could give you just the files that contain "main" identifier and you
could inspect only those. We do that already e.g. when a package is
expanded and we need to create icon badges. Using JMI instead of the
old src hierarchy should also be faster. We can help Jirka to
implement that, however there might be one problem - j2seproject would
need to have an implementation dependency on javacore (at least for
this release) since there is no API for getting all files containing a
given identifier yet. Would that be acceptable?
Comment 11 Jesse Glick 2004-08-19 19:49:38 UTC
I think a temporary impl dependency on javacore would be acceptable.
Of course if there is a proper API later (in javamodel?) that would be

Please reassign to Jirka when you think there is a usable friend API
(or immediately if he could start using JMI in place of srcmodel to
get some performance benefit).
Comment 12 Antonin Nebuzelsky 2004-08-23 13:53:36 UTC
This is definitely not P4, it is veeeeeery sloooooow.
Makes the feature almost unusable.
Comment 13 Jesse Glick 2004-08-23 20:52:16 UTC
Jirka you're back right?
Comment 14 Jiri Rechtacek 2004-08-25 11:30:39 UTC
*** Issue 45422 has been marked as a duplicate of this issue. ***
Comment 15 _ rkubacki 2004-08-25 12:49:33 UTC
Petr J. copied the same code into web projects :-(

So don't forget we have to fix it in webapps too.
Comment 16 Jiri Rechtacek 2004-08-30 17:02:22 UTC
Yes, we have to temporary depend on javacore but also on jmi, jmiutils
and mdr as well. Other possibility is dependency on java (Java Source
Files) project.
Comment 17 Jiri Rechtacek 2004-08-31 14:56:39 UTC
Support javacore/jmimodel is used to obtain and check the project's
main classes. Made new two dependency to java/javacore and jmimodel.
The java module uses other dependencies which hasn't been forced in
j2seproject yet.

fixed in j2seproject/build.xml;
/cvs/java/j2seproject/build.xml,v  <--  build.xml
new revision: 1.4; previous revision: 1.3
Processing log script arguments...
More commits to come...
Checking in j2seproject/nbproject/;
/cvs/java/j2seproject/nbproject/,v  <--
new revision: 1.7; previous revision: 1.6
Checking in j2seproject/nbproject/project.xml;
/cvs/java/j2seproject/nbproject/project.xml,v  <--  project.xml
new revision: 1.11; previous revision: 1.10
Processing log script arguments...
More commits to come...
Checking in
new revision: 1.23; previous revision: 1.22
Checking in
new revision: 1.3; previous revision: 1.2
Processing log script arguments...
More commits to come...
Checking in
new revision: 1.19; previous revision: 1.18
Processing log script arguments...
More commits to come...
Checking in javacore/src/org/netbeans/modules/javacore/;
new revision: 1.14; previous revision: 1.13
Comment 18 Antonin Nebuzelsky 2004-09-02 12:59:35 UTC
Verifying as fixed w/ trunk build 200409011800.
I tried with jEdit project. It took 9 seconds to present the list of
main classes, while with a build before this fix I measured 70 seconds.

I do not know how long it will take for your project, meliandra, and
if it is acceptable for you now. Feel free to reopen.