diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java index a55d09fe88c..d2f488d57d3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java @@ -1441,8 +1441,7 @@ public class JetControlFlowProcessor { processParameters(constructor.getValueParameters()); generateCallOrMarkUnresolved(constructor.getDelegationCall()); - if (constructor.getDelegationCall() != null && !constructor.getDelegationCall().isCallToThis() - ) { + if (!constructor.getDelegationCall().isCallToThis()) { generateClassOrObjectInitializers(classOrObject); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiFactory.kt index bc9461ab760..b6f3833a5e1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiFactory.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiFactory.kt @@ -363,7 +363,7 @@ public class JetPsiFactory(private val project: Project) { public fun createConstructorDelegationCall(text: String): JetConstructorDelegationCall { val colonOrEmpty = if (text.isEmpty()) "" else ": " - return createClass("class A { constructor()$colonOrEmpty$text {}").getSecondaryConstructors().first().getDelegationCall()!! + return createClass("class A { constructor()$colonOrEmpty$text {}").getSecondaryConstructors().first().getDelegationCall() } public inner class IfChainBuilder() { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java index 9a403e09e6b..a406e3f253d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java @@ -172,14 +172,14 @@ public class JetSecondaryConstructor extends JetDeclarationStub resolveConstructorDelegationCall( @NotNull BindingTrace trace, @NotNull JetScope scope, @NotNull DataFlowInfo dataFlowInfo, @NotNull ConstructorDescriptor constructorDescriptor, - @Nullable JetConstructorDelegationCall call + @NotNull JetConstructorDelegationCall call ) { - // Returns `null` when there is nothing to resolve in trivial cases like `null` call expression or + // Method returns `null` when there is nothing to resolve in trivial cases like `null` call expression or // when super call should be conventional enum constructor and super call should be empty - if (call == null) return null; BasicCallResolutionContext context = BasicCallResolutionContext.create( trace, scope, diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt index 5a472eec0a8..95b4a543be2 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt @@ -157,9 +157,9 @@ private fun processClassDelegationCallsToSpecifiedConstructor( klass: JetClass, constructor: DeclarationDescriptor, process: (JetConstructorDelegationCall) -> Unit ) { for (secondaryConstructor in klass.getSecondaryConstructors()) { - val delegationCallDescriptor = secondaryConstructor.getDelegationCall()?.getConstructorCallDescriptor() + val delegationCallDescriptor = secondaryConstructor.getDelegationCall().getConstructorCallDescriptor() if (constructor == delegationCallDescriptor) { - process(secondaryConstructor.getDelegationCall()!!) + process(secondaryConstructor.getDelegationCall()) } } }