Generate ex-package parts as file facades.
Support new facade kind in stub building and incremental compilation.
This commit is contained in:
committed by
Michael Bogdanov
parent
43af127ce8
commit
e050ff3271
@@ -30,6 +30,7 @@ import java.util.Set;
|
||||
public final class JvmAnnotationNames {
|
||||
public static final FqName KOTLIN_CLASS = KotlinClass.CLASS_NAME.getFqNameForClassNameWithoutDollars();
|
||||
public static final FqName KOTLIN_PACKAGE = new FqName("kotlin.jvm.internal.KotlinPackage");
|
||||
public static final FqName KOTLIN_FILE_FACADE = new FqName("kotlin.jvm.internal.KotlinFileFacade");
|
||||
public static final FqName KOTLIN_CALLABLE = new FqName("kotlin.jvm.internal.KotlinCallable");
|
||||
|
||||
public static final FqName KOTLIN_SIGNATURE = new FqName("kotlin.jvm.KotlinSignature");
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ public class KotlinClassHeader(
|
||||
public enum class Kind {
|
||||
CLASS,
|
||||
PACKAGE_FACADE,
|
||||
FILE_FACADE,
|
||||
SYNTHETIC_CLASS
|
||||
}
|
||||
|
||||
@@ -44,4 +45,5 @@ public class KotlinClassHeader(
|
||||
|
||||
public fun KotlinClassHeader.isCompatibleClassKind(): Boolean = isCompatibleAbiVersion && kind == KotlinClassHeader.Kind.CLASS
|
||||
public fun KotlinClassHeader.isCompatiblePackageFacadeKind(): Boolean = isCompatibleAbiVersion && kind == KotlinClassHeader.Kind.PACKAGE_FACADE
|
||||
public fun KotlinClassHeader.isCompatibleFileFacadeKind(): Boolean = isCompatibleAbiVersion && kind == KotlinClassHeader.Kind.FILE_FACADE
|
||||
public fun KotlinClassHeader.isCompatibleSyntheticClassKind(): Boolean = isCompatibleAbiVersion && kind == KotlinClassHeader.Kind.SYNTHETIC_CLASS
|
||||
|
||||
+10
-1
@@ -41,6 +41,7 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
|
||||
static {
|
||||
HEADER_KINDS.put(KotlinClass.CLASS_NAME, CLASS);
|
||||
HEADER_KINDS.put(JvmClassName.byFqNameWithoutInnerClasses(KOTLIN_PACKAGE), PACKAGE_FACADE);
|
||||
HEADER_KINDS.put(JvmClassName.byFqNameWithoutInnerClasses(KOTLIN_FILE_FACADE), FILE_FACADE);
|
||||
HEADER_KINDS.put(KotlinSyntheticClass.CLASS_NAME, SYNTHETIC_CLASS);
|
||||
|
||||
initOldAnnotations();
|
||||
@@ -77,7 +78,7 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
|
||||
return new KotlinClassHeader(headerKind, version, null, classKind, syntheticClassKind);
|
||||
}
|
||||
|
||||
if ((headerKind == CLASS || headerKind == PACKAGE_FACADE) && annotationData == null) {
|
||||
if ((headerKind == CLASS || headerKind == PACKAGE_FACADE || headerKind == FILE_FACADE) && annotationData == null) {
|
||||
// This means that the annotation is found and its ABI version is compatible, but there's no "data" string array in it.
|
||||
// We tell the outside world that there's really no annotation at all
|
||||
return null;
|
||||
@@ -105,6 +106,8 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
|
||||
return new ClassHeaderReader();
|
||||
case PACKAGE_FACADE:
|
||||
return new PackageHeaderReader();
|
||||
case FILE_FACADE:
|
||||
return new FileFacadeHeaderReader();
|
||||
case SYNTHETIC_CLASS:
|
||||
return new SyntheticClassHeaderReader();
|
||||
default:
|
||||
@@ -201,6 +204,12 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
|
||||
}
|
||||
}
|
||||
|
||||
private class FileFacadeHeaderReader extends HeaderAnnotationArgumentVisitor {
|
||||
public FileFacadeHeaderReader() {
|
||||
super(JvmClassName.byFqNameWithoutInnerClasses(KOTLIN_FILE_FACADE));
|
||||
}
|
||||
}
|
||||
|
||||
private class SyntheticClassHeaderReader extends HeaderAnnotationArgumentVisitor {
|
||||
public SyntheticClassHeaderReader() {
|
||||
super(KotlinSyntheticClass.CLASS_NAME);
|
||||
|
||||
Reference in New Issue
Block a user