Re: [abc-users] CastShadowMatch

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Wed, 20 Feb 2008 09:54:52 -0700

Eric
Thanks for the reply, but why not I want to see how much my code will
blow up if I shadow every statement, any way its not working for for I
tryed the following.
first in my "AnyStmtShadowMatch#matchesAt" method I checked if the a
stmt is an instance of a Stmt.

if (!(stmt instanceof Stmt)) return null;

and when that did not work I did the follwing my in AnyStmt.java

protected Residue matchesAt(ShadowMatch sm)
{
        if (!(sm instanceof StmtShadowMatch)) return NeverMatch.v();
        return AlwaysMatch.v();
}

if dont know if I have to do something else, but I kept getting the same error in both scenarios, the abc compiled correctly, but when I tried t run my example I got the following exception.
 
f:\helloworld\p2>java -cp f:\abc\lib\abc-complete.jar;. Hello

Exception in thread "main" java.lang.ExceptionInInitializerError
        at Hello.<clinit>(Hello.java)
Caused by: org.aspectj.lang.NoAspectBoundException: Exception while initializing
 World: org.aspectj.lang.NoAspectBoundException: World
        at World.aspectOf(World.aj)
        at World.<clinit>(World.aj)
        ... 1 more
Caused by: org.aspectj.lang.NoAspectBoundException: World
        at World.aspectOf(World.aj)
        at World.<init>(World.aj)
        at World.abc$postClinit(World.aj)
        ... 2 more

do you have any idea of what should be done here?

Thanks
Amjad

Eric Bodden wrote:
> Hi, Amjad.
>
> I am not sure if it makes sense to generate a *Cast*ShadowMatch on
> every statement. This will likely not be successful because later
> stages in abc actually extract the cast from the CastShadowMatch and
> if there is none, the code just fails. However, you can certainly
> generate a new type of shadow match there, let's say an
> "AnyStmtShadowMatch", subtype of StmtShadowMatch. That should work.
> Note however, that this will create thousands if not millions of
> matches for a regular sized program. Certainly when you weave into all
> these positions, you might certainly have a complexity problem because
> your code will blow up a lot. Also, a statement in source code is
> usually represented by multiple Stmts in Jimple, so there is no 1 to 1
> correspondence - something else to consider.
>
> Eric
>
> On 15/02/2008, Amjad Nusayr <anusayr_at_cs.nmsu.edu> wrote:
>
>> Hi
>> I was wondering if there is a way to place a shadow on every statement
>> in the program, I was looking at the CastShadowMatch code and observed
>> the following
>>
>> /Stmt stmt = ((StmtMethodPosition) pos).getStmt();
>> if (!(stmt instanceof AssignStmt)) return null;
>> Value rhs = ((AssignStmt) stmt).getRightOp();
>> if(!(rhs instanceof CastExpr)) return null;
>> Type cast_to = ((CastExpr) rhs).getCastType();
>> return new CastShadowMatch(pos.getContainer(), stmt, cast_to);
>>
>>
>> /is it possible to do the following,
>>
>> /Stmt stmt = ((StmtMethodPosition) pos).getStmt();
>> //if (!(stmt instanceof Stmt)) return null; //any statement
>> //return new CastShadowMatch(pos.getContainer(), stmt, null);
>>
>> /I did a couple of tests and was not successful, has anyone got any idea?
>>
>> Thanks
>>
>> Amjad Nusayr
>>
>>
>>
>
>
>
Received on Wed Feb 20 2008 - 16:55:03 GMT

This archive was generated by hypermail 2.2.0 : Wed Feb 20 2008 - 17:10:11 GMT