use of org.objectweb.asm.AnnotationVisitor in project presto by prestodb.
the class AnnotationDefinition method visitMethodAnnotation.
public void visitMethodAnnotation(MethodVisitor visitor) {
AnnotationVisitor annotationVisitor = visitor.visitAnnotation(type.getType(), true);
visit(annotationVisitor);
annotationVisitor.visitEnd();
}
use of org.objectweb.asm.AnnotationVisitor in project presto by prestodb.
the class AnnotationDefinition method visitParameterAnnotation.
public void visitParameterAnnotation(int parameterIndex, MethodVisitor visitor) {
AnnotationVisitor annotationVisitor = visitor.visitParameterAnnotation(parameterIndex, type.getType(), true);
visit(annotationVisitor);
annotationVisitor.visitEnd();
}
use of org.objectweb.asm.AnnotationVisitor in project quasar by puniverse.
the class InstrumentClass method emitInstrumentedAnn.
private void emitInstrumentedAnn() {
final AnnotationVisitor instrumentedAV = visitAnnotation(INSTRUMENTED_DESC, true);
instrumentedAV.visitEnd();
}
use of org.objectweb.asm.AnnotationVisitor in project quasar by puniverse.
the class AnnotationUtil method hasClassAnnotation.
private static boolean hasClassAnnotation(Class<? extends Annotation> annClass, ClassReader r) {
// annotationName = annotationName.replace('.', '/');
final String annDesc = Type.getDescriptor(annClass);
final AtomicBoolean res = new AtomicBoolean(false);
r.accept(new ClassVisitor(ASMAPI) {
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
}
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (desc.equals(annDesc))
res.set(true);
return null;
}
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);
return res.get();
}
use of org.objectweb.asm.AnnotationVisitor in project robovm by robovm.
the class InterfaceBuilderClassesPlugin method getCustomClass.
private String getCustomClass(URL url, Map<URL, String> customClassValuesCache) throws IOException {
if (customClassValuesCache.containsKey(url)) {
return customClassValuesCache.get(url);
}
class Visitor extends ClassVisitor {
String customClass;
Visitor() {
super(Opcodes.ASM4);
}
@Override
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
if (CUSTOM_CLASS.equals(desc)) {
return new AnnotationVisitor(Opcodes.ASM4) {
public void visit(String name, Object value) {
customClass = (String) value;
}
};
}
return super.visitAnnotation(desc, visible);
}
}
Visitor visitor = new Visitor();
new ClassReader(IOUtils.toByteArray(url)).accept(visitor, 0);
customClassValuesCache.put(url, visitor.customClass);
return visitor.customClass;
}
Aggregations