Package soot.jimple.toolkits.invoke
Class AccessManager
- java.lang.Object
-
- soot.jimple.toolkits.invoke.AccessManager
-
public class AccessManager extends Object
Methods for checking Java scope and visibility requirements.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateAccessorMethod(SootMethod container, Stmt stmt)Turns a field access or method call into a call to an accessor method.static voidcreateAccessorMethods(Body body, Stmt before, Stmt after)Resolves illegal accesses in the interval ]before,after[ by creating accessor methods.static StringcreateAccessorName(ClassMember member, boolean setter)Creates a name for an accessor method.static booleanensureAccess(SootMethod container, ClassMember target, String options)Modifies code so that an access totargetis legal from code incontainer.static booleanensureAccess(SootMethod container, SootClass target, String options)Modifies code so that an access totargetis legal from code incontainer.static booleanisAccessLegal(SootMethod container, ClassMember target)Returns true iff target is legally accessible from container.static booleanisAccessLegal(SootMethod container, Stmt stmt)Returns true if the statementstmtcontains an illegal access to a field or method, assuming the statement is in methodcontainerstatic booleanisAccessLegal(SootMethod container, SootClass target)Returns true if an access totargetis legal from code incontainer.
-
-
-
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 (i.e. default), and its package differs from that of container; or, (3) target is protected and the package of container differs from the package of target and the container doesn't belong to target.declaringClass or any subclass.
-
isAccessLegal
public static boolean isAccessLegal(SootMethod container, SootClass target)
Returns true if an access totargetis legal from code incontainer.
-
isAccessLegal
public static boolean isAccessLegal(SootMethod container, Stmt stmt)
Returns true if the statementstmtcontains an illegal access to a field or method, assuming the statement is in methodcontainer- 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.beforeandaftercan 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 totargetis legal from code incontainer. 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 totargetis legal from code incontainer.
-
-