Drop ModuleDescriptor.sourceKind, move this code to IDE modules

This information is only used in IDE and it can easily be computed there
This commit is contained in:
Alexander Udalov
2017-04-11 17:37:22 +03:00
parent aaeb53fb8b
commit f594a4c018
8 changed files with 34 additions and 59 deletions
@@ -26,8 +26,6 @@ interface ModuleDescriptor : DeclarationDescriptor {
val builtIns: KotlinBuiltIns
val sourceKind: SourceKind
fun shouldSeeInternalsOf(targetModule: ModuleDescriptor): Boolean
override fun substitute(substitutor: TypeSubstitutor): ModuleDescriptor {
@@ -1,23 +0,0 @@
/*
* 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.
*/
package org.jetbrains.kotlin.descriptors
enum class SourceKind {
NONE,
PRODUCTION,
TEST
}
@@ -17,12 +17,13 @@
package org.jetbrains.kotlin.descriptors.impl
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.utils.sure
import java.lang.IllegalArgumentException
@@ -33,7 +34,6 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
override val builtIns: KotlinBuiltIns,
// May be null in compiler context, should be not-null in IDE context
multiTargetPlatform: MultiTargetPlatform? = null,
override val sourceKind: SourceKind = SourceKind.NONE,
capabilities: Map<ModuleDescriptor.Capability<*>, Any?> = emptyMap()
) : DeclarationDescriptorImpl(Annotations.EMPTY, moduleName), ModuleDescriptor {
init {
@@ -46,16 +46,10 @@ import static kotlin.collections.CollectionsKt.emptyList;
import static kotlin.collections.CollectionsKt.joinToString;
public class ErrorUtils {
private static final ModuleDescriptor ERROR_MODULE;
static {
ERROR_MODULE = new ModuleDescriptor() {
@NotNull
@Override
public SourceKind getSourceKind() {
return SourceKind.NONE;
}
@Nullable
@Override
public <T> T getCapability(@NotNull Capability<T> capability) {