diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicLookupElementFactory.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicLookupElementFactory.kt index f959067f25e..17db0ad05e8 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicLookupElementFactory.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicLookupElementFactory.kt @@ -124,15 +124,14 @@ class BasicLookupElementFactory( includeClassTypeArguments: Boolean, parametersAndTypeGrayed: Boolean ): LookupElement { - val declarationLazy by lazy { DescriptorToSourceUtilsIde.getAnyDeclaration(project, descriptor) } - - if (descriptor is JavaClassDescriptor && - declarationLazy is PsiClass && - declarationLazy !is KtLightClass) { - // for java classes we create special lookup elements - // because they must be equal to ones created in TypesCompletion - // otherwise we may have duplicates - return createLookupElementForJavaClass(declarationLazy, qualifyNestedClasses, includeClassTypeArguments) + if (descriptor is JavaClassDescriptor) { + val declaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, descriptor) + if (declaration is PsiClass && declaration !is KtLightClass) { + // for java classes we create special lookup elements + // because they must be equal to ones created in TypesCompletion + // otherwise we may have duplicates + return createLookupElementForJavaClass(declaration, qualifyNestedClasses, includeClassTypeArguments) + } } if (descriptor is PackageViewDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveUtils.kt index 38d24935157..841000e5f89 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveUtils.kt @@ -182,10 +182,10 @@ fun KtElement.processInternalReferencesToUpdateOnPackageNameChange( val isImported = isImported(descriptor) if (isImported && this is KtFile) return null - if (declaration == null) return null + val declarationNotNull = declaration ?: return null if (isExtension || containerFqName != null || isImported) return { - createMoveUsageInfoIfPossible(it.mainReference, declaration, false, true) + createMoveUsageInfoIfPossible(it.mainReference, declarationNotNull, false, true) } return null diff --git a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt index 92858405b7c..60b318a199b 100644 --- a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt +++ b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ClassFileToSourceStubConverter.kt @@ -793,7 +793,7 @@ class ClassFileToSourceStubConverter( private fun convertAnnotationArgument(constantValue: Any?, value: ResolvedValueArgument?): JCExpression? { val args = value?.arguments?.mapNotNull { it.getArgumentExpression() } ?: emptyList() - val singleArg by lazy { args.singleOrNull() } + val singleArg = args.singleOrNull() if (constantValue.isOfPrimiviteType()) { // Do not inline primitive constants