Allow Redirect annotations to work on fields as well

This commit is contained in:
Mumfrey committed 2016-02-02 18:30:23 +00:00
1 parent 19272e1170
commit 5a79cacc14
7 files changed
+295 -15

No files matched your search

@@ -898,4 +898,49 @@ public class ASMHelper {
return labels;
}
/**
* @param obfType
* @param returnType
* @param args
*/
public static String generateDescriptor(/*int obfType, */Object returnType, Object... args)
{
StringBuilder sb = new StringBuilder().append('(');
for (Object arg : args)
{
sb.append(ASMHelper.toDescriptor(/*obfType, */arg));
}
return sb.append(')').append(returnType != null ? ASMHelper.toDescriptor(/*obfType, */returnType) : "V").toString();
}
/**
* @param obfType
* @param arg
*/
private static String toDescriptor(/*int obfType, */Object arg)
{
// if (arg instanceof Obf)
// {
// return ((Obf)arg).getDescriptor(obfType);
// }
// else
if (arg instanceof String)
{
return (String)arg;
}
else if (arg instanceof Type)
{
return arg.toString();
}
else if (arg instanceof Class)
{
return Type.getDescriptor((Class<?>)arg).toString();
}
return arg == null ? "" : arg.toString();
}
}