Skip to content

MethodSignatureConverter

Jordan Samhi edited this page Oct 23, 2026 · 3 revisions

MethodSignatureConverter

com.jordansamhi.androspecter.MethodSignatureConverter extracts components from canonical Jimple method signatures. New code can construct an independent, stateless converter; v() remains available for older integrations.

Place the import at the top of your source file and run the remaining statements inside a method:

import com.jordansamhi.androspecter.MethodSignatureConverter;

var converter = new MethodSignatureConverter();
String signature = "<com.example.Source: java.lang.String read(int)>";
System.out.println(converter.getClassNameFromJimpleSignature(signature));
System.out.println(converter.getMethodNameFromJimpleSignature(signature));
System.out.println(converter.getReturnNameFromJimpleSignature(signature));
System.out.println(converter.getParametersNamesFromJimpleSignature(signature));
System.out.println(converter.sigToSubSig(signature));

Expected output:

com.example.Source
read
java.lang.String
[int]
java.lang.String read(int)

Supply a signature, not an invocation with concrete argument values appended. These helpers use simple splitting and substring operations: malformed input can throw, and noncanonical whitespace is not normalized. They are not a general JVM descriptor parser. javaSigToSootSig only removes the input's outer characters and replaces slashes with dots; it does not decode arbitrary JVM descriptors.

Use exact full Jimple signatures in source/sink definitions and graph queries.

Clone this wiki locally