Introduce jdk-api-validator to ensure kotlin-reflect uses jdk6 API
Merge-request: KT-MR-6930 Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
5424c54fae
commit
7346cf4777
@@ -43,6 +43,7 @@ internal fun <V : Any> createCache(compute: (Class<*>) -> V): CacheByClass<V> {
|
||||
* ClassValue -> KPackageImpl.getClass() -> UrlClassloader -> all loaded classes by this CL ->
|
||||
* -> kotlin.reflect.jvm.internal.ClassValueCache -> ClassValue
|
||||
*/
|
||||
@kotlin.reflect.jvm.internal.SuppressJdk6SignatureCheck
|
||||
private class ComputableClassValue<V>(@JvmField val compute: (Class<*>) -> V) : ClassValue<SoftReference<V>>() {
|
||||
override fun computeValue(type: Class<*>): SoftReference<V> {
|
||||
return SoftReference(compute(type))
|
||||
@@ -51,6 +52,7 @@ private class ComputableClassValue<V>(@JvmField val compute: (Class<*>) -> V) :
|
||||
fun createNewCopy() = ComputableClassValue(compute)
|
||||
}
|
||||
|
||||
@kotlin.reflect.jvm.internal.SuppressJdk6SignatureCheck
|
||||
private class ClassValueCache<V>(compute: (Class<*>) -> V) : CacheByClass<V>() {
|
||||
|
||||
@Volatile
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
/**
|
||||
* Suppresses verification errors of the jdk-api-validator tool for certain scope.
|
||||
* Such scopes include references to Java 8 API that are not available in Android API,
|
||||
* but can be desugared by R8 or their execution is prevented on Android platform.
|
||||
*/
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
internal annotation class SuppressJdk6SignatureCheck
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin
|
||||
|
||||
/**
|
||||
* Suppresses verification errors of the jdk-api-validator tool for certain scope.
|
||||
* Such scopes include references to Java 8 API that are not available in Android API,
|
||||
* but can be desugared by R8 or their execution is prevented on Android platform.
|
||||
*/
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
internal annotation class SuppressJdk6SignatureCheck
|
||||
@@ -647,6 +647,7 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
);
|
||||
}
|
||||
|
||||
@org.jetbrains.kotlin.SuppressJdk6SignatureCheck
|
||||
private AssertionError unableToRemoveKey(K input, Throwable throwable) {
|
||||
return sanitizeStackTrace(
|
||||
new AssertionError("Unable to remove "
|
||||
|
||||
Reference in New Issue
Block a user