[Soot-list] Cast Error: Union to PointsToSetInternal

Ondrej Lhotak olhotak at sable.mcgill.ca
Tue Oct 26 19:14:47 EDT 2004


On Tue, Oct 26, 2004 at 05:36:33PM -0400, Saswat Anand wrote:
> Hi,
> 
> I am getting a Cast Exception error at:
> 
> Exception in thread "main" java.lang.ClassCastException
>         at
> soot.jimple.spark.sets.PointsToSetInternal.hasNonEmptyIntersection(PointsToS
> etInternal.java:82)
>         at
> soot.jimple.spark.sets.DoublePointsToSet.hasNonEmptyIntersection(DoublePoint
> sToSet.java:45)
>         at MySideEffectTester.canWriteTo(MySideEffectTester.java:66)
> 
> The 'other' argument at line 82 happens to be instanceof Union. Isnt it
> expected to pass a Union instance to this method?

No.

The Spark points-to set implementations only know about the other Spark
points-to sets implementations. Union is part of the side-effect
analysis, which is external to Spark, and was developed later. So, you
should be able to pass a Spark points-to set to a Union, but not a Union
to a Spark points-to set. There's a static utility method in Union that
takes two PointsToSets and calls the hasNonEmptyIntersection() method
on them the right way around.

Ondrej

> My code looks like this:
> 
> public boolean canWriteTo( MethodRWSet rwSet, Object local, SootField
> field )
> {
>     if( rwSet == null ) return false;
>     PointsToSet o1 = pointsToSetFor( local );
>     if( o1 == null ) return false;
>     PointsToSet o2 = rwSet.getBaseForField( field );
>     if( o2 == null ) return false;
>     if( o2 instanceof Union ) System.out.println( "UNION" );
>     return o1.hasNonEmptyIntersection( o2 );
> }
> 
> Thanks a lot.
> Saswat
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://www.sable.mcgill.ca/mailman/listinfo/soot-list
> 


More information about the Soot-list mailing list