Java Code Examples for org.objectweb.asm.MethodVisitor#visitAnnotationDefault()

The following examples show how to use org.objectweb.asm.MethodVisitor#visitAnnotationDefault() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: perfmark   File: PerfMarkTransformer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void visitEnd() {
  if (!perfmarkClassReader.clinitSeen && !perfmarkClassReader.matches.isEmpty()) {
    MethodVisitor mv =
        visitMethod(
            Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, "<clinit>", "()V", null, new String[0]);
    mv.visitAnnotationDefault();
    mv.visitCode();
    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(Integer.MAX_VALUE, Integer.MAX_VALUE);
    mv.visitEnd();
  }
  super.visitEnd();
}
 
Example 2
private void visitDefaultValue(ExecutableElement e, MethodVisitor methodVisitor) {
  AnnotationValue defaultValue = e.getDefaultValue();
  if (defaultValue == null) {
    return;
  }

  AnnotationVisitor annotationVisitor = methodVisitor.visitAnnotationDefault();
  visitAnnotationValue(null, defaultValue, annotationVisitor);
  annotationVisitor.visitEnd();
}
 
Example 3
Source Project: groovy   File: AsmClassGenerator.java    License: Apache License 2.0 4 votes vote down vote up
private void visitAnnotationDefault(final MethodNode node, final MethodVisitor mv) {
    if (!node.hasAnnotationDefault()) return;
    Expression exp = ((ReturnStatement) node.getCode()).getExpression();
    AnnotationVisitor av = mv.visitAnnotationDefault();
    visitAnnotationDefaultExpression(av,node.getReturnType(),exp);
}