Replace deprecated annotations in whole project
This commit is contained in:
@@ -34,7 +34,7 @@ public object CodegenUtilKt {
|
||||
// toTrait = Bar
|
||||
// delegateExpressionType = typeof(baz)
|
||||
// return Map<member of Foo, corresponding member of typeOf(baz)>
|
||||
public [platformStatic] fun getDelegates(
|
||||
public platformStatic fun getDelegates(
|
||||
descriptor: ClassDescriptor,
|
||||
toTrait: ClassDescriptor,
|
||||
delegateExpressionType: JetType? = null
|
||||
|
||||
@@ -56,7 +56,7 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
// If it's a concrete fake override, some of the bridges may be inherited from the super-classes. Specifically, bridges for all
|
||||
// declarations that are reachable from all concrete immediate super-functions of the given function. Note that all such bridges are
|
||||
// guaranteed to delegate to the same implementation as bridges for the given function, that's why it's safe to inherit them
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
for (overridden in function.getOverridden() as Iterable<Function>) {
|
||||
if (!overridden.isAbstract) {
|
||||
bridgesToGenerate.removeAll(findAllReachableDeclarations(overridden).map(signature))
|
||||
@@ -77,7 +77,7 @@ private fun <Function : FunctionHandle> findAllReachableDeclarations(function: F
|
||||
}
|
||||
}
|
||||
}
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
DFS.dfs(listOf(function), { it.getOverridden() as Iterable<Function> }, collector)
|
||||
return HashSet(collector.result())
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class PlatformStaticGenerator(
|
||||
}
|
||||
|
||||
companion object {
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
public fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
|
||||
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.getCorrespondingProperty() else descriptor
|
||||
val copies = CodegenUtil.copyFunctions(
|
||||
|
||||
@@ -21,7 +21,7 @@ import kotlin.platform.platformStatic
|
||||
|
||||
object SMAPParser {
|
||||
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
/*null smap means that there is no any debug info in file (e.g. sourceName)*/
|
||||
public fun parseOrCreateDefault(mappingInfo: String?, source: String?, path: String, methodStartLine: Int, methodEndLine: Int): SMAP {
|
||||
if (mappingInfo == null || mappingInfo.isEmpty()) {
|
||||
@@ -41,7 +41,7 @@ object SMAPParser {
|
||||
return parse(mappingInfo)
|
||||
}
|
||||
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
public fun parse(mappingInfo: String): SMAP {
|
||||
val fileMappings = linkedMapOf<Int, FileMapping>()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class TryBlockCluster<T : IntervalWithHandler>(val blocks: MutableList<T>) {
|
||||
|
||||
|
||||
fun <T : IntervalWithHandler> doClustering(blocks: List<T>): List<TryBlockCluster<T>> {
|
||||
[data] class TryBlockInterval(val startLabel: LabelNode, val endLabel: LabelNode)
|
||||
@data class TryBlockInterval(val startLabel: LabelNode, val endLabel: LabelNode)
|
||||
|
||||
val clusters = linkedMapOf<TryBlockInterval, TryBlockCluster<T>>()
|
||||
blocks.forEach { block ->
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.compiler.plugin.*
|
||||
|
||||
public object PluginCliParser {
|
||||
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
fun loadPlugins(arguments: CommonCompilerArguments, configuration: CompilerConfiguration) {
|
||||
val classLoader = PluginURLClassLoader(
|
||||
arguments.pluginClasspaths
|
||||
|
||||
+4
-4
@@ -29,15 +29,15 @@ public open class JavaClassFinderPostConstruct {
|
||||
|
||||
public class JavaLazyAnalyzerPostConstruct : JavaClassFinderPostConstruct() {
|
||||
public var project: Project? = null
|
||||
[Inject] set
|
||||
@Inject set
|
||||
|
||||
public var trace: BindingTrace? = null
|
||||
[Inject] set
|
||||
@Inject set
|
||||
|
||||
public var codeAnalyzer: KotlinCodeAnalyzer? = null
|
||||
[Inject] set
|
||||
@Inject set
|
||||
|
||||
[PostConstruct] override fun postCreate() {
|
||||
@PostConstruct override fun postCreate() {
|
||||
CodeAnalyzerInitializer.getInstance(project!!).initialize(trace!!, codeAnalyzer!!.getModuleDescriptor(), codeAnalyzer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public class TypeResolver(
|
||||
}
|
||||
|
||||
companion object {
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
public fun resolveProjectionKind(projectionKind: JetProjectionKind): Variance {
|
||||
return when (projectionKind) {
|
||||
JetProjectionKind.IN -> IN_VARIANCE
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CallCompleter(
|
||||
context: BasicCallResolutionContext,
|
||||
results: OverloadResolutionResultsImpl<D>
|
||||
) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val candidates = (if (context.collectAllCandidates) {
|
||||
results.getAllCandidates()!!
|
||||
}
|
||||
@@ -274,7 +274,7 @@ public class CallCompleter(
|
||||
if (cachedDataForCall == null) return null
|
||||
|
||||
val (cachedResolutionResults, cachedContext, tracing) = cachedDataForCall
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val cachedResults = cachedResolutionResults as OverloadResolutionResultsImpl<CallableDescriptor>
|
||||
val contextForArgument = cachedContext.replaceBindingTrace(context.trace)
|
||||
.replaceExpectedType(context.expectedType).replaceCollectAllCandidates(false)
|
||||
|
||||
@@ -82,7 +82,7 @@ public fun JetCallElement.getValueArgumentsInParentheses(): List<ValueArgument>
|
||||
|
||||
public fun Call.getValueArgumentListOrElement(): JetElement = getValueArgumentList() ?: getCalleeExpression() ?: getCallElement()
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
private fun List<ValueArgument?>.filterArgsInParentheses() = filter { it !is JetFunctionLiteralArgument } as List<ValueArgument>
|
||||
|
||||
public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueArgument? {
|
||||
|
||||
@@ -43,7 +43,7 @@ fun checkTraitRequirements(c: Map<JetClassOrObject, ClassDescriptorWithResolutio
|
||||
}
|
||||
|
||||
private fun getAllSuperTraits(descriptor: ClassDescriptor): List<ClassDescriptor> {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return TypeUtils.getAllSupertypes(descriptor.getDefaultType())
|
||||
.map { supertype -> supertype.getConstructor().getDeclarationDescriptor() }
|
||||
.filter { superClass -> DescriptorUtils.isTrait(superClass) } as List<ClassDescriptor>
|
||||
|
||||
+2
-2
@@ -638,7 +638,7 @@ private val BOOLEAN = CompileTimeType<Boolean>()
|
||||
private val STRING = CompileTimeType<String>()
|
||||
private val ANY = CompileTimeType<Any>()
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
private fun <A, B> binaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
b: CompileTimeType<B>,
|
||||
@@ -647,7 +647,7 @@ private fun <A, B> binaryOperation(
|
||||
checker: Function2<BigInteger, BigInteger, BigInteger>
|
||||
) = BinaryOperationKey(a, b, functionName) to Pair(operation, checker) as Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
private fun <A> unaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
functionName: String,
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ public class LazyAnnotationDescriptor(
|
||||
|
||||
if (!resolutionResults.isSingleResult()) return mapOf()
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return resolutionResults.getResultingCall().getValueArguments()
|
||||
.mapValues { val (valueParameter, resolvedArgument) = it;
|
||||
if (resolvedArgument == null) null
|
||||
|
||||
+3
-3
@@ -101,7 +101,7 @@ public open class LazyClassMemberScope(
|
||||
OverridingUtil.generateOverridesInFunctionGroup(name, fromSupertypes, ArrayList(result), thisDescriptor, object : OverridingUtil.DescriptorSink {
|
||||
override fun addToScope(fakeOverride: CallableMemberDescriptor) {
|
||||
assert(exactDescriptorClass.isInstance(fakeOverride)) { "Wrong descriptor type in an override: " + fakeOverride + " while expecting " + exactDescriptorClass.getSimpleName() }
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
result.add(fakeOverride as D)
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public open class LazyClassMemberScope(
|
||||
}
|
||||
}
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
protected override fun getNonDeclaredProperties(name: Name, result: MutableSet<VariableDescriptor>) {
|
||||
createPropertiesFromPrimaryConstructorParameters(name, result)
|
||||
|
||||
@@ -319,7 +319,7 @@ public open class LazyClassMemberScope(
|
||||
|
||||
private val EXTRACT_PROPERTIES: MemberExtractor<PropertyDescriptor> = object : MemberExtractor<PropertyDescriptor> {
|
||||
override fun extract(extractFrom: JetType, name: Name): Collection<PropertyDescriptor> {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return extractFrom.getMemberScope().getProperties(name) as Collection<PropertyDescriptor>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ class LazyOperationsLog(
|
||||
private fun <T> Any.field(name: String): T {
|
||||
val field = this.javaClass.getDeclaredField(name)
|
||||
field.setAccessible(true)
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return field.get(this) as T
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class LoggingStorageManager(
|
||||
var c = this
|
||||
while (true) {
|
||||
result.addAll(c.getDeclaredFields().toList())
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val superClass = (c as Class<Any>).getSuperclass() as Class<Any>?
|
||||
if (superClass == null) break
|
||||
if (c == superClass) break
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class AbstractLocalClassProtoTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
private fun assertHasAnnotationData(clazz: Class<*>) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val annotation = clazz.getAnnotation(
|
||||
clazz.getClassLoader().loadClass(JvmAnnotationNames.KOTLIN_CLASS.asString()) as Class<Annotation>
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Services private(private val map: Map<Class<*>, Any>) {
|
||||
}
|
||||
|
||||
public fun <T> get(interfaceClass: Class<T>): T {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return map.get(interfaceClass) as T
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class LockedClearableLazyValue<T: Any>(val lock: Any, val init: () -> T)
|
||||
return synchronized(lock) {
|
||||
val _v2 = value
|
||||
// Suppress because of https://youtrack.jetbrains.com/issue/KT-6176
|
||||
[suppress("UNNECESSARY_NOT_NULL_ASSERTION")]
|
||||
@suppress("UNNECESSARY_NOT_NULL_ASSERTION")
|
||||
if (_v2 != null) {
|
||||
_v2!!
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class SingleModuleClassResolver() : ModuleClassResolver {
|
||||
}
|
||||
|
||||
var resolver: JavaDescriptorResolver? = null
|
||||
[Inject] set
|
||||
@Inject set
|
||||
}
|
||||
|
||||
public class ModuleClassResolverImpl(private val descriptorResolverByJavaClass: (JavaClass) -> JavaDescriptorResolver): ModuleClassResolver {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
|
||||
|
||||
val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) })
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return substituted as D?
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -190,7 +190,7 @@ public class DeserializedClassDescriptor(
|
||||
override fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
|
||||
val fromSupertypes = ArrayList<PropertyDescriptor>()
|
||||
for (supertype in classDescriptor.getTypeConstructor().getSupertypes()) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
fromSupertypes.addAll(supertype.getMemberScope().getProperties(name) as Collection<PropertyDescriptor>)
|
||||
}
|
||||
generateFakeOverrides(name, fromSupertypes, descriptors)
|
||||
@@ -202,7 +202,7 @@ public class DeserializedClassDescriptor(
|
||||
override fun addToScope(fakeOverride: CallableMemberDescriptor) {
|
||||
// TODO: report "cannot infer visibility"
|
||||
OverridingUtil.resolveUnknownVisibilityForMember(fakeOverride, null)
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
result.add(fakeOverride as D)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public abstract class DeserializedMemberScope protected(
|
||||
val memberProtos = membersProtos()[ProtoKey(name, kind, isExtension = false)].orEmpty() +
|
||||
membersProtos()[ProtoKey(name, kind, isExtension = true)].orEmpty()
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return memberProtos.mapTo(LinkedHashSet<D>()) { memberProto ->
|
||||
c.memberDeserializer.loadCallable(memberProto) as D
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ package kotlin.reflect
|
||||
*/
|
||||
public class IllegalPropertyAccessException(cause: IllegalAccessException) : Exception(cause.getMessage()) {
|
||||
init {
|
||||
[suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")]
|
||||
@suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
(this as java.lang.Throwable).initCause(cause)
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class IllegalPropertyAccessException(cause: IllegalAccessException) : Exc
|
||||
*/
|
||||
public class NoSuchPropertyException(cause: Exception? = null) : Exception() {
|
||||
init {
|
||||
[suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")]
|
||||
@suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
if (cause != null) {
|
||||
(this as java.lang.Throwable).initCause(cause)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ open class KMemberExtensionPropertyImpl<D : Any, E, out R> : DescriptorBasedProp
|
||||
|
||||
override fun get(instance: D, extensionReceiver: E): R {
|
||||
try {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return getter.invoke(instance, extensionReceiver) as R
|
||||
}
|
||||
catch (e: IllegalAccessException) {
|
||||
|
||||
@@ -31,7 +31,7 @@ open class KMemberPropertyImpl<T : Any, out R> : DescriptorBasedProperty, KMembe
|
||||
override fun get(instance: T): R {
|
||||
try {
|
||||
val getter = getter
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return if (getter != null) getter(instance) as R else field!!.get(instance) as R
|
||||
}
|
||||
catch (e: IllegalAccessException) {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ open class KTopLevelExtensionPropertyImpl<T, out R> : DescriptorBasedProperty, K
|
||||
|
||||
override fun get(receiver: T): R {
|
||||
try {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return getter.invoke(null, receiver) as R
|
||||
}
|
||||
catch (e: IllegalAccessException) {
|
||||
|
||||
@@ -30,7 +30,7 @@ open class KTopLevelVariableImpl<out R> : DescriptorBasedProperty, KTopLevelVari
|
||||
|
||||
override fun get(): R {
|
||||
try {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return getter.invoke(null) as R
|
||||
}
|
||||
catch (e: IllegalAccessException) {
|
||||
|
||||
@@ -31,7 +31,7 @@ fun <T> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> {
|
||||
val name = jClass.getName()
|
||||
val cached = FOREIGN_K_CLASSES[name]
|
||||
if (cached is WeakReference<*>) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val kClass = cached.get() as KClassImpl<T>?
|
||||
if (kClass?.jClass == jClass) {
|
||||
return kClass!!
|
||||
|
||||
@@ -132,7 +132,7 @@ object REFLECTION_EVAL : Eval {
|
||||
return _class.isInstance(value.obj())
|
||||
}
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
override fun newArray(arrayType: Type, size: Int): Value {
|
||||
return ObjectValue(JArray.newInstance(findClass(arrayType).getComponentType() as Class<Any>, size), arrayType)
|
||||
}
|
||||
@@ -275,7 +275,7 @@ object REFLECTION_EVAL : Eval {
|
||||
if (invokespecial) {
|
||||
if (methodDesc.name == "<init>") {
|
||||
// Constructor call
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val _class = findClass((instance as NewObjectValue).asmType)
|
||||
val ctor = _class.findConstructor(methodDesc)
|
||||
assertNotNull("Constructor not found: $methodDesc", ctor)
|
||||
@@ -306,7 +306,7 @@ object REFLECTION_EVAL : Eval {
|
||||
}
|
||||
|
||||
class ReflectionLookup(val classLoader: ClassLoader) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
fun findClass(asmType: Type): Class<*>? {
|
||||
return when (asmType.getSort()) {
|
||||
Type.BOOLEAN -> java.lang.Boolean.TYPE
|
||||
@@ -324,7 +324,7 @@ class ReflectionLookup(val classLoader: ClassLoader) {
|
||||
}
|
||||
}
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
fun Class<Any>.findMethod(methodDesc: MethodDescription): Method? {
|
||||
for (declared in getDeclaredMethods()) {
|
||||
if (methodDesc.matches(declared)) return declared
|
||||
@@ -341,7 +341,7 @@ fun Class<Any>.findMethod(methodDesc: MethodDescription): Method? {
|
||||
return null
|
||||
}
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
fun Class<Any>.findConstructor(methodDesc: MethodDescription): Constructor<Any?>? {
|
||||
for (declared in getDeclaredConstructors()) {
|
||||
if (methodDesc.matches(declared)) return declared as Constructor<Any?>
|
||||
@@ -371,7 +371,7 @@ fun MethodDescription.matches(method: Method): Boolean {
|
||||
return returnType.matches(method.getReturnType()!!)
|
||||
}
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
fun Class<Any>.findField(fieldDesc: FieldDescription): Field? {
|
||||
for (declared in getDeclaredFields()) {
|
||||
if (fieldDesc.matches(declared)) return declared
|
||||
|
||||
@@ -49,12 +49,12 @@ fun generate(): String {
|
||||
val binaryOperationsMap = arrayListOf<Pair<String, List<JetType>>>()
|
||||
|
||||
val builtIns = KotlinBuiltIns.getInstance()
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val allPrimitiveTypes = builtIns.getBuiltInsPackageScope().getDescriptors()
|
||||
.filter { it is ClassDescriptor && KotlinBuiltIns.isPrimitiveType(it.getDefaultType()) } as List<ClassDescriptor>
|
||||
|
||||
for (descriptor in allPrimitiveTypes + builtIns.getString()) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val functions = descriptor.getMemberScope(listOf()).getDescriptors()
|
||||
.filter { it is FunctionDescriptor && !EXCLUDED_FUNCTIONS.contains(it.getName().asString()) } as List<FunctionDescriptor>
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.lang.reflect.Modifier
|
||||
|
||||
public class ProtoBufConsistencyTest : TestCase() {
|
||||
public fun testExtensionNumbersDoNotIntersect() {
|
||||
[data] class Key(val messageType: Class<*>, val index: Int)
|
||||
@data class Key(val messageType: Class<*>, val index: Int)
|
||||
|
||||
val extensions = LinkedHashMultimap.create<Key, Descriptors.FieldDescriptor>()
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
|
||||
|
||||
companion object {
|
||||
var namesHighlightingEnabled = true
|
||||
[TestOnly] set
|
||||
@TestOnly set
|
||||
|
||||
platformStatic fun highlightName(holder: AnnotationHolder, psiElement: PsiElement, attributesKey: TextAttributesKey) {
|
||||
if (namesHighlightingEnabled) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractJetReference<T : JetElement>(element: T)
|
||||
|
||||
override fun bindToElement(element: PsiElement): PsiElement = throw IncorrectOperationException()
|
||||
|
||||
[suppress("CAST_NEVER_SUCCEEDS")]
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
override fun getVariants(): Array<Any> = PsiReference.EMPTY_ARRAY as Array<Any>
|
||||
|
||||
override fun isSoft(): Boolean = false
|
||||
|
||||
+3
-3
@@ -59,9 +59,9 @@ public class JetReferenceContributor() : PsiReferenceContributor() {
|
||||
) {
|
||||
registerReferenceProvider(PlatformPatterns.psiElement(elementClass), object: PsiReferenceProvider() {
|
||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
return array(factory(element as E))
|
||||
}
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return array(factory(element as E))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -69,6 +69,6 @@ val (PsiReference.() -> Boolean).searchFilter: UsagesSearchFilter
|
||||
|
||||
val <T: PsiNamedElement> (PsiReference.(T) -> Boolean).searchFilter: UsagesSearchFilter
|
||||
get() = object: UsagesSearchFilter {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
override fun accepts(ref: PsiReference, item: UsagesSearchRequestItem): Boolean = ref.this@searchFilter(item.target.element as T)
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider<Tr
|
||||
val element = node.getElement()
|
||||
if (element !is JetClassOrObject) return listOf()
|
||||
|
||||
[suppress("USELESS_CAST")] // KT-3996 Workaround
|
||||
@suppress("USELESS_CAST") // KT-3996 Workaround
|
||||
val project = (element as NavigatablePsiElement).getProject()
|
||||
|
||||
val context = element.analyze()
|
||||
|
||||
@@ -39,6 +39,6 @@ public fun Project.executeCommand(name: String, groupId: Any? = null, command: (
|
||||
public fun <T> Project.executeWriteCommand(name: String, groupId: Any? = null, command: () -> T): T {
|
||||
var result: T = null as T
|
||||
CommandProcessor.getInstance().executeCommand(this, { result = runWriteAction(command) }, name, groupId)
|
||||
[suppress("USELESS_CAST")]
|
||||
@suppress("USELESS_CAST")
|
||||
return result as T
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class ImportInsertHelper {
|
||||
public abstract fun importDescriptor(file: JetFile, descriptor: DeclarationDescriptor): ImportDescriptorResult
|
||||
|
||||
companion object {
|
||||
[platformStatic]
|
||||
@platformStatic
|
||||
public fun getInstance(project: Project): ImportInsertHelper
|
||||
= ServiceManager.getService<ImportInsertHelper>(project, javaClass<ImportInsertHelper>())
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ fun<TDescriptor: DeclarationDescriptor?> MutableCollection<LookupElement>.addLoo
|
||||
for (info in expectedInfos) {
|
||||
val classification = infoClassifier(info)
|
||||
if (classification.substitutor != null) {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val substitutedDescriptor = descriptor?.substitute(classification.substitutor) as TDescriptor
|
||||
val map = if (classification.makeNotNullable) makeNullableInfos else matchedInfos
|
||||
map.getOrPut(ItemData(substitutedDescriptor, info.itemOptions)) { ArrayList() }.add(info)
|
||||
|
||||
@@ -277,7 +277,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Kotlin
|
||||
val importHelper = ImportInsertHelper.getInstance(file.getProject())
|
||||
val smartPointerManager = SmartPointerManager.getInstance(file.getProject())
|
||||
|
||||
[data] class BindingRequest(
|
||||
@data class BindingRequest(
|
||||
val pointer: SmartPsiElementPointer<JetSimpleNameExpression>,
|
||||
val fqName: FqName
|
||||
)
|
||||
@@ -347,7 +347,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Kotlin
|
||||
}
|
||||
|
||||
companion object {
|
||||
[TestOnly]
|
||||
@TestOnly
|
||||
public var declarationsToImportSuggested: Collection<String> = emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class KotlinSpellcheckingStrategy: SpellcheckingStrategy() {
|
||||
private val emptyTokenizer = SpellcheckingStrategy.EMPTY_TOKENIZER
|
||||
|
||||
override fun getTokenizer(element: PsiElement?): Tokenizer<out PsiElement?> {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return when {
|
||||
element is PsiNameIdentifierOwner || element is PsiComment ->
|
||||
super.getTokenizer(element)
|
||||
|
||||
@@ -268,7 +268,7 @@ public class JetPositionManager(private val myDebugProcess: DebugProcess) : Mult
|
||||
}
|
||||
}
|
||||
|
||||
[deprecated("Since Idea 14.0.3 use createPrepareRequests fun")]
|
||||
@deprecated("Since Idea 14.0.3 use createPrepareRequests fun")
|
||||
override fun createPrepareRequest(classPrepareRequestor: ClassPrepareRequestor, sourcePosition: SourcePosition): ClassPrepareRequest? {
|
||||
if (sourcePosition.getFile() !is JetFile) {
|
||||
throw NoDataException.INSTANCE
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class JavaMethodKotlinDerivedDefinitionUsage(
|
||||
function: JetFunction,
|
||||
functionDescriptor: FunctionDescriptor,
|
||||
javaMethodChangeInfo: JetChangeInfo): JavaMethodKotlinUsageWithDelegate<JetFunction>(function, javaMethodChangeInfo) {
|
||||
[suppress("CAST_NEVER_SUCCEEDS")]
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
override protected val delegateUsage = JetFunctionDefinitionUsage(
|
||||
psiElement,
|
||||
functionDescriptor,
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class KotlinIntroduceParameterMethodUsageProcessor : IntroduceParameterMe
|
||||
val refElement = usage.getElement() as? JetReferenceExpression ?: return true
|
||||
val callElement = refElement.getParentOfTypeAndBranch<JetCallElement>(true) { getCalleeExpression() } ?: return true
|
||||
val delegateUsage = if (callElement is JetConstructorDelegationCall) {
|
||||
[suppress("CAST_NEVER_SUCCEEDS")]
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
(JetConstructorDelegationCallUsage(callElement, changeInfo) as JetUsageInfo<JetCallElement>)
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTe
|
||||
|
||||
val extractionOptions = InTextDirectivesUtils.findListWithPrefixes(fileText, "// OPTIONS: ").let {
|
||||
if (it.isNotEmpty()) {
|
||||
[suppress("CAST_NEVER_SUCCEEDS")]
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
val args = it.map { it.toBoolean() }.copyToArray() as Array<Any?>
|
||||
javaClass<ExtractionOptions>().getConstructors().first { it.getParameterTypes().size() == args.size() }.newInstance(*args) as ExtractionOptions
|
||||
} else ExtractionOptions.DEFAULT
|
||||
|
||||
@@ -72,7 +72,7 @@ public open class JsFunctionScope(parent: JsScope, description: String) : JsScop
|
||||
* Safe call is necessary, because hasOwnName can be called
|
||||
* in constructor before labelName is initialized (see KT-4394)
|
||||
*/
|
||||
[suppress("UNNECESSARY_SAFE_CALL")]
|
||||
@suppress("UNNECESSARY_SAFE_CALL")
|
||||
override fun hasOwnName(name: String): Boolean =
|
||||
name in RESERVED_WORDS
|
||||
|| name == ident
|
||||
|
||||
@@ -20,7 +20,7 @@ abstract class HasMetadata {
|
||||
private val metadata: MutableMap<String, Any?> = hashMapOf()
|
||||
|
||||
fun <T> getData(key: String): T {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return metadata[key] as T
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SuppressUninitializedErrorsForNativeDeclarations : DiagnosticsWithS
|
||||
override fun isSuppressed(diagnostic: Diagnostic): Boolean {
|
||||
if (diagnostic.getFactory() != Errors.UNINITIALIZED_VARIABLE) return false
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val diagnosticWithParameters = diagnostic as DiagnosticWithParameters1<JetSimpleNameExpression, VariableDescriptor>
|
||||
|
||||
val variableDescriptor = diagnosticWithParameters.getA()
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1
|
||||
|
||||
public object JsCodePositioningStrategy : PositioningStrategy<PsiElement>() {
|
||||
override fun markDiagnostic(diagnostic: ParametrizedDiagnostic<out PsiElement>): List<TextRange> {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
@suppress("UNCHECKED_CAST")
|
||||
val diagnosticWithParameters = diagnostic as DiagnosticWithParameters1<JetExpression, JsCallData>
|
||||
val textRange = diagnosticWithParameters.getA().reportRange
|
||||
return listOf(textRange)
|
||||
|
||||
@@ -29,4 +29,4 @@ public annotation class volatile
|
||||
native
|
||||
public annotation class synchronized
|
||||
|
||||
public inline fun <R> synchronized(lock: Any, [inlineOptions(ONLY_LOCAL_RETURN)] block: () -> R): R = block()
|
||||
public inline fun <R> synchronized(lock: Any, @inlineOptions(ONLY_LOCAL_RETURN) block: () -> R): R = block()
|
||||
|
||||
@@ -16,7 +16,7 @@ public val undefined: Nothing? = noImpl
|
||||
|
||||
// Drop this after KT-2093 will be fixed and restore MutableMap.set in Maps.kt from MapsJVM.kt
|
||||
/** Provides [] access to maps */
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
native public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = noImpl
|
||||
|
||||
library
|
||||
|
||||
@@ -70,9 +70,9 @@ public open class LinkedList<E>() : AbstractList<E>() {
|
||||
override fun set(index: Int, element: E): E = noImpl
|
||||
override fun add(index: Int, element: E): Unit = noImpl
|
||||
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
public fun poll(): E? = noImpl
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
public fun peek(): E? = noImpl
|
||||
public fun offer(e: E): Boolean = noImpl
|
||||
}
|
||||
@@ -104,13 +104,13 @@ library
|
||||
public open class HashMap<K, V>(initialCapacity: Int = DEFAULT_INITIAL_CAPACITY, loadFactor: Float = DEFAULT_LOAD_FACTOR) : MutableMap<K, V> {
|
||||
override fun size(): Int = noImpl
|
||||
override fun isEmpty(): Boolean = noImpl
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
override fun get(key: Any?): V? = noImpl
|
||||
override fun containsKey(key: Any?): Boolean = noImpl
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
override fun put(key: K, value: V): V? = noImpl
|
||||
override fun putAll(m: Map<out K, V>): Unit = noImpl
|
||||
[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")]
|
||||
@suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
override fun remove(key: Any?): V? = noImpl
|
||||
override fun clear(): Unit = noImpl
|
||||
override fun containsValue(value: Any?): Boolean = noImpl
|
||||
|
||||
@@ -31,7 +31,7 @@ fun File.mkdirsProperly() {
|
||||
|
||||
|
||||
class KDocSampleTest {
|
||||
[Test]
|
||||
@Test
|
||||
fun generateKDocForSample() {
|
||||
val compiler = KDocCompiler()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class PsiUtilsTest {
|
||||
|
||||
private var environment: KotlinCoreEnvironment? = null
|
||||
|
||||
[Before]
|
||||
@Before
|
||||
fun before() {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
|
||||
@@ -37,7 +37,7 @@ class PsiUtilsTest {
|
||||
environment = KotlinCoreEnvironment.createForTests(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
}
|
||||
|
||||
[After]
|
||||
@After
|
||||
fun after() {
|
||||
Disposer.dispose(rootDisposable)
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class PsiUtilsTest {
|
||||
.trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false) as JetFile
|
||||
}
|
||||
|
||||
[Test]
|
||||
@Test
|
||||
fun splitPsi() {
|
||||
val file = createFile("class Foo")
|
||||
val items: List<String> = splitPsi(file).map { t -> t.first }
|
||||
|
||||
Reference in New Issue
Block a user