Add public api dumps for kotlin-reflect and kotlin-stdlib-jre7/8
This commit is contained in:
+128
@@ -0,0 +1,128 @@
|
||||
public class kotlin/reflect/IllegalCallableAccessException : java/lang/Exception {
|
||||
public fun <init> (Ljava/lang/IllegalAccessException;)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/KClasses {
|
||||
public static final fun getCompanionObject (Lkotlin/reflect/KClass;)Lkotlin/reflect/KClass;
|
||||
public static final fun getCompanionObjectInstance (Lkotlin/reflect/KClass;)Ljava/lang/Object;
|
||||
public static final fun getDeclaredFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDefaultType (Lkotlin/reflect/KClass;)Lkotlin/reflect/KType;
|
||||
public static final fun getFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getPrimaryConstructor (Lkotlin/reflect/KClass;)Lkotlin/reflect/KFunction;
|
||||
public static final fun getStaticFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getStaticProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
}
|
||||
|
||||
public class kotlin/reflect/KotlinReflectionInternalError : java/lang/Error {
|
||||
public fun <init> (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public class kotlin/reflect/NoSuchPropertyException : java/lang/Exception {
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Exception;)V
|
||||
public synthetic fun <init> (Ljava/lang/Exception;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/IllegalCallableAccessException : kotlin/reflect/IllegalCallableAccessException {
|
||||
public fun <init> (Ljava/lang/IllegalAccessException;)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/IllegalPropertyDelegateAccessException : java/lang/Exception {
|
||||
public fun <init> (Ljava/lang/IllegalAccessException;)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/KCallables {
|
||||
public static final fun findParameterByName (Lkotlin/reflect/KCallable;Ljava/lang/String;)Lkotlin/reflect/KParameter;
|
||||
public static final fun getExtensionReceiverParameter (Lkotlin/reflect/KCallable;)Lkotlin/reflect/KParameter;
|
||||
public static final fun getInstanceParameter (Lkotlin/reflect/KCallable;)Lkotlin/reflect/KParameter;
|
||||
public static final fun getValueParameters (Lkotlin/reflect/KCallable;)Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/KClasses {
|
||||
public static final fun cast (Lkotlin/reflect/KClass;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun createInstance (Lkotlin/reflect/KClass;)Ljava/lang/Object;
|
||||
public static final fun getAllSuperclasses (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getAllSupertypes (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getCompanionObject (Lkotlin/reflect/KClass;)Lkotlin/reflect/KClass;
|
||||
public static final fun getCompanionObjectInstance (Lkotlin/reflect/KClass;)Ljava/lang/Object;
|
||||
public static final fun getDeclaredFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDeclaredMembers (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getDefaultType (Lkotlin/reflect/KClass;)Lkotlin/reflect/KType;
|
||||
public static final fun getFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getPrimaryConstructor (Lkotlin/reflect/KClass;)Lkotlin/reflect/KFunction;
|
||||
public static final fun getStaticFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getStaticProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection;
|
||||
public static final fun getSuperclasses (Lkotlin/reflect/KClass;)Ljava/util/List;
|
||||
public static final fun isSubclassOf (Lkotlin/reflect/KClass;Lkotlin/reflect/KClass;)Z
|
||||
public static final fun isSuperclassOf (Lkotlin/reflect/KClass;Lkotlin/reflect/KClass;)Z
|
||||
public static final fun safeCast (Lkotlin/reflect/KClass;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/KClassifiers {
|
||||
public static final fun createType (Lkotlin/reflect/KClassifier;Ljava/util/List;ZLjava/util/List;)Lkotlin/reflect/KType;
|
||||
public static synthetic fun createType$default (Lkotlin/reflect/KClassifier;Ljava/util/List;ZLjava/util/List;ILjava/lang/Object;)Lkotlin/reflect/KType;
|
||||
public static final fun getStarProjectedType (Lkotlin/reflect/KClassifier;)Lkotlin/reflect/KType;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/KProperties {
|
||||
public static final fun getExtensionDelegate (Lkotlin/reflect/KProperty1;)Ljava/lang/Object;
|
||||
public static final fun getExtensionDelegate (Lkotlin/reflect/KProperty2;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/KTypes {
|
||||
public static final fun isSubtypeOf (Lkotlin/reflect/KType;Lkotlin/reflect/KType;)Z
|
||||
public static final fun isSupertypeOf (Lkotlin/reflect/KType;Lkotlin/reflect/KType;)Z
|
||||
public static final fun withNullability (Lkotlin/reflect/KType;Z)Lkotlin/reflect/KType;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/full/NoSuchPropertyException : kotlin/reflect/NoSuchPropertyException {
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Exception;)V
|
||||
public synthetic fun <init> (Ljava/lang/Exception;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/jvm/KCallablesJvm {
|
||||
public static final fun isAccessible (Lkotlin/reflect/KCallable;)Z
|
||||
public static final fun setAccessible (Lkotlin/reflect/KCallable;Z)V
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/jvm/KClassesJvm {
|
||||
public static final fun getJvmName (Lkotlin/reflect/KClass;)Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/jvm/KTypesJvm {
|
||||
public static final fun getJvmErasure (Lkotlin/reflect/KType;)Lkotlin/reflect/KClass;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/jvm/ReflectJvmMapping {
|
||||
public static final fun getJavaConstructor (Lkotlin/reflect/KFunction;)Ljava/lang/reflect/Constructor;
|
||||
public static final fun getJavaField (Lkotlin/reflect/KProperty;)Ljava/lang/reflect/Field;
|
||||
public static final fun getJavaGetter (Lkotlin/reflect/KProperty;)Ljava/lang/reflect/Method;
|
||||
public static final fun getJavaMethod (Lkotlin/reflect/KFunction;)Ljava/lang/reflect/Method;
|
||||
public static final fun getJavaSetter (Lkotlin/reflect/KMutableProperty;)Ljava/lang/reflect/Method;
|
||||
public static final fun getJavaType (Lkotlin/reflect/KType;)Ljava/lang/reflect/Type;
|
||||
public static final fun getKotlinFunction (Ljava/lang/reflect/Constructor;)Lkotlin/reflect/KFunction;
|
||||
public static final fun getKotlinFunction (Ljava/lang/reflect/Method;)Lkotlin/reflect/KFunction;
|
||||
public static final fun getKotlinProperty (Ljava/lang/reflect/Field;)Lkotlin/reflect/KProperty;
|
||||
}
|
||||
|
||||
public final class kotlin/reflect/jvm/ReflectLambdaKt {
|
||||
public static final fun reflect (Lkotlin/Function;)Lkotlin/reflect/KFunction;
|
||||
}
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
public final class kotlin/AutoCloseableKt {
|
||||
public static final fun closeFinally (Ljava/lang/AutoCloseable;Ljava/lang/Throwable;)V
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public final class kotlin/streams/StreamsKt {
|
||||
public static final fun asSequence (Ljava/util/stream/DoubleStream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asSequence (Ljava/util/stream/IntStream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asSequence (Ljava/util/stream/LongStream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asSequence (Ljava/util/stream/Stream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asStream (Lkotlin/sequences/Sequence;)Ljava/util/stream/Stream;
|
||||
public static final fun toList (Ljava/util/stream/DoubleStream;)Ljava/util/List;
|
||||
public static final fun toList (Ljava/util/stream/IntStream;)Ljava/util/List;
|
||||
public static final fun toList (Ljava/util/stream/LongStream;)Ljava/util/List;
|
||||
public static final fun toList (Ljava/util/stream/Stream;)Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class kotlin/text/RegexExtensionsJRE8Kt {
|
||||
public static final fun get (Lkotlin/text/MatchGroupCollection;Ljava/lang/String;)Lkotlin/text/MatchGroup;
|
||||
}
|
||||
|
||||
+6
-2
@@ -48,9 +48,13 @@ fun getBinaryAPI(classStreams: Sequence<InputStream>, visibilityMap: Map<String,
|
||||
|
||||
|
||||
|
||||
fun List<ClassBinarySignature>.filterOutNonPublic(): List<ClassBinarySignature> {
|
||||
fun List<ClassBinarySignature>.filterOutNonPublic(nonPublicPackages: List<String> = emptyList()): List<ClassBinarySignature> {
|
||||
val nonPublicPaths = nonPublicPackages.map { it.replace('.', '/') + '/' }
|
||||
val classByName = associateBy { it.name }
|
||||
|
||||
fun ClassBinarySignature.isInNonPublicPackage() =
|
||||
nonPublicPaths.any { name.startsWith(it) }
|
||||
|
||||
fun ClassBinarySignature.isPublicAndAccessible(): Boolean =
|
||||
isEffectivelyPublic &&
|
||||
(outerName == null || classByName[outerName]?.let { outerClass ->
|
||||
@@ -72,7 +76,7 @@ fun List<ClassBinarySignature>.filterOutNonPublic(): List<ClassBinarySignature>
|
||||
return this.copy(memberSignatures = memberSignatures + inheritedStaticSignatures, supertypes = supertypes - superName)
|
||||
}
|
||||
|
||||
return filter { it.isPublicAndAccessible() }
|
||||
return filter { !it.isInNonPublicPackage() && it.isPublicAndAccessible() }
|
||||
.map { it.flattenNonPublicBases() }
|
||||
.filterNot { it.isNotUsedWhenEmpty && it.memberSignatures.isEmpty()}
|
||||
}
|
||||
|
||||
+18
-12
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.tools.tests
|
||||
|
||||
import org.jetbrains.kotlin.tools.*
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestName
|
||||
@@ -42,16 +41,22 @@ class RuntimePublicAPITest {
|
||||
snapshotAPIAndCompare("../../stdlib/build/libs", "kotlin-stdlib", listOf("../stdlib-declarations.json", "../runtime-declarations.json"), listOf("kotlin.jvm.internal"))
|
||||
}
|
||||
|
||||
/*
|
||||
@Test fun kotlinReflect() {
|
||||
// requires declaration mapping JSON from kotlin-reflect which isn't built by maven build
|
||||
snapshotAPIAndCompare("../../tools/kotlin-reflect/target", "kotlin-reflect", "../../../../dist/declarations/reflect-declarations.json ")
|
||||
@Test fun kotlinStdlibJre7() {
|
||||
snapshotAPIAndCompare("../../stdlib/jre7/build/libs", "kotlin-stdlib-jre7", listOf("../stdlib-jre7-declarations.json"))
|
||||
}
|
||||
*/
|
||||
|
||||
private fun snapshotAPIAndCompare(basePath: String, jarPrefix: String, kotlinJvmMappingsPath: List<String>, publicPackages: List<String> = emptyList()) {
|
||||
@Test fun kotlinStdlibJre8() {
|
||||
snapshotAPIAndCompare("../../stdlib/jre8/build/libs", "kotlin-stdlib-jre8", listOf("../stdlib-jre8-declarations.json"))
|
||||
}
|
||||
|
||||
@Test fun kotlinReflect() {
|
||||
snapshotAPIAndCompare("../../tools/kotlin-reflect/build/libs", "kotlin-reflect(?!-[-a-z]+)", listOf("../reflect-declarations.json"), nonPublicPackages = listOf("kotlin.reflect.jvm.internal"))
|
||||
}
|
||||
|
||||
|
||||
private fun snapshotAPIAndCompare(basePath: String, jarPattern: String, kotlinJvmMappingsPath: List<String>, publicPackages: List<String> = emptyList(), nonPublicPackages: List<String> = emptyList()) {
|
||||
val base = File(basePath).absoluteFile.normalize()
|
||||
val jarFile = getJarPath(base, jarPrefix)
|
||||
val jarFile = getJarPath(base, jarPattern)
|
||||
val kotlinJvmMappingsFiles = kotlinJvmMappingsPath.map(base::resolve)
|
||||
|
||||
println("Reading kotlin visibilities from $kotlinJvmMappingsFiles")
|
||||
@@ -62,7 +67,7 @@ class RuntimePublicAPITest {
|
||||
.reduce { m1, m2 -> m1 + m2 }
|
||||
|
||||
println("Reading binary API from $jarFile")
|
||||
val api = getBinaryAPI(JarFile(jarFile), visibilities).filterOutNonPublic()
|
||||
val api = getBinaryAPI(JarFile(jarFile), visibilities).filterOutNonPublic(nonPublicPackages)
|
||||
|
||||
val target = File("reference-public-api")
|
||||
.resolve(testName.methodName.replaceCamelCaseWithDashedLowerCase() + ".txt")
|
||||
@@ -70,14 +75,15 @@ class RuntimePublicAPITest {
|
||||
api.dumpAndCompareWith(target)
|
||||
}
|
||||
|
||||
private fun getJarPath(base: File, jarPrefix: String): File {
|
||||
private fun getJarPath(base: File, jarPattern: String): File {
|
||||
val regex = Regex("$jarPattern.+\\.jar")
|
||||
val files = (base.listFiles() ?: throw Exception("Cannot list files in $base"))
|
||||
.filter { it.name.let {
|
||||
it.startsWith(jarPrefix) && it.endsWith(".jar")
|
||||
it matches regex
|
||||
&& !it.endsWith("-sources.jar")
|
||||
&& !it.endsWith("-javadoc.jar") }}
|
||||
|
||||
return files.singleOrNull() ?: throw Exception("No single file matching $jarPrefix in $base: $files")
|
||||
return files.singleOrNull() ?: throw Exception("No single file matching $jarPattern in $base: $files")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user