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.
A test class follows: public class innerTest { private inner1 m_inner = null; private hi m_hi = new hi( "innerTest - (variable init)" ); // Our little test inner class.. private class inner1 { // We expect this to happen once, *before* inner1's constructor is executed.. private hi m_hi = new hi( "inner1 - (variable init)" ); private inner1() { // This should overwrite the instance created by the initializer.. m_hi = new hi( "inner1 - (constructor)" ); } } public innerTest() { // Construct a "hi" to ensure this doesn't happen for outer classes. m_hi = new hi( "innerTest - (constructor)" ); // Test inner classes.. m_inner = new inner1(); } public static void main( String args[] ) { new innerTest(); } } /** The little class we use to say "hi" */ class hi { hi( String msg ) { System.out.println( msg + " has been initialised!" ); } } When this is compiled and run; you would expect the following output on standard out: innerTest - (variable init) has been initialised! innerTest - (constructor) has been initialised! inner1 - (variable init) has been initialised! inner1 - (constructor) has been initialised! and it is what you get with javac. However; when compiled with the FFJ V2.0 fastjavac you get the following: innerTest - (variable init) has been initialised! innerTest - (constructor) has been initialised! inner1 - (variable init) has been initialised! inner1 - (constructor) has been initialised! inner1 - (variable init) has been initialised! As you can see - the member variable initialization for the "inner1" class has occurred twice, once before construction and then once after. I believe this is *not* correct.
Verified in fastjavac #524 -- this is a *critical* one because the bug does not result in any kind of RuntimeException or Error, but may corrupt data of the user program.
Has been forwarded to the Sun's fastjavac team.
Fixed in dev and maintrunk
Fixed in dev and maintrunk.
[NB3.2.38] Verified (fastjavac #525)
Resolved for 3.4.x or earlier, no new info since then -> closing.