Move jet.Kotlin* annotations to package "kotlin.jvm.internal"

Also rename poorly named KotlinPackageFragment -> KotlinPackagePart
This commit is contained in:
Alexander Udalov
2014-02-14 17:58:19 +04:00
parent 0da92e22a2
commit aef0fabd53
14 changed files with 53 additions and 61 deletions
@@ -77,7 +77,7 @@ public class PackagePartCodegen extends MemberCodegen {
);
v.visitSource(jetFile.getName(), null);
writeKotlinPackageFragmentAnnotation();
writeKotlinPackagePartAnnotation();
for (JetDeclaration declaration : jetFile.getDeclarations()) {
if (declaration instanceof JetNamedFunction || declaration instanceof JetProperty) {
@@ -90,8 +90,8 @@ public class PackagePartCodegen extends MemberCodegen {
v.done();
}
private void writeKotlinPackageFragmentAnnotation() {
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_PACKAGE_FRAGMENT), true);
private void writeKotlinPackagePartAnnotation() {
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_PACKAGE_PART), true);
av.visit(JvmAnnotationNames.ABI_VERSION_FIELD_NAME, JvmAbi.VERSION);
av.visitEnd();
}
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
import java.lang.annotation.Annotation;
public class KotlinPackageFragmentAnnotationTest extends CodegenTestCase {
public class KotlinPackagePartAnnotationTest extends CodegenTestCase {
public static final FqName PACKAGE_NAME = new FqName("test");
@Override
@@ -36,7 +36,7 @@ public class KotlinPackageFragmentAnnotationTest extends CodegenTestCase {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
}
public void testKotlinPackageFragmentIsWritten() throws Exception {
public void testKotlinPackagePartAnnotationIsWritten() throws Exception {
loadText("package " + PACKAGE_NAME + "\n\nfun foo() = 42\n");
String facadeFileName = JvmClassName.byFqNameWithoutInnerClasses(PackageClassUtils.getPackageClassFqName(PACKAGE_NAME)).getInternalName() + ".class";
@@ -45,26 +45,26 @@ public class KotlinPackageFragmentAnnotationTest extends CodegenTestCase {
String filePath = outputFile.getRelativePath();
if (!filePath.equals(facadeFileName)) {
// The file which is not a facade is a package fragment
// The file which is not a facade is a package part
String fqName = filePath.substring(0, filePath.length() - ".class".length()).replace('/', '.');
Class aClass = generateClass(fqName);
Class<?> aClass = generateClass(fqName);
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_PACKAGE_FRAGMENT.asString());
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_PACKAGE_PART.asString());
assertTrue("No KotlinPackageFragment annotation on a package fragment",
assertTrue("No KotlinPackagePart annotation on a package part",
aClass.isAnnotationPresent(annotationClass));
Annotation kotlinPackageFragment = aClass.getAnnotation(annotationClass);
Annotation kotlinPackagePart = aClass.getAnnotation(annotationClass);
Integer version = (Integer) CodegenTestUtil.getAnnotationAttribute(kotlinPackageFragment, "abiVersion");
Integer version = (Integer) CodegenTestUtil.getAnnotationAttribute(kotlinPackagePart, "abiVersion");
assertNotNull(version);
assertTrue("KotlinPackageFragment annotation is written with an unsupported format",
assertTrue("KotlinPackagePart annotation is written with an unsupported format",
AbiVersionUtil.isAbiVersionCompatible(version));
return;
}
}
fail("No package fragment was found: " + outputFiles.asList());
fail("No package part was found: " + outputFiles.asList());
}
}