Make project compilable after PurelyImplements annotation introduction

This commit is contained in:
Denis Zharkov
2015-07-02 19:28:39 +03:00
parent a218c1359f
commit 5c60a1bdb8
17 changed files with 23 additions and 22 deletions
@@ -145,8 +145,8 @@ public class FixStackAnalyzer(
private fun FixStackFrame.executeRestoreStackInTryCatch(insn: AbstractInsnNode) { private fun FixStackFrame.executeRestoreStackInTryCatch(insn: AbstractInsnNode) {
val saveNode = context.saveStackMarkerForRestoreMarker[insn] val saveNode = context.saveStackMarkerForRestoreMarker[insn]
val savedValues = savedStacks.getOrElse(saveNode) { val savedValues = savedStacks.getOrElse(saveNode!!) {
throw AssertionError("${indexOf(insn)}: Restore stack is unavailable for ${indexOf(saveNode!!)}") throw AssertionError("${indexOf(insn)}: Restore stack is unavailable for ${indexOf(saveNode)}")
} }
pushAll(savedValues) pushAll(savedValues)
} }
@@ -89,7 +89,7 @@ public open class JetClass : JetClassOrObject {
val parts = ArrayList<String>() val parts = ArrayList<String>()
var current: JetClassOrObject? = this var current: JetClassOrObject? = this
while (current != null) { while (current != null) {
parts.add(current.getName()) parts.add(current.getName()!!)
current = PsiTreeUtil.getParentOfType<JetClassOrObject>(current, javaClass<JetClassOrObject>()) current = PsiTreeUtil.getParentOfType<JetClassOrObject>(current, javaClass<JetClassOrObject>())
} }
val file = getContainingFile() val file = getContainingFile()
@@ -52,7 +52,7 @@ fun createSynthesizedInvokes(functions: Collection<FunctionDescriptor>): Collect
fakeOverride fakeOverride
} }
result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType()))) result.add(synthesized.substitute(TypeSubstitutor.create(invoke.getDispatchReceiverParameter()!!.getType()))!!)
} }
return result return result
@@ -89,10 +89,10 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
val parent = accessor.getParent() as JetProperty val parent = accessor.getParent() as JetProperty
val propertyDescriptor = getDescriptor(parent, resolveSession) as PropertyDescriptor val propertyDescriptor = getDescriptor(parent, resolveSession) as PropertyDescriptor
if (accessor.isGetter()) { if (accessor.isGetter()) {
descriptors.add(propertyDescriptor.getGetter()) descriptors.add(propertyDescriptor.getGetter()!!)
} }
else { else {
descriptors.add(propertyDescriptor.getSetter()) descriptors.add(propertyDescriptor.getSetter()!!)
} }
accessor.acceptChildren(this) 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 class has primary constructor then we visit it later, otherwise add it artificially
if (element !is JetClassOrObject || !element.hasExplicitPrimaryConstructor()) { if (element !is JetClassOrObject || !element.hasExplicitPrimaryConstructor()) {
if (descriptor.getUnsubstitutedPrimaryConstructor() != null) { if (descriptor.getUnsubstitutedPrimaryConstructor() != null) {
descriptors.add(descriptor.getUnsubstitutedPrimaryConstructor()) descriptors.add(descriptor.getUnsubstitutedPrimaryConstructor()!!)
} }
} }
} }
@@ -46,7 +46,7 @@ abstract public class AbstractFunctionDescriptorInExpressionRendererTest : Kotli
} }
override fun visitFunctionLiteralExpression(expression: JetFunctionLiteralExpression) { override fun visitFunctionLiteralExpression(expression: JetFunctionLiteralExpression) {
expression.acceptChildren(this) expression.acceptChildren(this)
descriptors.add(bindingContext.get(BindingContext.FUNCTION, expression.getFunctionLiteral())) descriptors.add(bindingContext.get(BindingContext.FUNCTION, expression.getFunctionLiteral())!!)
} }
}) })
@@ -34,7 +34,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
if (substitutor.isEmpty()) return descriptor if (substitutor.isEmpty()) return descriptor
if (substitutedDescriptors == null) { if (substitutedDescriptors == null) {
substitutedDescriptors = HashMap<DeclarationDescriptor, DeclarationDescriptor>() substitutedDescriptors = HashMap<DeclarationDescriptor, DeclarationDescriptor?>()
} }
val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) }) val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) })
@@ -117,7 +117,7 @@ class ParameterNameAndTypeCompletion(
if (parameterType.isVisible(visibilityFilter)) { if (parameterType.isVisible(visibilityFilter)) {
val lookupElement = MyLookupElement.create("", name, ArbitraryType(parameterType), lookupElementFactory) val lookupElement = MyLookupElement.create("", name, ArbitraryType(parameterType), lookupElementFactory)
val count = lookupElementToCount[lookupElement] ?: 0 val count = lookupElementToCount[lookupElement] ?: 0
lookupElementToCount[lookupElement] = count + 1 lookupElementToCount[lookupElement!!] = count + 1
} }
} }
} }
@@ -211,7 +211,7 @@ private fun lookupElementsForNullable(factory: () -> LookupElement?): Collection
} }
lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.suppressAutoInsertion()
lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE) lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE)
result.add(lookupElement) result.add(lookupElement!!)
} }
lookupElement = factory() lookupElement = factory()
@@ -227,7 +227,7 @@ private fun lookupElementsForNullable(factory: () -> LookupElement?): Collection
} }
lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.suppressAutoInsertion()
lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE) lookupElement = lookupElement!!.assignSmartCompletionPriority(SmartCompletionItemPriority.NULLABLE)
result.add(lookupElement) result.add(lookupElement!!)
} }
return result return result
@@ -212,7 +212,7 @@ object KotlinOutputParserHelper {
else else
Class.forName("$packagePrefix.GradleMessage\$Kind") Class.forName("$packagePrefix.GradleMessage\$Kind")
val messageKindConstants = messageKindClass.getEnumConstants() val messageKindConstants = messageKindClass.getEnumConstants() as Array<Any>
for (kind in messageKindConstants) { for (kind in messageKindConstants) {
when(kind.toString()) { when(kind.toString()) {
"ERROR" -> severityObjectMap.put("e", kind) "ERROR" -> severityObjectMap.put("e", kind)
@@ -299,7 +299,7 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment,
override fun visitProperty(property: JetProperty) { override fun visitProperty(property: JetProperty) {
val value = property.getUserData(KotlinCodeFragmentFactory.LABEL_VARIABLE_VALUE_KEY) val value = property.getUserData(KotlinCodeFragmentFactory.LABEL_VARIABLE_VALUE_KEY)
if (value != null) { if (value != null) {
valuesForLabels.put(property.getName(), value.asValue()) valuesForLabels.put(property.getName()!!, value.asValue())
} }
} }
}) })
@@ -85,7 +85,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetN
val property = originalFunction.replace(psiFactory.createProperty(function.getText())) as JetProperty val property = originalFunction.replace(psiFactory.createProperty(function.getText())) as JetProperty
if (needsExplicitType) { if (needsExplicitType) {
elementsToShorten.add(property.getTypeReference()) elementsToShorten.add(property.getTypeReference()!!)
} }
} }
@@ -54,12 +54,12 @@ public class AddLoopLabelFix(loop: JetLoopExpression, val jumpExpression: JetEle
element.acceptChildren(object : JetTreeVisitorVoid() { element.acceptChildren(object : JetTreeVisitorVoid() {
override fun visitLabeledExpression(expression: JetLabeledExpression) { override fun visitLabeledExpression(expression: JetLabeledExpression) {
super.visitLabeledExpression(expression) super.visitLabeledExpression(expression)
usedLabels.add(expression.getLabelName()) usedLabels.add(expression.getLabelName()!!)
} }
}) })
element.parents.forEach { element.parents.forEach {
if (it is JetLabeledExpression) { if (it is JetLabeledExpression) {
usedLabels.add(it.getLabelName()) usedLabels.add(it.getLabelName()!!)
} }
} }
return usedLabels return usedLabels
@@ -173,7 +173,7 @@ public object SuperClassNotInitialized : JetIntentionActionsFactory() {
for (parameter in parametersToAdd) { for (parameter in parametersToAdd) {
val newParameter = parameterList.addParameter(parameter) val newParameter = parameterList.addParameter(parameter)
typeRefsToShorten.add(newParameter.getTypeReference()) typeRefsToShorten.add(newParameter.getTypeReference()!!)
} }
val delegatorCall = factory.createDelegatorToSuperCall(element.getText() + "(" + parameterNames.joinToString(",") + ")") val delegatorCall = factory.createDelegatorToSuperCall(element.getText() + "(" + parameterNames.joinToString(",") + ")")
@@ -724,7 +724,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
} }
else { else {
oldTypeArgumentList.replace(JetPsiFactory(callElement).createTypeArguments(renderedTypeArgs.joinToString(", ", "<", ">"))) oldTypeArgumentList.replace(JetPsiFactory(callElement).createTypeArguments(renderedTypeArgs.joinToString(", ", "<", ">")))
elementsToShorten.add(callElement.getTypeArgumentList()) elementsToShorten.add(callElement.getTypeArgumentList()!!)
} }
} }
@@ -294,6 +294,7 @@ public abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestB
assert(localVariable != null) { "Couldn't find localVariable for label: name = $localVariableName" } assert(localVariable != null) { "Couldn't find localVariable for label: name = $localVariableName" }
val localVariableValue = context.getFrameProxy()!!.getValue(localVariable) as? ObjectReference val localVariableValue = context.getFrameProxy()!!.getValue(localVariable) as? ObjectReference
assert(localVariableValue != null) { "Local variable $localVariableName should be an ObjectReference" } assert(localVariableValue != null) { "Local variable $localVariableName should be an ObjectReference" }
localVariableValue!!
markupMap.put(localVariableValue, ValueMarkup(labelName, null, labelName)) markupMap.put(localVariableValue, ValueMarkup(labelName, null, labelName))
} }
@@ -68,10 +68,10 @@ public object IdeaReferenceSearcher: ReferenceSearcher {
override fun findUsagesForExternalCodeProcessing(element: PsiElement, searchJava: Boolean, searchKotlin: Boolean): Collection<PsiReference> { override fun findUsagesForExternalCodeProcessing(element: PsiElement, searchJava: Boolean, searchKotlin: Boolean): Collection<PsiReference> {
val fileTypes = ArrayList<FileType>() val fileTypes = ArrayList<FileType>()
if (searchJava) { if (searchJava) {
fileTypes.add(JavaLanguage.INSTANCE.getAssociatedFileType()) fileTypes.add(JavaLanguage.INSTANCE.getAssociatedFileType()!!)
} }
if (searchKotlin) { if (searchKotlin) {
fileTypes.add(JetLanguage.INSTANCE.getAssociatedFileType()) fileTypes.add(JetLanguage.INSTANCE.getAssociatedFileType()!!)
} }
val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.getProject()), *fileTypes.toTypedArray()) val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.getProject()), *fileTypes.toTypedArray())
return ReferencesSearch.search(element, searchScope).findAll() return ReferencesSearch.search(element, searchScope).findAll()
@@ -92,7 +92,7 @@ public class FunctionReader(private val context: TranslationContext) {
public fun contains(descriptor: CallableDescriptor): Boolean { public fun contains(descriptor: CallableDescriptor): Boolean {
val moduleName = getExternalModuleName(descriptor) val moduleName = getExternalModuleName(descriptor)
val currentModuleName = context.getConfig().getModuleId() 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) public fun get(descriptor: CallableDescriptor): JsFunction = functionCache.get(descriptor)