From 5c60a1bdb8997d246e20c070d77afaf080edccd5 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Thu, 2 Jul 2015 19:28:39 +0300 Subject: [PATCH] Make project compilable after PurelyImplements annotation introduction --- .../codegen/optimization/fixStack/FixStackAnalyzer.kt | 4 ++-- compiler/frontend/src/org/jetbrains/kotlin/psi/JetClass.kt | 2 +- .../kotlin/resolve/calls/tasks/synthesizedInvokes.kt | 2 +- .../kotlin/renderer/AbstractDescriptorRendererTest.kt | 6 +++--- .../AbstractFunctionDescriptorInExpressionRendererTest.kt | 2 +- .../jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt | 2 +- .../idea/completion/ParameterNameAndTypeCompletion.kt | 2 +- .../src/org/jetbrains/kotlin/idea/completion/smart/Utils.kt | 4 ++-- .../jetbrains/kotlin/android/KotlinOutputParserHelper.kt | 2 +- .../idea/debugger/evaluate/KotlinEvaluationBuilder.kt | 2 +- .../idea/intentions/ConvertFunctionToPropertyIntention.kt | 2 +- .../org/jetbrains/kotlin/idea/quickfix/AddLoopLabelFix.kt | 4 ++-- .../kotlin/idea/quickfix/SuperClassNotInitialized.kt | 2 +- .../createFromUsage/callableBuilder/CallableBuilder.kt | 2 +- .../evaluate/AbstractKotlinEvaluateExpressionTest.kt | 1 + j2k/src/org/jetbrains/kotlin/j2k/ReferenceSearcher.kt | 4 ++-- .../src/org/jetbrains/kotlin/js/inline/FunctionReader.kt | 2 +- 17 files changed, 23 insertions(+), 22 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FixStackAnalyzer.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FixStackAnalyzer.kt index bd69862aa9b..6f8daf431eb 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FixStackAnalyzer.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FixStackAnalyzer.kt @@ -145,8 +145,8 @@ public class FixStackAnalyzer( private fun FixStackFrame.executeRestoreStackInTryCatch(insn: AbstractInsnNode) { val saveNode = context.saveStackMarkerForRestoreMarker[insn] - val savedValues = savedStacks.getOrElse(saveNode) { - throw AssertionError("${indexOf(insn)}: Restore stack is unavailable for ${indexOf(saveNode!!)}") + val savedValues = savedStacks.getOrElse(saveNode!!) { + throw AssertionError("${indexOf(insn)}: Restore stack is unavailable for ${indexOf(saveNode)}") } pushAll(savedValues) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClass.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClass.kt index 803db5ea1d8..3328e6c389b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClass.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClass.kt @@ -89,7 +89,7 @@ public open class JetClass : JetClassOrObject { val parts = ArrayList() var current: JetClassOrObject? = this while (current != null) { - parts.add(current.getName()) + parts.add(current.getName()!!) current = PsiTreeUtil.getParentOfType(current, javaClass()) } val file = getContainingFile() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/synthesizedInvokes.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/synthesizedInvokes.kt index 9a33c481df4..8ede6660859 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/synthesizedInvokes.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/synthesizedInvokes.kt @@ -52,7 +52,7 @@ fun createSynthesizedInvokes(functions: Collection): Collect fakeOverride } - result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType()))) + result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType()))!!) } return result diff --git a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt index dd79a6dbe94..3f2b65899bf 100644 --- a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt @@ -89,10 +89,10 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment val parent = accessor.getParent() as JetProperty val propertyDescriptor = getDescriptor(parent, resolveSession) as PropertyDescriptor if (accessor.isGetter()) { - descriptors.add(propertyDescriptor.getGetter()) + descriptors.add(propertyDescriptor.getGetter()!!) } else { - descriptors.add(propertyDescriptor.getSetter()) + descriptors.add(propertyDescriptor.getSetter()!!) } accessor.acceptChildren(this) } @@ -108,7 +108,7 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment // if class has primary constructor then we visit it later, otherwise add it artificially if (element !is JetClassOrObject || !element.hasExplicitPrimaryConstructor()) { if (descriptor.getUnsubstitutedPrimaryConstructor() != null) { - descriptors.add(descriptor.getUnsubstitutedPrimaryConstructor()) + descriptors.add(descriptor.getUnsubstitutedPrimaryConstructor()!!) } } } diff --git a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt index d8a4fd61974..fc971976b78 100644 --- a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt @@ -46,7 +46,7 @@ abstract public class AbstractFunctionDescriptorInExpressionRendererTest : Kotli } override fun visitFunctionLiteralExpression(expression: JetFunctionLiteralExpression) { expression.acceptChildren(this) - descriptors.add(bindingContext.get(BindingContext.FUNCTION, expression.getFunctionLiteral())) + descriptors.add(bindingContext.get(BindingContext.FUNCTION, expression.getFunctionLiteral())!!) } }) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt index fe5f9b4836c..f72257b8ae8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt @@ -34,7 +34,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su if (substitutor.isEmpty()) return descriptor if (substitutedDescriptors == null) { - substitutedDescriptors = HashMap() + substitutedDescriptors = HashMap() } val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) }) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ParameterNameAndTypeCompletion.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ParameterNameAndTypeCompletion.kt index 4fb750dbe0c..142215099cf 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ParameterNameAndTypeCompletion.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ParameterNameAndTypeCompletion.kt @@ -117,7 +117,7 @@ class ParameterNameAndTypeCompletion( if (parameterType.isVisible(visibilityFilter)) { val lookupElement = MyLookupElement.create("", name, ArbitraryType(parameterType), lookupElementFactory) val count = lookupElementToCount[lookupElement] ?: 0 - lookupElementToCount[lookupElement] = count + 1 + lookupElementToCount[lookupElement!!] = count + 1 } } } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/Utils.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/Utils.kt index 4fd39209eaf..8fad66a4bd5 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/Utils.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/Utils.kt @@ -211,7 +211,7 @@ private fun lookupElementsForNullable(factory: () -> LookupElement?): Collection } lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE) - result.add(lookupElement) + result.add(lookupElement!!) } lookupElement = factory() @@ -227,7 +227,7 @@ private fun lookupElementsForNullable(factory: () -> LookupElement?): Collection } lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE) - result.add(lookupElement) + result.add(lookupElement!!) } return result diff --git a/idea/kotlin-android-plugin/src/org/jetbrains/kotlin/android/KotlinOutputParserHelper.kt b/idea/kotlin-android-plugin/src/org/jetbrains/kotlin/android/KotlinOutputParserHelper.kt index d0f6aed7714..df22920317b 100644 --- a/idea/kotlin-android-plugin/src/org/jetbrains/kotlin/android/KotlinOutputParserHelper.kt +++ b/idea/kotlin-android-plugin/src/org/jetbrains/kotlin/android/KotlinOutputParserHelper.kt @@ -212,7 +212,7 @@ object KotlinOutputParserHelper { else Class.forName("$packagePrefix.GradleMessage\$Kind") - val messageKindConstants = messageKindClass.getEnumConstants() + val messageKindConstants = messageKindClass.getEnumConstants() as Array for (kind in messageKindConstants) { when(kind.toString()) { "ERROR" -> severityObjectMap.put("e", kind) diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt index 4da92b78e4c..2e6c1e4e08e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -299,7 +299,7 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment, override fun visitProperty(property: JetProperty) { val value = property.getUserData(KotlinCodeFragmentFactory.LABEL_VARIABLE_VALUE_KEY) if (value != null) { - valuesForLabels.put(property.getName(), value.asValue()) + valuesForLabels.put(property.getName()!!, value.asValue()) } } }) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt index 888360dce79..cb0082e01ce 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt @@ -85,7 +85,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention"))) - elementsToShorten.add(callElement.getTypeArgumentList()) + elementsToShorten.add(callElement.getTypeArgumentList()!!) } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt index 74e736fc930..aa91a712f33 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt @@ -294,6 +294,7 @@ public abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestB assert(localVariable != null) { "Couldn't find localVariable for label: name = $localVariableName" } val localVariableValue = context.getFrameProxy()!!.getValue(localVariable) as? ObjectReference assert(localVariableValue != null) { "Local variable $localVariableName should be an ObjectReference" } + localVariableValue!! markupMap.put(localVariableValue, ValueMarkup(labelName, null, labelName)) } diff --git a/j2k/src/org/jetbrains/kotlin/j2k/ReferenceSearcher.kt b/j2k/src/org/jetbrains/kotlin/j2k/ReferenceSearcher.kt index 95588e85ab2..91082618d1d 100644 --- a/j2k/src/org/jetbrains/kotlin/j2k/ReferenceSearcher.kt +++ b/j2k/src/org/jetbrains/kotlin/j2k/ReferenceSearcher.kt @@ -68,10 +68,10 @@ public object IdeaReferenceSearcher: ReferenceSearcher { override fun findUsagesForExternalCodeProcessing(element: PsiElement, searchJava: Boolean, searchKotlin: Boolean): Collection { val fileTypes = ArrayList() if (searchJava) { - fileTypes.add(JavaLanguage.INSTANCE.getAssociatedFileType()) + fileTypes.add(JavaLanguage.INSTANCE.getAssociatedFileType()!!) } if (searchKotlin) { - fileTypes.add(JetLanguage.INSTANCE.getAssociatedFileType()) + fileTypes.add(JetLanguage.INSTANCE.getAssociatedFileType()!!) } val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.getProject()), *fileTypes.toTypedArray()) return ReferencesSearch.search(element, searchScope).findAll() diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt index d0e413a66fd..5d7bdb0e6ba 100644 --- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt +++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt @@ -92,7 +92,7 @@ public class FunctionReader(private val context: TranslationContext) { public fun contains(descriptor: CallableDescriptor): Boolean { val moduleName = getExternalModuleName(descriptor) val currentModuleName = context.getConfig().getModuleId() - return currentModuleName != moduleName && moduleName in moduleJsDefinition + return currentModuleName != moduleName && moduleName != null && moduleName in moduleJsDefinition } public fun get(descriptor: CallableDescriptor): JsFunction = functionCache.get(descriptor)