Executor work

This commit is contained in:
Adam
2015-01-26 00:40:54 -05:00
parent a998491133
commit 55dca4fa9b
148 changed files with 512 additions and 194 deletions

View File

@@ -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);
}
}

View File

@@ -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;
}
}