Write KotlinPackageFragment annotation to package$src classes

This commit is contained in:
Alexander Udalov
2013-09-19 21:29:35 +04:00
parent afa1f5c947
commit b42a3e6f6c
4 changed files with 94 additions and 0 deletions
@@ -194,6 +194,8 @@ public class NamespaceCodegen extends MemberCodegen {
);
builder.visitSource(file.getName(), null);
writeKotlinPackageFragmentAnnotation(builder);
FieldOwnerContext nameSpaceContext = CodegenContext.STATIC.intoNamespace(descriptor);
FieldOwnerContext nameSpacePart = CodegenContext.STATIC.intoNamespacePart(className, descriptor);
@@ -212,6 +214,12 @@ public class NamespaceCodegen extends MemberCodegen {
return builder;
}
private static void writeKotlinPackageFragmentAnnotation(@NotNull ClassBuilder builder) {
AnnotationVisitor av = builder.newAnnotation(JvmAnnotationNames.KOTLIN_PACKAGE_FRAGMENT.getDescriptor(), true);
av.visit(JvmAnnotationNames.ABI_VERSION_FIELD_NAME, JvmAbi.VERSION);
av.visitEnd();
}
public void generateClassOrObject(@NotNull JetClassOrObject classOrObject) {
CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
genClassOrObject(context, classOrObject);