I want to set a field in a constructor before super is called so that the super
constructor can use the field, e.g.:
| abstract class Base {
| Base() { System.out.println( getField() ); }
| abstract int getField();
| }
|
| class Derived extends Base {
| int field;
| Derived() {
| field = 1;
| super();
| }
| int getField() { return field; }
| }
|
The above isn't valid Java (the call to super must be the first line of
constructor Derived) and it is also not valid in Javassist. Is there a way
round this in Javassist?
Note: this setting of a field before calling super is similar to how instance
inner (nested) classes work, they set the field that points to their outer
class before calling their own super constructor.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882208#3882208
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3882208
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user