Fix UL classes descriptors leaks

UL classes built upon descriptors and UL support classes are saving a descriptors.
This could lead to descriptors leakage so we have to eliminate any fields with descriptor references.

Fixed #KT-34337
This commit is contained in:
Igor Yakovlev
2019-10-14 17:59:47 +03:00
parent b01014982f
commit bc66834c3c
11 changed files with 311 additions and 204 deletions
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.caches.resolve
@@ -65,9 +54,9 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
override val isReleasedCoroutine
get() = module?.languageVersionSettings?.supportsFeature(LanguageFeature.ReleaseCoroutines) ?: true
override val moduleDescriptor by lazyPub {
element.getResolutionFacade().moduleDescriptor
}
private val resolutionFacade get() = element.getResolutionFacade()
override val moduleDescriptor get() = resolutionFacade.moduleDescriptor
override val moduleName: String by lazyPub {
JvmCodegenUtil.getModuleName(moduleDescriptor)
@@ -102,9 +91,8 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
return null
}
override val deprecationResolver: DeprecationResolver by lazyPub {
element.getResolutionFacade().getFrontendService(DeprecationResolver::class.java)
}
override val deprecationResolver: DeprecationResolver get() = resolutionFacade.getFrontendService(DeprecationResolver::class.java)
override val typeMapper: KotlinTypeMapper by lazyPub {
KotlinTypeMapper(