Re: Problem with instrumentation in constructors
Andrew Huntwork <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
Koduru, Rajendra Kumar Reddy wrote:
> Hi Andrew,
>
> Yep, I have seen your objections to the instrumentaion procedure
> of constructor that was mentioned by you in the corresponding thread..
>
> The approach you suggested worked, but with a small change...
> In the getIListSuper() method, instead of using superList as
> mentioned
>
> 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"?
>
> 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