Re: [newbie] access question
Chris Uzdavinis <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
> public DelegateCallbacks(Object[] objects) {
> delegate0 = (Impl1) objects[0];
> delegate1 = (Impl1) objects[1];
> delegate2 = (Impl1) objects[2];
> delegate3 = (Impl1) objects[3];
> }
Sorry. Obvious typo, should be:
delegate2 = (Impl2) objects[2];
delegate3 = (Impl2) objects[3];
Also, the code sample I provided had some extra lines that are
distracting. The checkCast call below is where I think the problem
occurs.
...
final GeneratorAdapter ga = new
GeneratorAdapter(Opcodes.ACC_PUBLIC, myMethod, null, null, cw);
... (ctor base call, etc, omitted from example)
for (int i = 0; i < numDelegates; ++i)
{
final Type delegateType = Type.getType(delegateDescriptor(i));
ga.newLabel();
ga.loadThis();
ga.loadArg(0); // push delegates array
ga.push(i); // push index into delegates array
ga.arrayLoad(delegateType); // get the current delegate object
// initialize the member variable with delegate
ga.checkCast(delegateType);
ga.putField(classType, delegateExternalName(i), delegateType);
}
Thanks, and sorry for the sloppy editing the first time.
Chris
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