[Soot-list] fixing more equivTo methods...

Michael Faes rolve at trick17.ch
Wed Mar 6 11:46:17 EST 2013


Hm, I'm not sure this fix was correct. The current version:

     public boolean equivTo(Object o)
     {
         if (o instanceof AbstractSpecialInvokeExpr)
         {
             AbstractSpecialInvokeExpr ie = (AbstractSpecialInvokeExpr)o;
             if (!(baseBox.getValue().equivTo(ie.baseBox.getValue()) &&
                     getMethod().equals(ie.getMethod()) &&
                     argBoxes.length == ie.argBoxes.length))
                 return false;
             for(int i=0; i< argBoxes.length; i++){
            if(!(argBoxes[i]).getValue().equivTo(ie.argBoxes[i].getValue()))
            return false;
            }
         }
         return true;
     }

returns true even if the other object is something completely
different. My take would have been:

     public boolean equivTo(Object o)
     {
         if (o instanceof AbstractSpecialInvokeExpr)
         {
             AbstractSpecialInvokeExpr ie = (AbstractSpecialInvokeExpr)o;
             if (!(baseBox.getValue().equivTo(ie.baseBox.getValue()) &&
                     getMethod().equals(ie.getMethod()) &&
                     argBoxes.length == ie.argBoxes.length))
                 return false;
             for(int i=0; i< argBoxes.length; i++){
            if(!(argBoxes[i]).getValue().equivTo(ie.argBoxes[i].getValue()))
                 return false;
            }
            return true;
         }
         return false;
     }

Michael


-------- Original-Nachricht --------
Betreff: Re: [Soot-list] fixing more equivTo methods...
Von: Eric Bodden <eric.bodden at ec-spride.de>
An: Michael Faes <rolve at trick17.ch>
Datum: 06.03.2013 17:24

> Thanks!
>
> I just pushed a fix (I hope) to the develop branch.
>
> Eric
>
> On 6 March 2013 12:38, Michael Faes <rolve at trick17.ch> wrote:
>> Hi Eric and everyone,
>>
>> While messing around with the newest nightly build, I found
>> something funny: The equivTo method of AbstractSpecialInvokeExpr,
>> while looking very sophisticated, always returns false:
>>
>> public boolean equivTo(Object o) { if (o instanceof
>> AbstractSpecialInvokeExpr) { AbstractSpecialInvokeExpr ie =
>> (AbstractSpecialInvokeExpr)o; if
>> (!(baseBox.getValue().equivTo(ie.baseBox.getValue()) &&
>> getMethod().equals(ie.getMethod()) && argBoxes.length ==
>> ie.argBoxes.length)) return false; for(int i=0; i< argBoxes.length;
>> i++){
>> if(!(argBoxes[i]).getValue().equivTo(ie.argBoxes[i].getValue()))
>> return false; } } return false; }
>>
>> This change was made in the following commit ("fixing more equivTo
>> methods"):
>> https://github.com/Sable/soot/commit/0740ce06bace421870fe2cf00f7d1c3805e5f02d
>>
>>
>>
I assume this is a bug. Is it possible to quickly fix this? Or should I
>> just use the old version? It seemed to work for me so far...
>>
>> Best regards, Michael
>> _______________________________________________ Soot-list mailing
>> list Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
>


More information about the Soot-list mailing list