private boolean isCallToPrivate(SpecialInvokeExpr sie) { return sie.getMethod().isPrivate(); }
static boolean specialInvokePerformsLookupIn(InvokeExpr ie, SootClass containerClass) { // If all of the conditions are true, a lookup is performed. SootMethod m = ie.getMethod(); if (m.getName().equals("<init>")) { return false; } if (m.isPrivate()) { return false; } Hierarchy h = Scene.v().getActiveHierarchy(); if (!h.isClassSuperclassOf(m.getDeclaringClass(), containerClass)) { return false; } // ACC_SUPER must always be set, eh? return true; } }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { SootMethod target = ie.getMethod(); /* * This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the * definition of invokespecial. */ if (target.getName().equals("<init>") || target.isPrivate()) { return target; } else if (isSubclass(target.getDeclaringClass(), container.getDeclaringClass())) { return resolveConcreteDispatch(container.getDeclaringClass(), target); } else { return target; } }
/** Returns true if the method m is visible from code in the class from. */ private boolean isVisible(SootClass from, SootMethod m) { from.checkLevel(SootClass.HIERARCHY); if (m.isPublic()) { return true; } if (m.isPrivate()) { return from.equals(m.getDeclaringClass()); } if (m.isProtected()) { return canStoreClass(from, m.getDeclaringClass()); } // m is package return from.getJavaPackageName().equals(m.getDeclaringClass().getJavaPackageName()); // || canStoreClass( from, m.getDeclaringClass() ); }
/** * Returns true if the given method is visible to client code. */ private static boolean visible(SootMethod mPrime) { SootClass cPrime = mPrime.getDeclaringClass(); return (cPrime.isPublic() || cPrime.isProtected() || (!cPrime.isPrivate() && !ASSUME_PACKAGES_SEALED)) && (mPrime.isPublic() || mPrime.isProtected() || (!mPrime.isPrivate() && !ASSUME_PACKAGES_SEALED)); } }
public static boolean checkSpecialInlineRestrictions(SootMethod container, SootMethod target, String options) { // Check the body of the method to inline for specialinvoke's boolean accessors = options.equals("accessors"); Body inlineeBody = target.getActiveBody(); Iterator unitsIt = inlineeBody.getUnits().iterator(); while (unitsIt.hasNext()) { Stmt st = (Stmt) unitsIt.next(); if (st.containsInvokeExpr()) { InvokeExpr ie1 = st.getInvokeExpr(); if (ie1 instanceof SpecialInvokeExpr) { if ((InlinerSafetyManager.specialInvokePerformsLookupIn(ie1, container.getDeclaringClass()) || InlinerSafetyManager.specialInvokePerformsLookupIn(ie1, target.getDeclaringClass()))) { return false; } SootMethod specialTarget = ie1.getMethod(); if (specialTarget.isPrivate()) { if (specialTarget.getDeclaringClass() != container.getDeclaringClass()) { // Do not inline a call which contains a specialinvoke call to a private method outside // the current class. This avoids a verifier error and we assume will not have a big // impact because we are inlining methods bottom-up, so such a call will be rare if (!accessors) { return false; } } } } } } return true; }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { container.getDeclaringClass().checkLevel(SootClass.HIERARCHY); SootMethod target = ie.getMethod(); target.getDeclaringClass().checkLevel(SootClass.HIERARCHY); /* * This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the * definition of invokespecial. */ if ("<init>".equals(target.getName()) || target.isPrivate()) { return target; } else if (isClassSubclassOf(target.getDeclaringClass(), container.getDeclaringClass())) { return resolveConcreteDispatch(container.getDeclaringClass(), target); } else { return target; } } }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { SootMethod target = ie.getMethod(); /* This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the definition of invokespecial. */ if (target.getName().equals("<init>") || target.isPrivate()) return target; else if (isSubclass(target.getDeclaringClass(), container.getDeclaringClass())) return resolveConcreteDispatch(container.getDeclaringClass(), target ); else return target; }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { SootMethod target = ie.getMethod(); /* This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the definition of invokespecial. */ if (target.getName().equals("<init>") || target.isPrivate()) return target; else if (isSubclass(target.getDeclaringClass(), container.getDeclaringClass())) return resolveConcreteDispatch(container.getDeclaringClass(), target ); else return target; }
/** Returns true if the method m is visible from code in the class from. */ private boolean isVisible( SootClass from, SootMethod m ) { from.checkLevel(SootClass.HIERARCHY); if( m.isPublic() ) return true; if( m.isPrivate() ) { return from.equals( m.getDeclaringClass() ); } if( m.isProtected() ) { return canStoreClass( from, m.getDeclaringClass() ); } // m is package return from.getJavaPackageName().equals( m.getDeclaringClass().getJavaPackageName() ); //|| canStoreClass( from, m.getDeclaringClass() ); }
/** Returns true if the method m is visible from code in the class from. */ private boolean isVisible( SootClass from, SootMethod m ) { from.checkLevel(SootClass.HIERARCHY); if( m.isPublic() ) return true; if( m.isPrivate() ) { return from.equals( m.getDeclaringClass() ); } if( m.isProtected() ) { return canStoreClass( from, m.getDeclaringClass() ); } // m is package return from.getJavaPackageName().equals( m.getDeclaringClass().getJavaPackageName() ); //|| canStoreClass( from, m.getDeclaringClass() ); }
/** Returns true if the method m is visible from code in the class from. */ public boolean isVisible( SootClass from, SootMethod m ) { from.checkLevel(SootClass.HIERARCHY); m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); if( m.isPublic() ) return true; if( m.isPrivate() ) { return from.equals( m.getDeclaringClass() ); } if( m.isProtected() ) { return isClassSubclassOfIncluding( from, m.getDeclaringClass() ); } // m is package return from.getJavaPackageName().equals( m.getDeclaringClass().getJavaPackageName() ); //|| isClassSubclassOfIncluding( from, m.getDeclaringClass() ); }
/** Returns true if the method m is visible from code in the class from. */ public boolean isVisible( SootClass from, SootMethod m ) { from.checkLevel(SootClass.HIERARCHY); m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); if( m.isPublic() ) return true; if( m.isPrivate() ) { return from.equals( m.getDeclaringClass() ); } if( m.isProtected() ) { return isClassSubclassOfIncluding( from, m.getDeclaringClass() ); } // m is package return from.getJavaPackageName().equals( m.getDeclaringClass().getJavaPackageName() ); //|| isClassSubclassOfIncluding( from, m.getDeclaringClass() ); }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { container.getDeclaringClass().checkLevel(SootClass.HIERARCHY); SootMethod target = ie.getMethod(); target.getDeclaringClass().checkLevel(SootClass.HIERARCHY); /* This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the definition of invokespecial. */ if (target.getName().equals("<init>") || target.isPrivate()) return target; else if (isClassSubclassOf(target.getDeclaringClass(), container.getDeclaringClass())) return resolveConcreteDispatch(container.getDeclaringClass(), target); else return target; } }
/** Returns the target for the given SpecialInvokeExpr. */ public SootMethod resolveSpecialDispatch(SpecialInvokeExpr ie, SootMethod container) { container.getDeclaringClass().checkLevel(SootClass.HIERARCHY); SootMethod target = ie.getMethod(); target.getDeclaringClass().checkLevel(SootClass.HIERARCHY); /* This is a bizarre condition! Hopefully the implementation is correct. See VM Spec, 2nd Edition, Chapter 6, in the definition of invokespecial. */ if (target.getName().equals("<init>") || target.isPrivate()) return target; else if (isClassSubclassOf(target.getDeclaringClass(), container.getDeclaringClass())) return resolveConcreteDispatch(container.getDeclaringClass(), target); else return target; } }
if (currentMethod.isPrivate() || currentMethod.isProtected() || !currentMethod.isConstructor()) continue; constructors.add(currentMethod);
if (cons.isConstructor() && !cons.isPrivate()) { boolean isConstructorUsable = true;