Support constraints on injector annotations, bump to 0.5.8, closes #135

This commit is contained in:
Mumfrey committed 2016-06-15 16:59:28 +01:00
1 parent 45cf3d6ced
commit 19ca12970a
12 files changed
+179 -57

No files matched your search

@@ -1026,7 +1026,7 @@ public class ASMHelper {
}
public static String getSimpleName(Class<? extends Annotation> annotationType) {
return String.format("@%s", annotationType.getSimpleName());
return annotationType.getSimpleName();
}
public static String getSimpleName(AnnotationNode annotation) {
@@ -1085,4 +1085,38 @@ public class ASMHelper {
int index = Ints.indexOf(ASMHelper.CONSTANTS_ALL, insn.getOpcode());
return index < 0 ? null : Type.getType(ASMHelper.CONSTANTS_TYPES[index]);
}
/**
* Check whether the specified flag is set on the specified class
*
* @param classNode
* @param flag
* @return True if the specified flag is set in this method's access flags
*/
public static boolean hasFlag(ClassNode classNode, int flag) {
return (classNode.access & flag) == flag;
}
/**
* Check whether the specified flag is set on the specified method
*
* @param method
* @param flag
* @return True if the specified flag is set in this method's access flags
*/
public static boolean hasFlag(MethodNode method, int flag) {
return (method.access & flag) == flag;
}
/**
* Check whether the specified flag is set on the specified field
*
* @param field
* @param flag
* @return True if the specified flag is set in this field's access flags
*/
public static boolean hasFlag(FieldNode field, int flag) {
return (field.access & flag) == flag;
}
}