[Soot-list] How can I change method's parameters types

Amir Mehrabi mehrabi at comp.iust.ac.ir
Sun Feb 8 10:46:30 EST 2009


Hi Eric
 
This is All of my code
 
class myThread implements Runnable {
  Thread t;
   MyTransformer f;
   String Parameter;
   
   public myThread(String Param){
          Parameter=Param;
          t=new Thread(this);
          t.start();
   }
 
   public void run(){
      f= new   MyTransformer();
      PackManager.v().getPack("jtp").add(new Transform("jtp.trnsform",f));
      String[] Args=Parameter.split(" ");
      soot.Main.main(Args);
   }
 }
 
class MyTransformer extends BodyTransform{
 
internal Transform(Body b ,String Phasename,Map Option){
 
   List args=b.getMethod().getParameterTypes();
   b.getMethod.setParametersType(args)
 
}
 
}
 
 
 
And in my program just initiate myThread like this:
  ...
     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){
             myThread t=new myThread("-app Test.TestClass3");
    }
...
 
Thanks
 
Amir Mehrabi J.

-----Original Message-----
From: Eric Bodden <eric.bodden at mail.mcgill.ca>
To: Amir Mehrabi <mehrabi at comp.iust.ac.ir>
Cc: soot-list at sable.mcgill.ca
Date: Sun, 8 Feb 2009 09:55:01 -0500
Subject: Re: [Soot-list] How can I change method's parameters types


Well, apparently whatever list throws this exception is being modified
while somebody (presumably your manually created thread) iterates over
it. Are you instantiating multiple such threads or just one? It's hard
to say. I guess you need to use a debugger there...

Eric

2009/2/8 Amir Mehrabi <mehrabi at comp.iust.ac.ir>:
> Hi Eric
>
> For your idea I write a class like this:
>
> class myThread implements Runnable {
>   Thread t;
>    MyTransformer f;
>    String Parameter;
>
>    public myThread(String Param){
>           Parameter=Param;
>           t=new Thread(this);
>           t.start();
>    }
>
>    public void run(){
>       f= new   MyTransformer();
>       PackManager.v().getPack("jtp").add(new Transform("jtp.trnsform",f));
>       String[] Args=Parameter.split(" ");
>       soot.Main.main(Args);
>    }
>  }
>
> And in my program just initiate myThread like this:
>   ...
>      private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){
>              myThread t=new myThread("-app Test.TestClass3");
>     }
> ...
>
>
> But unfortunately I receive an exception again :
>
>     Exception in thread "thread-2" 
java.util.ConcurrentModificationException
>     at
> java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
>     at java.util.AbstractList$Itr.next(AbstractList.java:343)
>     ....
>
> I don't know what's the problem!
> Please help me.
>
> Thank you
>
> Amir Mehrabi J.
>
>
> -----Original Message-----
> From: Eric Bodden <eric.bodden at mail.mcgill.ca>
> To: Amir Mehrabi <mehrabi at comp.iust.ac.ir>
> Cc: soot-list at sable.mcgill.ca
> Date: Sat, 7 Feb 2009 10:00:44 -0500
> Subject: Re: [Soot-list] How can I change method's parameters types
>
> Hi Amir.
>
> To me that seems like a threading problem, not a problem with Soot.
> Are you running your Soot within the AWT event-dispatch thread? If so,
> you may need to change that.
>
> Eric
>
> 2009/2/7 Amir Mehrabi <mehrabi at comp.iust.ac.ir>:
>> Hi all
>> I want to change type of my method's parameter
>> How can I do this?
>> for example
>> I Have a method like :
>>             public void sample(int a,TestClass c);
>>
>> I want to change the type of these method to
>>             public void sample(int a,long c);
>>
>> when I want to do this in BodyTransformer , soot throws an exception , 
the
>> following code are a portial of my code
>>
>> ...
>> protected void internalTransform(Body body,String phasename,Map option){
>>
>> List lst=body.getMethod().getParameterTypes();
>> for(int i=0;i< lst.size() ; i++)
>> {
>>      lst.add(RefType.v("MyPackage.MyClass"));
>> }
>> body.getMethod.setParameterTypes(lst);          <==== throws an exception
>> ...
>> }
>>
>>
>>      THROWS :
>>      Exception in thread "AWT-EventQueue-0"
>> java.util.ConcurrentModificationException
>>
>>
>> any body have an idea?!
>>
>>  Thanks
>>  Amir Mehrabi Jorshary
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>>
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University
> Montréal, Québec, Canada
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090208/a30e6819/attachment-0001.html 


More information about the Soot-list mailing list