From 977cd7608af4697b58b3638c5df10bc6cae1bae3 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Fri, 5 Jul 2013 20:55:35 +0400 Subject: [PATCH] Split KotlinInfo annotation into two: KotlinClass and KotlinPackage Two annotations are needed to properly distinguish package classes --- .../codegen/ImplementationBodyCodegen.java | 2 +- .../jet/codegen/NamespaceCodegen.java | 6 ++-- .../resolve/java/DescriptorResolverUtils.java | 10 +++++-- .../jet/lang/resolve/java/JvmStdlibNames.java | 7 +++-- .../AnnotationDescriptorDeserializer.java | 16 +++++----- .../DeserializedDescriptorResolver.java | 13 ++++----- .../java/resolver/JavaAnnotationResolver.java | 3 +- .../java/resolver/JavaNamespaceResolver.java | 29 +++++++++++-------- .../KotlinClassAnnotationTest.java} | 21 ++++++++------ ....java => KotlinPackageAnnotationTest.java} | 10 +++---- .../jet/{KotlinInfo.java => KotlinClass.java} | 2 +- runtime/src/jet/KotlinPackage.java | 27 +++++++++++++++++ 12 files changed, 95 insertions(+), 51 deletions(-) rename compiler/tests/org/jetbrains/jet/{descriptors/serialization/KotlinInfoForClassTest.java => codegen/KotlinClassAnnotationTest.java} (82%) rename compiler/tests/org/jetbrains/jet/codegen/{KotlinInfoForPackageTest.java => KotlinPackageAnnotationTest.java} (91%) rename runtime/src/jet/{KotlinInfo.java => KotlinClass.java} (96%) create mode 100644 runtime/src/jet/KotlinPackage.java diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index 94cbf5b479c..34771a11bec 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -226,7 +226,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { ClassData data = new ClassData(createNameResolver(serializer.getNameTable()), classProto); - AnnotationVisitor av = v.getVisitor().visitAnnotation(JvmStdlibNames.KOTLIN_INFO_CLASS.getDescriptor(), true); + AnnotationVisitor av = v.getVisitor().visitAnnotation(JvmStdlibNames.KOTLIN_CLASS.getDescriptor(), true); av.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION); AnnotationVisitor array = av.visitArray(JvmStdlibNames.KOTLIN_INFO_DATA_FIELD); for (String string : JavaProtoBufUtil.encodeBytes(data.toBytes())) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java index 52204b85b09..3c5aa208d5b 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java @@ -129,12 +129,12 @@ public class NamespaceCodegen extends MemberCodegen { } } - writeKotlinInfoIfNeeded(MemberMap.union(namespaceMembers)); + writeKotlinPackageAnnotationIfNeeded(MemberMap.union(namespaceMembers)); assert v.isActivated() == shouldGenerateNSClass(files) : "Different algorithms for generating namespace class and for heuristics"; } - private void writeKotlinInfoIfNeeded(@NotNull MemberMap members) { + private void writeKotlinPackageAnnotationIfNeeded(@NotNull MemberMap members) { DescriptorSerializer serializer = new DescriptorSerializer(new JavaSerializerExtension(members)); ProtoBuf.Package.Builder packageProto = ProtoBuf.Package.newBuilder(); boolean writeAnnotation = false; @@ -168,7 +168,7 @@ public class NamespaceCodegen extends MemberCodegen { PackageData data = new PackageData(createNameResolver(serializer.getNameTable()), packageProto.build()); - AnnotationVisitor av = v.getClassBuilder().newAnnotation(JvmStdlibNames.KOTLIN_INFO_CLASS.getDescriptor(), true); + AnnotationVisitor av = v.getClassBuilder().newAnnotation(JvmStdlibNames.KOTLIN_PACKAGE.getDescriptor(), true); av.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION); AnnotationVisitor array = av.visitArray(JvmStdlibNames.KOTLIN_INFO_DATA_FIELD); for (String string : JavaProtoBufUtil.encodeBytes(data.toBytes())) { diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/DescriptorResolverUtils.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/DescriptorResolverUtils.java index c81e4fad3bb..e2513f73d8b 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/DescriptorResolverUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/DescriptorResolverUtils.java @@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.resolve.constants.StringValue; import org.jetbrains.jet.lang.resolve.java.kt.PsiAnnotationWithFlags; -import org.jetbrains.jet.lang.resolve.java.wrapper.PsiClassWrapper; import org.jetbrains.jet.lang.resolve.java.wrapper.PsiMemberWrapper; import org.jetbrains.jet.lang.resolve.java.wrapper.PsiMethodWrapper; import org.jetbrains.jet.lang.resolve.name.FqName; @@ -46,9 +45,14 @@ public final class DescriptorResolverUtils { private DescriptorResolverUtils() { } + //TODO: check that method is used properly public static boolean isKotlinClass(@NotNull PsiClass psiClass) { - PsiClassWrapper wrapper = new PsiClassWrapper(psiClass); - return wrapper.getJetClass().isDefined() || wrapper.getJetPackageClass().isDefined(); + PsiModifierList modifierList = psiClass.getModifierList(); + if (modifierList == null) { + return false; + } + PsiAnnotation kotlinClassAnnotation = modifierList.findAnnotation(JvmStdlibNames.KOTLIN_CLASS.getFqName().asString()); + return kotlinClassAnnotation != null; } @NotNull diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java index b9cc7169c8b..6ff1204552b 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java @@ -16,7 +16,8 @@ package org.jetbrains.jet.lang.resolve.java; -import jet.KotlinInfo; +import jet.KotlinClass; +import jet.KotlinPackage; import jet.runtime.typeinfo.JetConstructor; public class JvmStdlibNames { @@ -69,7 +70,9 @@ public class JvmStdlibNames { */ public static final String JET_CONSTRUCTOR_HIDDEN_FIELD = "hidden"; - public static final JvmClassName KOTLIN_INFO_CLASS = JvmClassName.byFqNameWithoutInnerClasses(KotlinInfo.class.getCanonicalName()); + public static final JvmClassName KOTLIN_CLASS = JvmClassName.byFqNameWithoutInnerClasses(KotlinClass.class.getCanonicalName()); + + public static final JvmClassName KOTLIN_PACKAGE = JvmClassName.byFqNameWithoutInnerClasses(KotlinPackage.class.getCanonicalName()); public static final JvmClassName JET_CLASS = JvmClassName.byFqNameWithoutInnerClasses("jet.runtime.typeinfo.JetClass"); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/AnnotationDescriptorDeserializer.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/AnnotationDescriptorDeserializer.java index 4a590f5ef8c..dd74aa0369f 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/AnnotationDescriptorDeserializer.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/AnnotationDescriptorDeserializer.java @@ -33,10 +33,7 @@ import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; -import org.jetbrains.jet.lang.resolve.java.DescriptorResolverUtils; -import org.jetbrains.jet.lang.resolve.java.JvmAbi; -import org.jetbrains.jet.lang.resolve.java.PackageClassUtils; -import org.jetbrains.jet.lang.resolve.java.PsiClassFinder; +import org.jetbrains.jet.lang.resolve.java.*; import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.utils.ExceptionUtils; @@ -133,7 +130,9 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer private static boolean ignoreAnnotation(@NotNull String desc) { // TODO: JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION ? - return desc.equals(DeserializedDescriptorResolver.KOTLIN_INFO_TYPE) || desc.startsWith("Ljet/runtime/typeinfo/"); + return desc.equals(JvmStdlibNames.KOTLIN_CLASS.getDescriptor()) + || desc.equals(JvmStdlibNames.KOTLIN_PACKAGE.getDescriptor()) + || desc.startsWith("Ljet/runtime/typeinfo/"); } @NotNull @@ -223,7 +222,8 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer @NotNull private Map> loadMemberAnnotationsFromFile(@NotNull VirtualFile file) throws IOException { - final Map> memberAnnotations = new HashMap>(); + final Map> memberAnnotations = + new HashMap>(); new ClassReader(file.getInputStream()).accept(new ClassVisitor(Opcodes.ASM4) { @Override @@ -291,7 +291,9 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer else if (syntheticMethodName != null) { return fromMethodNameAndDesc(syntheticMethodName, JvmAbi.ANNOTATED_PROPERTY_METHOD_SIGNATURE); } - else return null; + else { + return null; + } } @Nullable diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/DeserializedDescriptorResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/DeserializedDescriptorResolver.java index d3f299415ea..6b52b3db222 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/DeserializedDescriptorResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/DeserializedDescriptorResolver.java @@ -51,7 +51,6 @@ import static org.jetbrains.jet.lang.resolve.java.resolver.DeserializedResolverU import static org.jetbrains.jet.lang.resolve.java.resolver.DeserializedResolverUtils.kotlinFqNameToJavaFqName; public final class DeserializedDescriptorResolver { - public static final String KOTLIN_INFO_TYPE = JvmStdlibNames.KOTLIN_INFO_CLASS.getAsmType().toString(); private AnnotationDescriptorDeserializer annotationDeserializer; @@ -140,8 +139,7 @@ public final class DeserializedDescriptorResolver { DeclarationDescriptor owner = classId.isTopLevelClass() ? javaNamespaceResolver.resolveNamespace(classId.getPackageFqName(), INCLUDE_KOTLIN) - : javaClassResolver - .resolveClass(kotlinFqNameToJavaFqName(classId.getOuterClassId().asSingleFqName())); + : javaClassResolver.resolveClass(kotlinFqNameToJavaFqName(classId.getOuterClassId().asSingleFqName())); assert owner != null : "No owner found for " + classId; return new DeserializedClassDescriptor(classId, storageManager, owner, classData.getNameResolver(), @@ -204,8 +202,9 @@ public final class DeserializedDescriptorResolver { private String[] data = null; @Override - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - if (!desc.equals(KOTLIN_INFO_TYPE)) { + public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { + if (!desc.equals(JvmStdlibNames.KOTLIN_CLASS.getDescriptor()) && + !desc.equals(JvmStdlibNames.KOTLIN_PACKAGE.getDescriptor())) { return null; } @@ -216,7 +215,7 @@ public final class DeserializedDescriptorResolver { version = (Integer) value; } else if (isAbiVersionCompatible(version)) { - throw new IllegalStateException("Unexpected argument " + name + " for annotation " + KOTLIN_INFO_TYPE); + throw new IllegalStateException("Unexpected argument " + name + " for annotation " + desc); } } @@ -226,7 +225,7 @@ public final class DeserializedDescriptorResolver { return stringArrayVisitor(); } else if (isAbiVersionCompatible(version)) { - throw new IllegalStateException("Unexpected array argument " + name + " for annotation " + KOTLIN_INFO_TYPE); + throw new IllegalStateException("Unexpected array argument " + name + " for annotation " + desc); } return super.visitArray(name); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaAnnotationResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaAnnotationResolver.java index e13dc885a03..3a0106b667d 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaAnnotationResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaAnnotationResolver.java @@ -83,7 +83,8 @@ public final class JavaAnnotationResolver { // Don't process internal jet annotations and jetbrains NotNull annotations if (qname.startsWith("jet.runtime.typeinfo.") || qname.equals(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString()) - || qname.equals(JvmStdlibNames.KOTLIN_INFO_CLASS.getFqName().asString()) + || qname.equals(JvmStdlibNames.KOTLIN_CLASS.getFqName().asString()) + || qname.equals(JvmStdlibNames.KOTLIN_PACKAGE.getFqName().asString()) ) { return null; } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaNamespaceResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaNamespaceResolver.java index a0a145940d9..48ad8c6e183 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaNamespaceResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaNamespaceResolver.java @@ -166,14 +166,14 @@ public final class JavaNamespaceResolver { trace.record(JavaBindingContext.JAVA_NAMESPACE_KIND, namespaceDescriptor, JavaNamespaceKind.PROPER); if (psiClass != null) { - boolean compiledKotlinClass = isCompiledKotlinClass(psiClass); - if (isOldKotlinPackageClass(psiClass) && !compiledKotlinClass) { - // If psiClass has old annotations (@JetPackage) but doesn't have @KotlinInfo, report ABI version error + boolean hasKotlinPackageAnnotation = hasKotlinPackageAnnotation(psiClass); + if (isOldKotlinPackageClass(psiClass) && !hasKotlinPackageAnnotation) { + // If psiClass has old annotations (@JetPackage) but doesn't have @KotlinPackage, report ABI version error AbiVersionUtil.checkAbiVersion(psiClass, INVALID_VERSION, trace); } - if (compiledKotlinClass) { - // If psiClass has @KotlinInfo (regardless of whether it has @JetPackage or not), deserialize it to Kotlin descriptor. - // Note that @KotlinInfo may still have an old ABI version, in which case null is returned by createKotlinPackageScope + if (hasKotlinPackageAnnotation) { + // If psiClass has @KotlinPackage (regardless of whether it has @JetPackage or not), deserialize it to Kotlin descriptor. + // Note that @KotlinPackage may still have an old ABI version, in which case null is returned by createKotlinPackageScope JetScope kotlinPackageScope = deserializedDescriptorResolver.createKotlinPackageScope(psiClass, namespaceDescriptor); if (kotlinPackageScope != null) return kotlinPackageScope; } @@ -205,15 +205,20 @@ public final class JavaNamespaceResolver { return new PsiClassWrapper(psiClass).getJetPackageClass().isDefined(); } - private static boolean isCompiledKotlinClass(@NotNull PsiClass psiClass) { + private static boolean hasKotlinPackageAnnotation(@NotNull PsiClass psiClass) { // TODO: merge this method with DescriptorResolverUtils#isKotlinClass // NOTE: we need to check against ClsClassImpl because it can be a Java source, pretending to be a Kotlin class. // In that case we can't really read the annotation from psiClass's virtual file - if (psiClass instanceof ClsClassImpl) { - PsiModifierList list = psiClass.getModifierList(); - if (list != null) { - return list.findAnnotation(JvmStdlibNames.KOTLIN_INFO_CLASS.getFqName().asString()) != null; - } + if (!(psiClass instanceof ClsClassImpl)) { + return false; + } + return hasAnnotation(psiClass, JvmStdlibNames.KOTLIN_PACKAGE.getFqName()); + } + + private static boolean hasAnnotation(@NotNull PsiClass psiClass, @NotNull FqName annotationFqName) { + PsiModifierList list = psiClass.getModifierList(); + if (list != null) { + return list.findAnnotation(annotationFqName.asString()) != null; } return false; } diff --git a/compiler/tests/org/jetbrains/jet/descriptors/serialization/KotlinInfoForClassTest.java b/compiler/tests/org/jetbrains/jet/codegen/KotlinClassAnnotationTest.java similarity index 82% rename from compiler/tests/org/jetbrains/jet/descriptors/serialization/KotlinInfoForClassTest.java rename to compiler/tests/org/jetbrains/jet/codegen/KotlinClassAnnotationTest.java index 97cb18b6e91..44c65d27744 100644 --- a/compiler/tests/org/jetbrains/jet/descriptors/serialization/KotlinInfoForClassTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/KotlinClassAnnotationTest.java @@ -14,14 +14,17 @@ * limitations under the License. */ -package org.jetbrains.jet.descriptors.serialization; +package org.jetbrains.jet.codegen; -import jet.KotlinInfo; +import jet.KotlinClass; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.JetTestUtils; -import org.jetbrains.jet.codegen.CodegenTestCase; +import org.jetbrains.jet.descriptors.serialization.AbstractDescriptorFinder; +import org.jetbrains.jet.descriptors.serialization.ClassData; +import org.jetbrains.jet.descriptors.serialization.ClassId; +import org.jetbrains.jet.descriptors.serialization.JavaProtoBufUtil; import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor; @@ -32,7 +35,7 @@ import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import java.io.IOException; -public class KotlinInfoForClassTest extends CodegenTestCase { +public class KotlinClassAnnotationTest extends CodegenTestCase { public static final FqName NAMESPACE_NAME = new FqName("test"); public static final FqNameUnsafe CLASS_NAME = new FqNameUnsafe("A"); @@ -51,10 +54,10 @@ public class KotlinInfoForClassTest extends CodegenTestCase { "}\n"); Class aClass = generateClass(NAMESPACE_NAME + "." + CLASS_NAME); - assertTrue(aClass.isAnnotationPresent(KotlinInfo.class)); - KotlinInfo kotlinInfo = (KotlinInfo) aClass.getAnnotation(KotlinInfo.class); + assertTrue(aClass.isAnnotationPresent(KotlinClass.class)); + KotlinClass kotlinClass = (KotlinClass) aClass.getAnnotation(KotlinClass.class); - AbstractDescriptorFinder descriptorFinder = new KotlinInfoBasedDescriptorFinder(kotlinInfo); + AbstractDescriptorFinder descriptorFinder = new KotlinInfoBasedDescriptorFinder(kotlinClass); ClassDescriptor descriptor = descriptorFinder.findClass(new ClassId(NAMESPACE_NAME, CLASS_NAME)); assertNotNull(descriptor); @@ -65,10 +68,10 @@ public class KotlinInfoForClassTest extends CodegenTestCase { private final ClassData classData; private final NamespaceDescriptorImpl namespace; - public KotlinInfoBasedDescriptorFinder(@NotNull KotlinInfo kotlinInfo) throws IOException { + public KotlinInfoBasedDescriptorFinder(@NotNull KotlinClass kotlinClass) throws IOException { super(new LockBasedStorageManager(), AnnotationDeserializer.UNSUPPORTED); - this.classData = JavaProtoBufUtil.readClassDataFrom(kotlinInfo.data()); + this.classData = JavaProtoBufUtil.readClassDataFrom(kotlinClass.data()); this.namespace = JetTestUtils.createTestNamespace(NAMESPACE_NAME.shortName()); } diff --git a/compiler/tests/org/jetbrains/jet/codegen/KotlinInfoForPackageTest.java b/compiler/tests/org/jetbrains/jet/codegen/KotlinPackageAnnotationTest.java similarity index 91% rename from compiler/tests/org/jetbrains/jet/codegen/KotlinInfoForPackageTest.java rename to compiler/tests/org/jetbrains/jet/codegen/KotlinPackageAnnotationTest.java index 0d2ae84d778..00818809995 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/KotlinInfoForPackageTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/KotlinPackageAnnotationTest.java @@ -16,7 +16,7 @@ package org.jetbrains.jet.codegen; -import jet.KotlinInfo; +import jet.KotlinPackage; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.descriptors.serialization.JavaProtoBufUtil; @@ -30,7 +30,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -public class KotlinInfoForPackageTest extends CodegenTestCase { +public class KotlinPackageAnnotationTest extends CodegenTestCase { public static final FqName NAMESPACE_NAME = new FqName("test"); @Override @@ -50,10 +50,10 @@ public class KotlinInfoForPackageTest extends CodegenTestCase { "object C\n"); Class aClass = generateClass(PackageClassUtils.getPackageClassFqName(NAMESPACE_NAME).asString()); - assertTrue(aClass.isAnnotationPresent(KotlinInfo.class)); - KotlinInfo kotlinInfo = (KotlinInfo) aClass.getAnnotation(KotlinInfo.class); + assertTrue(aClass.isAnnotationPresent(KotlinPackage.class)); + KotlinPackage kotlinPackage = (KotlinPackage) aClass.getAnnotation(KotlinPackage.class); - PackageData data = JavaProtoBufUtil.readPackageDataFrom(kotlinInfo.data()); + PackageData data = JavaProtoBufUtil.readPackageDataFrom(kotlinPackage.data()); Set classNames = collectClassNames(data); assertSameElements(Arrays.asList("A", "B", "C"), classNames); diff --git a/runtime/src/jet/KotlinInfo.java b/runtime/src/jet/KotlinClass.java similarity index 96% rename from runtime/src/jet/KotlinInfo.java rename to runtime/src/jet/KotlinClass.java index b0a77ced52f..8780c1d77c6 100644 --- a/runtime/src/jet/KotlinInfo.java +++ b/runtime/src/jet/KotlinClass.java @@ -20,7 +20,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) -public @interface KotlinInfo { +public @interface KotlinClass { int abiVersion(); String[] data(); diff --git a/runtime/src/jet/KotlinPackage.java b/runtime/src/jet/KotlinPackage.java new file mode 100644 index 00000000000..c14818ffb5c --- /dev/null +++ b/runtime/src/jet/KotlinPackage.java @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jet; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface KotlinPackage { + int abiVersion(); + + String[] data(); +}