}
ReflectionModel reflectionModel;
private void getImplicitTargets( SootMethod source ) {
final SootClass scl = source.getDeclaringClass();
if( source.isNative() || source.isPhantom() ) return;
if( source.getSubSignature().indexOf( "<init>" ) >= 0 ) {
handleInit(source, scl);
}
Body b = source.retrieveActiveBody();
for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) {
final Stmt s = (Stmt) sIt.next();
if( s.containsInvokeExpr() ) {
InvokeExpr ie = s.getInvokeExpr();
if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Method: java.lang.Object invoke(java.lang.Object,java.lang.Object[])>" ) ) {
reflectionModel.methodInvoke(source,s);
}
if( ie.getMethodRef().getSignature().equals( "<java.lang.Class: java.lang.Object newInstance()>" ) ) {
reflectionModel.classNewInstance(source,s);
}
if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Constructor: java.lang.Object newInstance(java.lang.Object[])>" ) ) {
reflectionModel.contructorNewInstance(source, s);
}
if( ie.getMethodRef().getSubSignature() == sigForName ) {
reflectionModel.classForName(source,s);
}
if( ie instanceof StaticInvokeExpr ) {
SootClass cl = ie.getMethodRef().declaringClass();
for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
addEdge( source, s, clinit, Kind.CLINIT );
}
}
}
if( s.containsFieldRef() ) {
FieldRef fr = s.getFieldRef();
if( fr instanceof StaticFieldRef ) {
SootClass cl = fr.getFieldRef().declaringClass();
for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
addEdge( source, s, clinit, Kind.CLINIT );
}
}
}
if( s instanceof AssignStmt ) {
Value rhs = ((AssignStmt)s).getRightOp();
if( rhs instanceof NewExpr ) {
NewExpr r = (NewExpr) rhs;
SootClass cl = r.getBaseType().getSootClass();
for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
addEdge( source, s, clinit, Kind.CLINIT );
}
} else if( rhs instanceof NewArrayExpr || rhs instanceof NewMultiArrayExpr ) {
Type t = rhs.getType();
if( t instanceof ArrayType ) t = ((ArrayType)t).baseType;
if( t instanceof RefType ) {
SootClass cl = ((RefType) t).getSootClass();
for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
addEdge( source, s, clinit, Kind.CLINIT );
}
}
}