Code cleanup: get rid of unnecessary !! / ?. / as
This commit is contained in:
@@ -309,7 +309,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
if (ourApplicationEnvironment == null) return
|
||||
val environment = ourApplicationEnvironment
|
||||
ourApplicationEnvironment = null
|
||||
Disposer.dispose(environment!!.getParentDisposable())
|
||||
Disposer.dispose(environment.getParentDisposable())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -359,7 +359,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
||||
}
|
||||
val classParametersSubstitutor = TypeSubstitutor.create(substitutionMap)
|
||||
|
||||
descriptor.getMethod = getMethod.substitute(classParametersSubstitutor)!!
|
||||
descriptor.getMethod = getMethod.substitute(classParametersSubstitutor)
|
||||
descriptor.setMethod = setMethod?.substitute(classParametersSubstitutor)
|
||||
return descriptor
|
||||
}
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
|
||||
}
|
||||
|
||||
val sourceFunctionSubstitutor = TypeSubstitutor.create(substitutionMap)
|
||||
descriptor.sourceFunction = original.sourceFunction.substitute(sourceFunctionSubstitutor)!!
|
||||
descriptor.sourceFunction = original.sourceFunction.substitute(sourceFunctionSubstitutor)
|
||||
|
||||
return descriptor
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ public fun PsiElement.getParentOfTypesAndPredicate<T : PsiElement>(
|
||||
while (element != null) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
when {
|
||||
(parentClasses.isEmpty() || parentClasses.any { parentClass -> parentClass.isInstance(element) }) && predicate(element!! as T) ->
|
||||
return element as T
|
||||
(parentClasses.isEmpty() || parentClasses.any { parentClass -> parentClass.isInstance(element) }) && predicate(element as T) ->
|
||||
return element
|
||||
element is PsiFile ->
|
||||
return null
|
||||
else ->
|
||||
element = element!!.getParent()
|
||||
element = element.getParent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ fun createSynthesizedInvokes(functions: Collection<FunctionDescriptor>): Collect
|
||||
fakeOverride
|
||||
}
|
||||
|
||||
result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType()))!!)
|
||||
result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType())))
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -189,7 +189,7 @@ class LazyOperationsLog(
|
||||
}.appendQuoted()
|
||||
}
|
||||
o is ResolutionCandidate<*> -> DescriptorRenderer.COMPACT.render(o.getDescriptor()).appendQuoted()
|
||||
o is ResolutionTaskHolder<*, *> -> o.field<BasicCallResolutionContext>("basicCallResolutionContext").call.getCallElement().getDebugText()?.appendQuoted()
|
||||
o is ResolutionTaskHolder<*, *> -> o.field<BasicCallResolutionContext>("basicCallResolutionContext").call.getCallElement().getDebugText().appendQuoted()
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
+2
-2
@@ -54,10 +54,10 @@ public abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCom
|
||||
catch (e: Throwable) {
|
||||
var result = ""
|
||||
if (factory1 != null) {
|
||||
result += "FIRST: \n\n" + factory1!!.createText()
|
||||
result += "FIRST: \n\n" + factory1.createText()
|
||||
}
|
||||
if (factory2 != null) {
|
||||
result += "\n\nSECOND: \n\n" + factory2!!.createText()
|
||||
result += "\n\nSECOND: \n\n" + factory2.createText()
|
||||
}
|
||||
System.out.println(result)
|
||||
throw e
|
||||
|
||||
Reference in New Issue
Block a user