Re: [abc-users] CastShadowMatch

From: Eric Bodden <>
Date: Fri, 15 Feb 2008 08:35:25 -0500

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.


On 15/02/2008, Amjad Nusayr <> 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

Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Fri Feb 15 2008 - 13:35:29 GMT

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