final field init

dlf <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Sorry for the newbie question.	I haven't been able to track this issue down on
the internet, though I feel like I've read about it before.

I'm generating a class with two public final member fields and an empty
constructor that does nothing but call java.lang.Object.<init>.

When I load the class and print out the fields directly, they're fine.	But
when I use reflection to access the fields, I get the default values for the
type, not the constant values I thought I'd assigned.

When I view the newly-created instance (either method) using the eclipse
debugger, it thinks the fields have the default values.  This despite the fact
that the next line that accesses the fields directly prints out the right
value.

I wrote java source for a similar class with the final constant fields and an
empty constructor, and the (eclipse) compiler generated code to initialize
these fields inside the constructor (as reported using ASM TraceClassVisitor). 
So I'm wondering if the behavior I'm seeing has to do with the difference
between these two ways of initializing the constant fields.
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.