Re: Problem with instrumentation in constructors
Andrew Huntwork <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
oh, i guess the numbers you're looking at are the offsets of the
instructions, and that copy does not copy offsets. had you used
InstructionList.setPositions() after InstructionList.copy, you would
have seen 1 instead of -1. It's usually not important that these
numbers are correct except when you're actually writing the .class.
As for why your instructions weren't showing up, i think it's because
ih->next() is not in iList, but i don't now for sure. really, with the
InstructionList.copy in there, things were just buggy, so anything could
have happened.
Koduru, Rajendra Kumar Reddy wrote:
> Hi Andrew,
>
>
>>> superList = iList.copy(); I used
>>> iList itself in this method..
>>
>>oh yeah, good point.
>>
>>
>>
>>> the former was returning instruction handle -1 and the later +1,
>>>with a basic super() being first call.
>>
>>I don't understand your current problem. Are you saying that the
>>InstructionHandle you're returning is not correct? Is off by
>>one? what
>>do you mean by "was not able to insert"?
>
>
>
> when I used superList = iList.copy();
>
> the isntruction handle returned was ih = -1
>
> and when I called iList.insert(ih.next(), newList);
>
> I could not see my instrumented instructions in the bytecode
> instruction set.
>
> But, when I used the iList itself for iteration. ih = 1
>
> iList.insert(ih.next(),newList);
>
> I could see my instrumented instructions in desired place.
>
> I was wondering why it is so??
>
>
>
>
>>> and was not able to insert with former..so choosed the
>>>later..however am not sure of reason for this..could you
>>
>>please clarify
>>
>>>me, why is this happening..is this due to copy()
>>>method???????????????????????
>>>
>>>public InstructionHandle getIListSuper(InstructionList iList){
>>>
>>> int invkSpec = 0;
>>>
>>> InstructionHandle seperator = null;
>>>
>>> InstructionList superList = iList.copy(); // deep copy
>>>[COMMENTED OUT IN CURRENT METHOD]
>>>
>>> for ( Iterator i = superList.iterator (); i.hasNext (); ) {
>>>[ USED iList in place of superList in this statement]
>>> seperator = ( InstructionHandle ) i.next ();
>>>
>>> if(seperator.getInstruction() instanceof NEW )
>>> invkSpec++;
>>>
>>> if(seperator.getInstruction() instanceof INVOKESPECIAL )
>>> invkSpec--;
>>>
>>> if(invkSpec < 0 )
>>> break;
>>> }
>>>
>>> if(invkSpec < 0) {
>>> return seperator
>>> }
>>>
>>> return null;
>>> }
>>>
>>>
>>>Thank you
>>>Reddy
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [email protected]
>>For additional commands, e-mail: [email protected]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>