soot.jimple.toolkits.invoke
Class AccessManager

java.lang.Object
  extended by soot.jimple.toolkits.invoke.AccessManager

public class AccessManager
extends Object

Methods for checking Java scope and visibiliity requirements.


Constructor Summary
AccessManager()
           
 
Method Summary
static void createAccessorMethod(SootMethod container, Stmt stmt)
          Turns a field access or method call into a call to an accessor method.
static void createAccessorMethods(Body body, Stmt before, Stmt after)
          Resolves illegal accesses in the interval ]before,after[ by creating accessor methods.
static String createAccessorName(ClassMember member, boolean setter)
          Creates a name for an accessor method.
static boolean ensureAccess(SootMethod container, ClassMember target, String options)
          Modifies code so that an access to target is legal from code in container.
static boolean ensureAccess(SootMethod container, SootClass target, String options)
          Modifies code so that an access to target is legal from code in container.
static boolean isAccessLegal(SootMethod container, ClassMember target)
          Returns true iff target is legally accessible from container.
static boolean isAccessLegal(SootMethod container, SootClass target)
          Returns true if an access to target is legal from code in container.
static boolean isAccessLegal(SootMethod container, Stmt stmt)
          Returns true if the statement stmt contains an illegal access to a field or method, assuming the statement is in method container
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessManager

public AccessManager()
Method Detail

isAccessLegal

public static boolean isAccessLegal(SootMethod container,
                                    ClassMember target)
Returns true iff target is legally accessible from container. Illegal access occurs when any of the following cases holds: 1. target is private, but container.declaringClass() != target.declaringClass(); or, 2. target is package-visible, and its package differs from that of container; or, 3. target is protected, and either: a. container doesn't belong to target.declaringClass, or any subclass of ;


isAccessLegal

public static boolean isAccessLegal(SootMethod container,
                                    SootClass target)
Returns true if an access to target is legal from code in container.


isAccessLegal

public static boolean isAccessLegal(SootMethod container,
                                    Stmt stmt)
Returns true if the statement stmt contains an illegal access to a field or method, assuming the statement is in method container

Parameters:
container -
stmt -
Returns:

createAccessorMethods

public static void createAccessorMethods(Body body,
                                         Stmt before,
                                         Stmt after)
Resolves illegal accesses in the interval ]before,after[ by creating accessor methods. before and after can be null to indicate beginning/end respectively.

Parameters:
body -
before -
after -

createAccessorName

public static String createAccessorName(ClassMember member,
                                        boolean setter)
Creates a name for an accessor method.

Parameters:
member -
setter -
Returns:

createAccessorMethod

public static void createAccessorMethod(SootMethod container,
                                        Stmt stmt)
Turns a field access or method call into a call to an accessor method. Reuses existing accessors based on name mangling (see createAccessorName)

Parameters:
container -
stmt -

ensureAccess

public static boolean ensureAccess(SootMethod container,
                                   ClassMember target,
                                   String options)
Modifies code so that an access to target is legal from code in container. The "accessors" option assumes suitable accessor methods will be created after checking.


ensureAccess

public static boolean ensureAccess(SootMethod container,
                                   SootClass target,
                                   String options)
Modifies code so that an access to target is legal from code in container.