You would have to find the default constructor "<init>" and look for stores into
the member you are interested in, and find the LDC that occurs just before it.
>From there you can look up the value in the constant pool. Not an easy chore in
the general sense.

Quoting Martin Cooper <[EMAIL PROTECTED]>:

> Say I have an abstract class as follows:
> 
> public abstract class Foo {
> String myField = "DefaultValue";
> }
> 
> Note that the field is not static. How can I obtain the default value of the
> 
> field, namely "DefaultValue", without having a concrete class that I can 
> instantiate?
> 
> Using plain vanilla reflection, there doesn't appear to be a way, since the 
> only way to get the value of a non-static field is to have an instance of 
> the class. So I was hoping there might be a way to do this with BCEL, but I 
> couldn't find anything there either.
> 
> Anyone have any ideas?
> 
> --
> Martin Cooper
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to