Search in sources :

Example 1 with AnnotatedSimple

use of org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple in project kotlin by JetBrains.

the class MemberCodegen method generateSyntheticAnnotationsMethod.

protected void generateSyntheticAnnotationsMethod(@NotNull MemberDescriptor descriptor, @NotNull Method syntheticMethod, @NotNull Annotations annotations, @Nullable AnnotationUseSiteTarget allowedTarget) {
    int flags = ACC_DEPRECATED | ACC_STATIC | ACC_SYNTHETIC | AsmUtil.getVisibilityAccessFlag(descriptor);
    MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), flags, syntheticMethod.getName(), syntheticMethod.getDescriptor(), null, null);
    AnnotationCodegen.forMethod(mv, this, typeMapper).genAnnotations(new AnnotatedSimple(annotations), Type.VOID_TYPE, allowedTarget);
    mv.visitCode();
    mv.visitInsn(Opcodes.RETURN);
    mv.visitEnd();
}
Also used : AnnotatedSimple(org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple)

Example 2 with AnnotatedSimple

use of org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple in project kotlin by JetBrains.

the class PackagePartCodegen method generateAnnotationsForPartClass.

private void generateAnnotationsForPartClass() {
    List<AnnotationDescriptor> fileAnnotationDescriptors = new ArrayList<AnnotationDescriptor>();
    for (KtAnnotationEntry annotationEntry : element.getAnnotationEntries()) {
        AnnotationDescriptor annotationDescriptor = state.getBindingContext().get(BindingContext.ANNOTATION, annotationEntry);
        if (annotationDescriptor != null) {
            fileAnnotationDescriptors.add(annotationDescriptor);
        }
    }
    Annotated annotatedFile = new AnnotatedSimple(new AnnotationsImpl(fileAnnotationDescriptors));
    AnnotationCodegen.forClass(v.getVisitor(), this, state.getTypeMapper()).genAnnotations(annotatedFile, null);
}
Also used : AnnotationDescriptor(org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor) Annotated(org.jetbrains.kotlin.descriptors.annotations.Annotated) ArrayList(java.util.ArrayList) AnnotatedSimple(org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple) AnnotationsImpl(org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl)

Aggregations

AnnotatedSimple (org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple)2 ArrayList (java.util.ArrayList)1 Annotated (org.jetbrains.kotlin.descriptors.annotations.Annotated)1 AnnotationDescriptor (org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor)1 AnnotationsImpl (org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl)1