Cleanup descriptors in frontend

Remove useless classes/interfaces, inline useless superclasses, make the code
greener
This commit is contained in:
Alexander Udalov
2013-09-10 18:01:35 +04:00
committed by Alexander Udalov
parent cb10cbdf7a
commit f5af43ed24
11 changed files with 17 additions and 106 deletions
@@ -1,20 +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.descriptors;
public interface Annotation {
}
@@ -1,26 +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.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.resolve.name.FqName;
public interface FqNamed {
@NotNull
FqName getFqName();
}
@@ -32,7 +32,7 @@ import javax.inject.Inject;
import java.util.Collections;
import java.util.List;
public class ModuleDescriptorImpl extends DeclarationDescriptorImpl implements ClassOrNamespaceDescriptor, ModuleDescriptor {
public class ModuleDescriptorImpl extends DeclarationDescriptorImpl implements ModuleDescriptor {
private NamespaceDescriptor rootNamepsace;
private ModuleConfiguration moduleConfiguration;
private final List<ImportPath> defaultImports;
@@ -1,24 +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.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.types.JetType;
public interface MutableValueParameterDescriptor extends ValueParameterDescriptor {
void setType(@NotNull JetType type);
}
@@ -17,14 +17,18 @@
package org.jetbrains.jet.lang.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.descriptors.impl.NamespaceDescriptorParent;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
public interface NamespaceDescriptor extends Annotated, Named, FqNamed, ClassOrNamespaceDescriptor, NamespaceDescriptorParent {
public interface NamespaceDescriptor extends ClassOrNamespaceDescriptor, NamespaceDescriptorParent {
@NotNull
JetScope getMemberScope();
@Override
@NotNull
NamespaceDescriptorParent getContainingDeclaration();
@NotNull
FqName getFqName();
}
@@ -18,13 +18,12 @@ package org.jetbrains.jet.lang.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.JetType;
import java.util.Set;
public interface ValueParameterDescriptor extends VariableDescriptor, Annotated {
public interface ValueParameterDescriptor extends VariableDescriptor {
/**
* Returns the 0-based index of the value parameter in the parameter list of its containing function.
*
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.descriptors.impl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor;
import org.jetbrains.jet.lang.descriptors.Named;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotatedImpl;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.name.Name;
@@ -27,7 +26,7 @@ import org.jetbrains.jet.renderer.DescriptorRenderer;
import java.util.List;
public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements Named, DeclarationDescriptor {
public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements DeclarationDescriptor {
@NotNull
private final Name name;
@@ -1,20 +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.descriptors.impl;
public class ExtensionDescriptor {
}
@@ -30,7 +30,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
public class ValueParameterDescriptorImpl extends VariableDescriptorImpl implements MutableValueParameterDescriptor {
public class ValueParameterDescriptorImpl extends VariableDescriptorImpl implements ValueParameterDescriptor {
private Boolean hasDefaultValue;
private final boolean declaresDefaultValue;
@@ -72,7 +72,6 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
this.varargElementType = varargElementType;
}
@Override
public void setType(@NotNull JetType type) {
setOutType(type);
}
@@ -493,7 +493,7 @@ public class DescriptorResolver {
}
@NotNull
public MutableValueParameterDescriptor resolveValueParameterDescriptor(
public ValueParameterDescriptorImpl resolveValueParameterDescriptor(
JetScope scope, DeclarationDescriptor declarationDescriptor,
JetParameter valueParameter, int index, JetType type, BindingTrace trace
) {
@@ -502,7 +502,7 @@ public class DescriptorResolver {
}
@NotNull
public MutableValueParameterDescriptor resolveValueParameterDescriptorWithAnnotationArguments(
public ValueParameterDescriptorImpl resolveValueParameterDescriptorWithAnnotationArguments(
JetScope scope, DeclarationDescriptor declarationDescriptor,
JetParameter valueParameter, int index, JetType type, BindingTrace trace
) {
@@ -511,7 +511,7 @@ public class DescriptorResolver {
}
@NotNull
private MutableValueParameterDescriptor resolveValueParameterDescriptor(
private static ValueParameterDescriptorImpl resolveValueParameterDescriptor(
DeclarationDescriptor declarationDescriptor,
JetParameter valueParameter, int index, JetType type, BindingTrace trace,
List<AnnotationDescriptor> annotations
@@ -522,7 +522,7 @@ public class DescriptorResolver {
varargElementType = type;
variableType = DescriptorUtils.getVarargParameterType(type);
}
MutableValueParameterDescriptor valueParameterDescriptor = new ValueParameterDescriptorImpl(
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
declarationDescriptor,
index,
annotations,
@@ -1166,7 +1166,7 @@ public class DescriptorResolver {
}
}
MutableValueParameterDescriptor valueParameterDescriptor =
ValueParameterDescriptorImpl valueParameterDescriptor =
resolveValueParameterDescriptor(scope, setterDescriptor, parameter, 0, type, trace);
setterDescriptor.initialize(valueParameterDescriptor);
}
@@ -8,7 +8,7 @@
<class-object-for-NestedClass>.nestedClassObjFunc:SimpleFunctionDescriptor
<class-object-for-NestedClass>.this:ReceiverParameterDescriptor
<class-object-for-NestedClass>:ClassDescriptor
<set-?>:MutableValueParameterDescriptor
<set-?>:ValueParameterDescriptor
Class.<get-classProp>:PropertyGetterDescriptor
Class.<init>():ConstructorDescriptor
Class.classFunc:SimpleFunctionDescriptor
@@ -38,7 +38,7 @@ Trait.this:ReceiverParameterDescriptor
Trait.traitFunc:SimpleFunctionDescriptor
Trait.traitProp:PropertyDescriptor
Trait:ClassDescriptor
a:MutableValueParameterDescriptor
a:ValueParameterDescriptor
fake Class.<get-traitProp>:PropertyGetterDescriptor
fake Class.traitFunc:SimpleFunctionDescriptor
fake Class.traitProp:PropertyDescriptor