Search in sources :

Example 1 with CallSite

use of jadx.api.plugins.input.data.impl.CallSite in project jadx by skylot.

the class ConstPoolReader method resolveMethodCallSite.

private CallSite resolveMethodCallSite(int bootstrapMthIdx, int nameIdx, int descIdx) {
    JavaBootstrapMethodsAttr bootstrapMethodsAttr = clsData.loadAttribute(data, JavaAttrType.BOOTSTRAP_METHODS);
    if (bootstrapMethodsAttr == null) {
        throw new JavaClassParseException("Unexpected missing BootstrapMethods attribute");
    }
    RawBootstrapMethod rawBootstrapMethod = bootstrapMethodsAttr.getList().get(bootstrapMthIdx);
    List<EncodedValue> values = new ArrayList<>(6);
    values.add(new EncodedValue(EncodedType.ENCODED_METHOD_HANDLE, getMethodHandle(rawBootstrapMethod.getMethodHandleIdx())));
    values.add(new EncodedValue(EncodedType.ENCODED_STRING, getUtf8(nameIdx)));
    values.add(new EncodedValue(EncodedType.ENCODED_METHOD_TYPE, DescriptorParser.parseToMethodProto(getUtf8(descIdx))));
    for (int argConstIdx : rawBootstrapMethod.getArgs()) {
        values.add(readAsEncodedValue(argConstIdx));
    }
    return new CallSite(values);
}
Also used : EncodedValue(jadx.api.plugins.input.data.annotations.EncodedValue) RawBootstrapMethod(jadx.plugins.input.java.data.attributes.types.data.RawBootstrapMethod) JavaClassParseException(jadx.plugins.input.java.utils.JavaClassParseException) ArrayList(java.util.ArrayList) ICallSite(jadx.api.plugins.input.data.ICallSite) CallSite(jadx.api.plugins.input.data.impl.CallSite) JavaBootstrapMethodsAttr(jadx.plugins.input.java.data.attributes.types.JavaBootstrapMethodsAttr)

Aggregations

ICallSite (jadx.api.plugins.input.data.ICallSite)1 EncodedValue (jadx.api.plugins.input.data.annotations.EncodedValue)1 CallSite (jadx.api.plugins.input.data.impl.CallSite)1 JavaBootstrapMethodsAttr (jadx.plugins.input.java.data.attributes.types.JavaBootstrapMethodsAttr)1 RawBootstrapMethod (jadx.plugins.input.java.data.attributes.types.data.RawBootstrapMethod)1 JavaClassParseException (jadx.plugins.input.java.utils.JavaClassParseException)1 ArrayList (java.util.ArrayList)1