feat: initial support for 'invoke-custom' instruction (#384)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
package jadx.api.plugins.input.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jadx.api.plugins.input.data.annotations.EncodedValue;
|
||||
|
||||
public interface ICallSite {
|
||||
|
||||
List<EncodedValue> getValues();
|
||||
|
||||
void load();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package jadx.api.plugins.input.data;
|
||||
|
||||
public interface IMethodHandle {
|
||||
|
||||
MethodHandleType getType();
|
||||
|
||||
IFieldData getFieldRef();
|
||||
|
||||
IMethodRef getMethodRef();
|
||||
|
||||
void load();
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package jadx.api.plugins.input.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMethodProto {
|
||||
|
||||
String getReturnType();
|
||||
|
||||
List<String> getArgTypes();
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package jadx.api.plugins.input.data;
|
||||
|
||||
public enum MethodHandleType {
|
||||
STATIC_PUT,
|
||||
STATIC_GET,
|
||||
INSTANCE_PUT,
|
||||
INSTANCE_GET,
|
||||
INVOKE_STATIC,
|
||||
INVOKE_INSTANCE,
|
||||
INVOKE_DIRECT,
|
||||
INVOKE_CONSTRUCTOR,
|
||||
INVOKE_INTERFACE;
|
||||
|
||||
public boolean isField() {
|
||||
switch (this) {
|
||||
case STATIC_PUT:
|
||||
case STATIC_GET:
|
||||
case INSTANCE_PUT:
|
||||
case INSTANCE_GET:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -15,6 +15,8 @@ public enum EncodedType {
|
||||
ENCODED_ENUM,
|
||||
ENCODED_FIELD,
|
||||
ENCODED_METHOD,
|
||||
ENCODED_METHOD_TYPE,
|
||||
ENCODED_METHOD_HANDLE,
|
||||
ENCODED_ARRAY,
|
||||
ENCODED_ANNOTATION
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package jadx.api.plugins.input.data.impl;
|
||||
|
||||
import jadx.api.plugins.input.data.IFieldData;
|
||||
import jadx.api.plugins.input.data.IMethodHandle;
|
||||
import jadx.api.plugins.input.data.IMethodRef;
|
||||
import jadx.api.plugins.input.data.MethodHandleType;
|
||||
|
||||
public class FieldRefHandle implements IMethodHandle {
|
||||
|
||||
private final IFieldData fieldRef;
|
||||
private final MethodHandleType type;
|
||||
|
||||
public FieldRefHandle(MethodHandleType type, IFieldData fieldRef) {
|
||||
this.fieldRef = fieldRef;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodHandleType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFieldData getFieldRef() {
|
||||
return fieldRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMethodRef getMethodRef() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
// already loaded
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package jadx.api.plugins.input.data.impl;
|
||||
|
||||
import jadx.api.plugins.input.data.IFieldData;
|
||||
import jadx.api.plugins.input.data.IMethodHandle;
|
||||
import jadx.api.plugins.input.data.IMethodRef;
|
||||
import jadx.api.plugins.input.data.MethodHandleType;
|
||||
|
||||
public class MethodRefHandle implements IMethodHandle {
|
||||
|
||||
private final IMethodRef methodRef;
|
||||
private final MethodHandleType type;
|
||||
|
||||
public MethodRefHandle(MethodHandleType type, IMethodRef methodRef) {
|
||||
this.methodRef = methodRef;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodHandleType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMethodRef getMethodRef() {
|
||||
return methodRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFieldData getFieldRef() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
methodRef.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return type + ": " + methodRef;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package jadx.api.plugins.input.insns;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import jadx.api.plugins.input.data.ICallSite;
|
||||
import jadx.api.plugins.input.data.IFieldData;
|
||||
import jadx.api.plugins.input.data.IMethodRef;
|
||||
import jadx.api.plugins.input.insns.custom.ICustomPayload;
|
||||
@@ -36,6 +37,8 @@ public interface InsnData {
|
||||
|
||||
IMethodRef getIndexAsMethod();
|
||||
|
||||
ICallSite getIndexAsCallSite();
|
||||
|
||||
@Nullable
|
||||
ICustomPayload getPayload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user