Package sootup.callgraph
Class SignaturePolymorphicMethods
java.lang.Object
sootup.callgraph.SignaturePolymorphicMethods
Resolution of signature-polymorphic methods (JVMS 2.9.3, 5.4.3.3), e.g.
MethodHandle.invokeExact, VarHandle.get, MethodHandle.linkToStatic.
Call site keeps its own descriptor, e.g. invokeExact(String,String,int)int; declared
method is native varargs invokeExact(Object[])Object. Plain sub-signature lookup misses.
Rule: declared in java.lang.invoke.MethodHandle or VarHandle, single
Object[] param, ACC_VARARGS | ACC_NATIVE, and only method of that name in the class.
Flags, not the package-private @PolymorphicSignature annotation.
Cost: callers ask only after a regular lookup missed. Non-holder classes rejected by two string compares on already-stored names (no FQN allocation).
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanjava.lang.invoke.MethodHandleorjava.lang.invoke.VarHandle.static booleanisSignaturePolymorphic(@NonNull SootMethod method) Whethermethodis signature polymorphic per JVMS 2.9.3.static @NonNull Optional<? extends SootMethod>Resolves signature-polymorphic methodnamedeclared inholder.static @NonNull Optional<? extends SootMethod>resolve(@NonNull View view, @NonNull MethodSignature callSite) Resolves the declared signature-polymorphic methodcallSiterefers to.static @NonNull Optional<? extends SootMethod>resolveInHierarchy(@NonNull View view, @NonNull SootClass start, @NonNull String name) Likeresolve(SootClass, String), but walks superclasses fromstart(JVMS 5.4.3.3 step 3): call-site owner may be a JDK-internal subclass, e.g.
-
Method Details
-
isHolder
java.lang.invoke.MethodHandleorjava.lang.invoke.VarHandle. -
isSignaturePolymorphic
Whethermethodis signature polymorphic per JVMS 2.9.3. -
resolve
public static @NonNull Optional<? extends SootMethod> resolve(@NonNull View view, @NonNull MethodSignature callSite) Resolves the declared signature-polymorphic methodcallSiterefers to.- Returns:
- declared method, or empty if
callSitenames no such method or the holder class is not in the view
-
resolveInHierarchy
public static @NonNull Optional<? extends SootMethod> resolveInHierarchy(@NonNull View view, @NonNull SootClass start, @NonNull String name) Likeresolve(SootClass, String), but walks superclasses fromstart(JVMS 5.4.3.3 step 3): call-site owner may be a JDK-internal subclass, e.g.BoundMethodHandle.invokeBasic. -
resolve
public static @NonNull Optional<? extends SootMethod> resolve(@NonNull SootClass holder, @NonNull String name) Resolves signature-polymorphic methodnamedeclared inholder.- Returns:
- declared method, or empty if
holderis no holder class or has no such method
-