[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: soot.ArrayType
Ankush Varma <ankush@eng.umd.edu> wrote:
> What's the difference between
> getArrayElementType() and getElementType()
>
> in soot.ArrayType ?
That does indeed look bizarre. My guess is that getElementType() was
kept for backwards compatibility with previous code, because
getArrayElementType() and getElementType() return exactly the same
thing. getElementType() will probably be phased out.
getArrayElementType() seems to have been introduced with the
RefLikeType super interface:
http://www.sable.mcgill.ca/soot/doc/soot/RefLikeType.html
RefType (subclass of RefLikeType) also implements
getArrayElementType() although I'm not at all sure why that's needed:
public Type getArrayElementType() {
if( className.equals( "java.lang.Object" )
|| className.equals( "java.io.Serializable" )
|| className.equals( "java.lang.Cloneable" ) ) {
return RefType.v( "java.lang.Object" );
}
throw new RuntimeException( "Attempt to get array base type of a non-array" );
}
Maybe for when the typing algorithm can't figure out that an Object is
of array type? Ondrej can probably tell us.
Cheers,
Navin.