Removed ModuleConfiguration.

This commit is contained in:
Evgeny Gerashchenko
2013-10-30 11:46:53 +04:00
parent 67f06c816b
commit d0605009ae
21 changed files with 9 additions and 131 deletions
@@ -17,25 +17,16 @@
package org.jetbrains.jet.lang;
import com.google.common.collect.ImmutableList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.resolve.ImportPath;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
import java.util.List;
public class DefaultModuleConfiguration implements ModuleConfiguration {
public class DefaultModuleConfiguration {
public static final List<ImportPath> DEFAULT_JET_IMPORTS = ImmutableList.of(
new ImportPath("kotlin.*"),
new ImportPath("kotlin.io.*"),
new ImportPath("jet.*"));
public static final ModuleConfiguration INSTANCE = new DefaultModuleConfiguration();
private DefaultModuleConfiguration() {
}
@Override
public void extendNamespaceScope(@NotNull NamespaceDescriptor namespaceDescriptor, @NotNull WritableScope namespaceMemberScope) {
}
}
@@ -1,40 +0,0 @@
/*
* Copyright 2010-2013 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.jet.lang;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
public interface ModuleConfiguration {
ModuleConfiguration EMPTY = new ModuleConfiguration() {
@Override
public void extendNamespaceScope(@NotNull NamespaceDescriptor namespaceDescriptor, @NotNull WritableScope namespaceMemberScope) {
}
@Override
public String toString() {
return "EMPTY";
}
};
/**
* This method is called every time a namespace descriptor is created. Use it to add extra descriptors to the namespace, e.g. merge a
* Java package with a Kotlin one
*/
void extendNamespaceScope(@NotNull NamespaceDescriptor namespaceDescriptor, @NotNull WritableScope namespaceMemberScope);
}
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.ModuleConfiguration;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.descriptors.impl.NamespaceDescriptorParent;
import org.jetbrains.jet.lang.resolve.ImportPath;
@@ -38,9 +37,6 @@ public interface ModuleDescriptor extends DeclarationDescriptor, NamespaceDescri
@Nullable
PackageViewDescriptor getPackage(@NotNull FqName fqName);
@NotNull
ModuleConfiguration getModuleConfiguration();
@NotNull
List<ImportPath> getDefaultImports();
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.descriptors;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.ModuleConfiguration;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.CompositePackageFragmentProvider;
@@ -36,7 +35,6 @@ import java.util.List;
public class ModuleDescriptorImpl extends DeclarationDescriptorImpl implements ModuleDescriptor {
private final List<PackageFragmentProvider> fragmentProviders = Lists.newArrayList();
private final CompositePackageFragmentProvider packageFragmentProvider = new CompositePackageFragmentProvider(fragmentProviders);
private ModuleConfiguration moduleConfiguration;
private final List<ImportPath> defaultImports;
private final PlatformToKotlinClassMap platformToKotlinClassMap;
@@ -78,19 +76,6 @@ public class ModuleDescriptorImpl extends DeclarationDescriptorImpl implements M
: null;
}
@NotNull
@Override
public ModuleConfiguration getModuleConfiguration() {
return moduleConfiguration;
}
@NotNull
public ModuleDescriptorImpl setModuleConfiguration(@NotNull ModuleConfiguration moduleConfiguration) {
assert this.moduleConfiguration == null : "Trying to set module configuration twice for " + this;
this.moduleConfiguration = moduleConfiguration;
return this;
}
@NotNull
@Override
public List<ImportPath> getDefaultImports() {
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.types;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.ModuleConfiguration;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
@@ -42,13 +41,11 @@ public class ErrorUtils {
private static final ModuleDescriptor ERROR_MODULE;
static {
ModuleDescriptorImpl module = new ModuleDescriptorImpl(
ERROR_MODULE = new ModuleDescriptorImpl(
Name.special("<ERROR MODULE>"),
Collections.<ImportPath>emptyList(),
PlatformToKotlinClassMap.EMPTY
);
module.setModuleConfiguration(ModuleConfiguration.EMPTY);
ERROR_MODULE = module;
}
public static boolean containsErrorType(@NotNull FunctionDescriptor function) {
@@ -21,7 +21,6 @@ import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.DefaultModuleConfiguration;
import org.jetbrains.jet.lang.ModuleConfiguration;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
@@ -131,7 +130,6 @@ public class KotlinBuiltIns {
this.builtInsModule = new ModuleDescriptorImpl(Name.special("<built-ins lazy module>"),
DefaultModuleConfiguration.DEFAULT_JET_IMPORTS,
PlatformToKotlinClassMap.EMPTY);
builtInsModule.setModuleConfiguration(ModuleConfiguration.EMPTY);
loadBuiltIns(builtInsModule);
this.functionClassesSet = computeIndexedClasses("Function", FUNCTION_TRAIT_COUNT);