Example #1
0
  private void markEnumOrInnerConstructorParameterAsSynthetic(MethodVisitor mv, int i) {
    // IDEA's ClsPsi builder fails to annotate synthetic parameters
    if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;

    // This is needed to avoid RuntimeInvisibleParameterAnnotations error in javac:
    // see MethodWriter.visitParameterAnnotation()

    AnnotationVisitor av = mv.visitParameterAnnotation(i, "Ljava/lang/Synthetic;", true);
    if (av != null) {
      av.visitEnd();
    }
  }
 private void writePackageFacadeMethodAnnotationsIfNeeded(MethodVisitor mv) {
   if (owner instanceof PackageFacadeContext) {
     PackageFacadeContext packageFacadeContext = (PackageFacadeContext) owner;
     Type delegateToClassType = packageFacadeContext.getPublicFacadeType();
     if (delegateToClassType != null) {
       String className = delegateToClassType.getClassName();
       AnnotationVisitor av =
           mv.visitAnnotation(
               AsmUtil.asmDescByFqNameWithoutInnerClasses(
                   JvmAnnotationNames.KOTLIN_DELEGATED_METHOD),
               true);
       av.visit(JvmAnnotationNames.IMPLEMENTATION_CLASS_NAME_FIELD_NAME, className);
       av.visitEnd();
     }
   }
 }