Re: How to initialize a static field

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Le 09/11/2010 15:59, Jayanga Wagaarachchi a écrit :
> Hi,
>
> I wanted to initialize a static field which I added to a class. how 
> can I initialize it?

If it's a primitive value of a string, use the defaultValue, the last 
parameter of visitField
else you have to generate a method name "<clinit>" and initialize it 
using putStatic.

Anyway, the best is to write your code in Java and use the asmifier.
see the ASM FAQ (Q10)
http://asm.ow2.org/doc/faq.html

>
> Thank you
>
> -- 
> Jayanga Wagaarachchi
> Computer Science and Engineering
> University of Moratuwa.

Rémi
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.