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 10626 - Static initializer invoked when click on class node
Summary: Static initializer invoked when click on class node
Status: CLOSED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-03-23 11:05 UTC by sapex
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sapex 2001-03-23 11:05:21 UTC
I noticed this because I've a class that opens a frame in the
static initializer.
This is annoying and even dangerous I think.
This is NB 3.2 build 8.

Here's an example:

----%<----%<----%<----

import javax.swing.*;
public class StaticInit
{
    static
    {
        JFrame frame = new JFrame ();
        frame.setSize (200, 200);
        frame.show ();
        System.err.println ("test");
    }
}
Comment 1 Svata Dedic 2001-03-23 20:29:23 UTC
This is probably a thing we have to work with. I will discuss it on Monday with 
core developers, because changing the code not to initialize and LINK classes 
could cause strange errors later. If the class is linked/initialized 
immediately, such errors are caught by code that anticipates some 
Errors/Exceptions.
Comment 2 Svata Dedic 2001-03-27 17:11:57 UTC
I can probably do nothing about it right now, LinkErrors and other stuff are 
now trapped inside the code that asks for a java.lang.Class (basically the 
code that enables/disables Customize Bean action). If I postpone linking / 
initialization of the class, the IDE may issue random error messages at later 
point :-(

Comment 3 Quality Engineering 2003-07-01 13:11:14 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 4 Quality Engineering 2003-07-01 13:18:45 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.