Executor work
This commit is contained in:
@@ -19,4 +19,14 @@ public class Method extends PoolEntry
|
||||
classIndex = is.readUnsignedShort();
|
||||
nameAndTypeIndex = is.readUnsignedShort();
|
||||
}
|
||||
|
||||
public Class getClassEntry()
|
||||
{
|
||||
return (Class) this.getPool().getEntry(classIndex);
|
||||
}
|
||||
|
||||
public NameAndType getNameAndType()
|
||||
{
|
||||
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import info.sigterm.deob.ConstantPool;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class NameAndType extends PoolEntry
|
||||
{
|
||||
@@ -57,4 +59,24 @@ public class NameAndType extends PoolEntry
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Pattern allParamsPattern = Pattern.compile("(\\(.*?\\))");
|
||||
private static Pattern paramsPattern = Pattern.compile("(\\[?)(B|C|Z|S|I|J|F|D|(:?L[^;]+;))");
|
||||
|
||||
public int getNumberOfArgs()
|
||||
{
|
||||
java.lang.String methodRefType = this.getDescriptor();
|
||||
Matcher m = allParamsPattern.matcher(methodRefType);
|
||||
if (!m.find())
|
||||
throw new IllegalArgumentException("Method signature does not contain parameters");
|
||||
|
||||
java.lang.String paramsDescriptor = m.group(1);
|
||||
Matcher mParam = paramsPattern.matcher(paramsDescriptor);
|
||||
|
||||
int count = 0;
|
||||
while (mParam.find())
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user