Re: OT: a java question - static initialization

2008-02-20 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kenneth, Kenneth Westelinck wrote: | Did a quick test on 1.6.0 update 2 and the static block does get called. I | guess this is a bug. Er, this code doesn't look like it should compile: |> class Foo { |> |> private static int; |> Isn't there

RE: OT: a java question - static initialization

2008-02-20 Thread Katilie, John
Also, When you say not called. Did you trace it through the debugger? Could there also be some optimization going on here? jfk -Original Message- From: Jim Cox [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 20, 2008 11:05 AM To: Tomcat Users List Subject: Re: OT: a java question

Re: OT: a java question - static initialization

2008-02-20 Thread Jim Cox
On Feb 20, 2008 10:47 AM, Dave <[EMAIL PROTECTED]> wrote: > class Foo { > >private static int; > > static { > a = 100; > } > > Foo() { > > } > > } > > Class.forName("package.Foo").newInstance(); > > The static init block of Foo is not called. > > I a

Re: OT: a java question - static initialization

2008-02-20 Thread Kenneth Westelinck
Did a quick test on 1.6.0 update 2 and the static block does get called. I guess this is a bug. On Feb 20, 2008 4:47 PM, Dave <[EMAIL PROTECTED]> wrote: > class Foo { > > private static int; > > static { > a = 100; > } > > Foo() { > > } > > } > > Class.forName(

OT: a java question - static initialization

2008-02-20 Thread Dave
class Foo { private static int; static { a = 100; } Foo() { } } Class.forName("package.Foo").newInstance(); The static init block of Foo is not called. I am using Java 1.5 update14. It is a bug? Thanks Da