I'm fairly certain that jikes just turns that into a constant.  It's
odd that javac does not -- I wonder if there is a way to convince it
that it should be constant?

"EXT-Raiteri, Ashley L" <[EMAIL PROTECTED]> writes:

> Good call!
> Oneo of our guys here caught this as well, and I was wondering if anyone
> else would come up with it...
> ashley raiteri
>
> -----Original Message-----
> From: Rick Johnston [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 22, 2002 7:49 AM
> To: [EMAIL PROTECTED]
> Subject: Invalid static member of inner class
>
>
>
> In compiling the latest version of XmlRpcServer.java with javac (1.3.1), I
> got a compiler error because of the static member 'EMPTY_BYTE_ARRAY' in the
> inner 'Worker' class.  Section 8.1.2 of the Java Language Spec 2nd ed. does
> specifically state that "Inner classes may not declare static members,
> unless they are compile-time constant fields."  Since EMPTY_BYTE_ARRAY is
> defined as "= new byte[0]", this is not a compile-time constant and is
> therefore invalid.  Interestingly, the Jikes compiler does not complain
> about this (perhaps because it is also declared as final?).  Alternatively,
> if the Worker class was a Nested class but not an Inner class (i.e., Worker
> is 'static' - which doesn't seem appropriate), this would be legal.
>
> I plan to move EMPTY_BYTE_ARRAY back to the outer class in my copy.  I ask
> that someone checks this change into CVS as well.

Reply via email to