提交 0e63fa37 编写于 作者: A Andrey Breslav

Renamed Attribute into Annotation

上级 8c8f1eb4
......@@ -4,7 +4,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetAttribute;
import org.jetbrains.jet.lang.psi.JetModifierList;
import org.jetbrains.jet.lang.types.Attribute;
import org.jetbrains.jet.lang.types.Annotation;
import java.util.Collections;
import java.util.List;
......@@ -12,13 +12,13 @@ import java.util.List;
/**
* @author abreslav
*/
public class AttributeResolver {
public static final AttributeResolver INSTANCE = new AttributeResolver();
public class AnnotationResolver {
public static final AnnotationResolver INSTANCE = new AnnotationResolver();
private AttributeResolver() {}
private AnnotationResolver() {}
@NotNull
public List<Attribute> resolveAttributes(@NotNull List<JetAttribute> attributeElements) {
public List<Annotation> resolveAnnotations(@NotNull List<JetAttribute> attributeElements) {
return Collections.emptyList(); // TODO
// if (attributeElements.isEmpty()) {
// }
......@@ -26,10 +26,10 @@ public class AttributeResolver {
}
@NotNull
public List<Attribute> resolveAttributes(@Nullable JetModifierList modifierList) {
public List<Annotation> resolveAnnotations(@Nullable JetModifierList modifierList) {
if (modifierList == null) {
return Collections.emptyList();
}
return resolveAttributes(modifierList.getAttributes());
return resolveAnnotations(modifierList.getAttributes());
}
}
......@@ -35,7 +35,7 @@ public class ClassDescriptorResolver {
public ClassDescriptor resolveClassDescriptor(@NotNull JetScope scope, @NotNull JetClass classElement) {
ClassDescriptorImpl classDescriptor = new ClassDescriptorImpl(
scope.getContainingDeclaration(),
AttributeResolver.INSTANCE.resolveAttributes(classElement.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(classElement.getModifierList()),
JetPsiUtil.safeName(classElement.getName()));
trace.recordDeclarationResolution(classElement, classDescriptor);
......@@ -86,7 +86,7 @@ public class ClassDescriptorResolver {
List<JetType> supertypes = new ArrayList<JetType>();
TypeConstructorImpl typeConstructor = new TypeConstructorImpl(
descriptor,
AttributeResolver.INSTANCE.resolveAttributes(classElement.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(classElement.getModifierList()),
!open,
JetPsiUtil.safeName(classElement.getName()),
typeParameters,
......@@ -163,7 +163,7 @@ public class ClassDescriptorResolver {
public FunctionDescriptorImpl resolveFunctionDescriptor(DeclarationDescriptor containingDescriptor, JetScope scope, JetFunction function) {
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(
containingDescriptor,
AttributeResolver.INSTANCE.resolveAttributes(function.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(function.getModifierList()),
JetPsiUtil.safeName(function.getName())
);
WritableScope innerScope = semanticServices.createWritableScope(scope, functionDescriptor);
......@@ -220,7 +220,7 @@ public class ClassDescriptorResolver {
MutableValueParameterDescriptor valueParameterDescriptor = new ValueParameterDescriptorImpl(
declarationDescriptor,
index,
AttributeResolver.INSTANCE.resolveAttributes(valueParameter.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(valueParameter.getModifierList()),
JetPsiUtil.safeName(valueParameter.getName()),
valueParameter.isMutable() ? type : null,
type,
......@@ -250,7 +250,7 @@ public class ClassDescriptorResolver {
: typeResolver.resolveType(extensibleScope, extendsBound);
TypeParameterDescriptor typeParameterDescriptor = new TypeParameterDescriptor(
containingDescriptor,
AttributeResolver.INSTANCE.resolveAttributes(typeParameter.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(typeParameter.getModifierList()),
typeParameter.getVariance(),
JetPsiUtil.safeName(typeParameter.getName()),
Collections.singleton(bound),
......@@ -300,7 +300,7 @@ public class ClassDescriptorResolver {
public VariableDescriptor resolveLocalVariableDescriptor(@NotNull DeclarationDescriptor containingDeclaration, @NotNull JetParameter parameter, @NotNull JetType type) {
VariableDescriptor variableDescriptor = new LocalVariableDescriptor(
containingDeclaration,
AttributeResolver.INSTANCE.resolveAttributes(parameter.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(parameter.getModifierList()),
JetPsiUtil.safeName(parameter.getName()),
type,
parameter.isMutable());
......@@ -314,7 +314,7 @@ public class ClassDescriptorResolver {
VariableDescriptorImpl variableDescriptor = new LocalVariableDescriptor(
containingDeclaration,
AttributeResolver.INSTANCE.resolveAttributes(property.getModifierList()),
AnnotationResolver.INSTANCE.resolveAnnotations(property.getModifierList()),
JetPsiUtil.safeName(property.getName()),
type,
property.isVar());
......@@ -330,7 +330,7 @@ public class ClassDescriptorResolver {
JetModifierList modifierList = property.getModifierList();
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
containingDeclaration,
AttributeResolver.INSTANCE.resolveAttributes(modifierList),
AnnotationResolver.INSTANCE.resolveAnnotations(modifierList),
resolveModifiers(modifierList, DEFAULT_MODIFIERS), // TODO : default modifiers differ in different contexts
isVar,
JetPsiUtil.safeName(property.getName()),
......@@ -364,10 +364,10 @@ public class ClassDescriptorResolver {
}
PropertySetterDescriptor setterDescriptor = null;
if (setter != null) {
List<Attribute> attributes = AttributeResolver.INSTANCE.resolveAttributes(setter.getModifierList());
List<Annotation> annotations = AnnotationResolver.INSTANCE.resolveAnnotations(setter.getModifierList());
JetParameter parameter = setter.getParameter();
setterDescriptor = new PropertySetterDescriptor(propertyDescriptor, attributes, setter.getBodyExpression() != null);
setterDescriptor = new PropertySetterDescriptor(propertyDescriptor, annotations, setter.getBodyExpression() != null);
if (parameter != null) {
if (parameter.isRef()) {
semanticServices.getErrorHandler().genericError(parameter.getRefNode(), "Setter parameters can not be 'ref'");
......@@ -410,7 +410,7 @@ public class ClassDescriptorResolver {
PropertyGetterDescriptor getterDescriptor = null;
JetPropertyAccessor getter = property.getGetter();
if (getter != null) {
List<Attribute> attributes = AttributeResolver.INSTANCE.resolveAttributes(getter.getModifierList());
List<Annotation> annotations = AnnotationResolver.INSTANCE.resolveAnnotations(getter.getModifierList());
JetType returnType = null;
JetTypeReference returnTypeReference = getter.getReturnTypeReference();
......@@ -418,7 +418,7 @@ public class ClassDescriptorResolver {
returnType = typeResolver.resolveType(scope, returnTypeReference);
}
getterDescriptor = new PropertyGetterDescriptor(propertyDescriptor, attributes, returnType, getter.getBodyExpression() != null);
getterDescriptor = new PropertyGetterDescriptor(propertyDescriptor, annotations, returnType, getter.getBodyExpression() != null);
trace.recordDeclarationResolution(getter, getterDescriptor);
}
return getterDescriptor;
......@@ -460,7 +460,7 @@ public class ClassDescriptorResolver {
@NotNull List<JetParameter> valueParameters) {
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(
classDescriptor,
AttributeResolver.INSTANCE.resolveAttributes(modifierList),
AnnotationResolver.INSTANCE.resolveAnnotations(modifierList),
isPrimary
);
trace.recordDeclarationResolution(declarationToTrace, constructorDescriptor);
......@@ -502,7 +502,7 @@ public class ClassDescriptorResolver {
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
classDescriptor,
AttributeResolver.INSTANCE.resolveAttributes(modifierList),
AnnotationResolver.INSTANCE.resolveAnnotations(modifierList),
resolveModifiers(modifierList, DEFAULT_MODIFIERS),
isMutable,
name == null ? "<no name>" : name,
......
......@@ -60,7 +60,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
}
@Override
public List<Attribute> getAttributes() {
public List<Annotation> getAnnotations() {
throw new UnsupportedOperationException(); // TODO
}
......
package org.jetbrains.jet.lang.resolve;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.types.Attribute;
import org.jetbrains.jet.lang.types.Annotation;
import org.jetbrains.jet.lang.types.DeclarationDescriptor;
import org.jetbrains.jet.lang.types.DeclarationDescriptorVisitor;
......@@ -19,7 +19,7 @@ public abstract class MutableDeclarationDescriptor implements DeclarationDescrip
}
@Override
public List<Attribute> getAttributes() {
public List<Annotation> getAnnotations() {
throw new UnsupportedOperationException(); // TODO
}
......
......@@ -119,7 +119,7 @@ public class TopDownAnalyzer {
if (namespaceDescriptor == null) {
namespaceDescriptor = new NamespaceDescriptor(
declaringScope.getContainingDeclaration(),
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
name
);
namespaceDescriptor.initialize(semanticServices.createWritableScope(JetScope.EMPTY, namespaceDescriptor));
......
......@@ -25,16 +25,16 @@ public class TypeResolver {
@NotNull
public JetType resolveType(@NotNull final JetScope scope, @NotNull final JetTypeReference typeReference) {
final List<Attribute> attributes = AttributeResolver.INSTANCE.resolveAttributes(typeReference.getAttributes());
final List<Annotation> annotations = AnnotationResolver.INSTANCE.resolveAnnotations(typeReference.getAttributes());
JetTypeElement typeElement = typeReference.getTypeElement();
JetType type = resolveTypeElement(scope, attributes, typeElement, false);
JetType type = resolveTypeElement(scope, annotations, typeElement, false);
trace.recordTypeResolution(typeReference, type);
return type;
}
@NotNull
private JetType resolveTypeElement(final JetScope scope, final List<Attribute> attributes, JetTypeElement typeElement, final boolean nullable) {
private JetType resolveTypeElement(final JetScope scope, final List<Annotation> annotations, JetTypeElement typeElement, final boolean nullable) {
final JetType[] result = new JetType[1];
if (typeElement != null) {
typeElement.accept(new JetVisitor() {
......@@ -54,7 +54,7 @@ public class TypeResolver {
trace.recordReferenceResolution(referenceExpression, typeParameterDescriptor);
result[0] = new JetTypeImpl(
attributes,
annotations,
typeParameterDescriptor.getTypeConstructor(),
nullable || TypeUtils.hasNullableBound(typeParameterDescriptor),
Collections.<TypeProjection>emptyList(),
......@@ -72,7 +72,7 @@ public class TypeResolver {
int actualArgumentCount = arguments.size();
if (ErrorUtils.isError(typeConstructor)) {
result[0] = new JetTypeImpl(
attributes,
annotations,
typeConstructor,
nullable,
arguments, // TODO : review
......@@ -89,7 +89,7 @@ public class TypeResolver {
}
} else {
result[0] = new JetTypeImpl(
attributes,
annotations,
typeConstructor,
nullable,
arguments,
......@@ -103,7 +103,7 @@ public class TypeResolver {
@Override
public void visitNullableType(JetNullableType nullableType) {
result[0] = resolveTypeElement(scope, attributes, nullableType.getInnerType(), true);
result[0] = resolveTypeElement(scope, annotations, nullableType.getInnerType(), true);
}
@Override
......@@ -125,7 +125,7 @@ public class TypeResolver {
JetTypeReference returnTypeRef = type.getReturnTypeRef();
if (returnTypeRef != null) {
JetType returnType = resolveType(scope, returnTypeRef);
result[0] = JetStandardClasses.getFunctionType(attributes, receiverType, parameterTypes, returnType);
result[0] = JetStandardClasses.getFunctionType(annotations, receiverType, parameterTypes, returnType);
}
}
......
......@@ -88,7 +88,7 @@ public class JavaClassMembersScope implements JetScope {
boolean isFinal = field.hasModifierProperty(PsiModifier.FINAL);
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
containingDeclaration,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
new MemberModifiers(false, false, false),
!isFinal,
field.getName(),
......
......@@ -19,7 +19,7 @@ import java.util.*;
*/
public class JavaDescriptorResolver {
/*package*/ static final DeclarationDescriptor JAVA_ROOT = new DeclarationDescriptorImpl(null, Collections.<Attribute>emptyList(), "<java_root>") {
/*package*/ static final DeclarationDescriptor JAVA_ROOT = new DeclarationDescriptorImpl(null, Collections.<Annotation>emptyList(), "<java_root>") {
@NotNull
@Override
public DeclarationDescriptor substitute(TypeSubstitutor substitutor) {
......@@ -84,7 +84,7 @@ public class JavaDescriptorResolver {
List<JetType> supertypes = new ArrayList<JetType>();
classDescriptor.setTypeConstructor(new TypeConstructorImpl(
classDescriptor,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
// TODO
modifierList == null ? false : modifierList.hasModifierProperty(PsiModifier.FINAL),
name,
......@@ -102,7 +102,7 @@ public class JavaDescriptorResolver {
for (PsiMethod constructor : psiConstructors) {
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(
classDescriptor,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
false);
constructorDescriptor.initialize(resolveParameterDescriptors(constructorDescriptor, constructor.getParameterList().getParameters()));
classDescriptor.addConstructor(constructorDescriptor);
......@@ -143,7 +143,7 @@ public class JavaDescriptorResolver {
}
return new TypeParameterDescriptor(
owner,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
Variance.INVARIANT,
typeParameter.getName(),
upperBounds,
......@@ -200,7 +200,7 @@ public class JavaDescriptorResolver {
private NamespaceDescriptor createJavaNamespaceDescriptor(PsiPackage psiPackage) {
NamespaceDescriptor namespaceDescriptor = new NamespaceDescriptor(
JAVA_ROOT,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
psiPackage.getName()
);
namespaceDescriptor.initialize(new JavaPackageScope(psiPackage.getQualifiedName(), namespaceDescriptor, semanticServices));
......@@ -211,7 +211,7 @@ public class JavaDescriptorResolver {
private NamespaceDescriptor createJavaNamespaceDescriptor(@NotNull final PsiClass psiClass) {
NamespaceDescriptor namespaceDescriptor = new NamespaceDescriptor(
JAVA_ROOT,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
psiClass.getName()
);
namespaceDescriptor.initialize(new JavaClassMembersScope(namespaceDescriptor, psiClass, semanticServices, true));
......@@ -227,7 +227,7 @@ public class JavaDescriptorResolver {
result.add(new ValueParameterDescriptorImpl(
containingDeclaration,
i,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
name == null ? "p" + i : name,
null, // TODO : review
semanticServices.getTypeTransformer().transformToType(parameter.getType()),
......@@ -253,7 +253,7 @@ public class JavaDescriptorResolver {
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(
JavaDescriptorResolver.JAVA_ROOT,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
methodName
);
functionDescriptor.initialize(
......
......@@ -69,7 +69,7 @@ public class JavaTypeTransformer {
PsiTypeParameter typeParameter = (PsiTypeParameter) psiClass;
TypeParameterDescriptor typeParameterDescriptor = resolver.resolveTypeParameter(typeParameter);
return new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
typeParameterDescriptor.getTypeConstructor(),
!TypeUtils.hasNullableBound(typeParameterDescriptor),
Collections.<TypeProjection>emptyList(),
......@@ -99,7 +99,7 @@ public class JavaTypeTransformer {
}
}
return new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
descriptor.getTypeConstructor(),
true,
arguments,
......
......@@ -6,5 +6,5 @@ import java.util.List;
* @author abreslav
*/
public interface Annotated {
List<Attribute> getAttributes();
List<Annotation> getAnnotations();
}
......@@ -6,14 +6,14 @@ import java.util.List;
* @author abreslav
*/
public abstract class AnnotatedImpl implements Annotated {
private final List<Attribute> attributes;
private final List<Annotation> annotations;
public AnnotatedImpl(List<Attribute> attributes) {
this.attributes = attributes;
public AnnotatedImpl(List<Annotation> annotations) {
this.annotations = annotations;
}
@Override
public List<Attribute> getAttributes() {
return attributes;
public List<Annotation> getAnnotations() {
return annotations;
}
}
......@@ -3,5 +3,5 @@ package org.jetbrains.jet.lang.types;
/**
* @author abreslav
*/
public interface Attribute {
public interface Annotation {
}
......@@ -21,9 +21,9 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
public ClassDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name) {
super(containingDeclaration, attributes, name);
super(containingDeclaration, annotations, name);
}
public final ClassDescriptorImpl initialize(boolean sealed,
......@@ -32,7 +32,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
@NotNull JetScope memberDeclarations,
@NotNull FunctionGroup constructors,
@Nullable ConstructorDescriptor primaryConstructor) {
this.typeConstructor = new TypeConstructorImpl(this, getAttributes(), sealed, getName(), typeParameters, superclasses);
this.typeConstructor = new TypeConstructorImpl(this, getAnnotations(), sealed, getName(), typeParameters, superclasses);
this.memberDeclarations = memberDeclarations;
this.constructors = constructors;
this.primaryConstructor = primaryConstructor;
......
......@@ -12,13 +12,13 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
private final boolean isPrimary;
public ConstructorDescriptorImpl(@NotNull ClassDescriptor containingDeclaration, @NotNull List<Attribute> attributes, boolean isPrimary) {
super(containingDeclaration, attributes, "<init>");
public ConstructorDescriptorImpl(@NotNull ClassDescriptor containingDeclaration, @NotNull List<Annotation> annotations, boolean isPrimary) {
super(containingDeclaration, annotations, "<init>");
this.isPrimary = isPrimary;
}
public ConstructorDescriptorImpl(@NotNull ConstructorDescriptor original, @NotNull List<Attribute> attributes, boolean isPrimary) {
super(original, attributes, "<init>");
public ConstructorDescriptorImpl(@NotNull ConstructorDescriptor original, @NotNull List<Annotation> annotations, boolean isPrimary) {
super(original, annotations, "<init>");
this.isPrimary = isPrimary;
}
......@@ -65,7 +65,7 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
protected FunctionDescriptorImpl createSubstitutedCopy() {
return new ConstructorDescriptorImpl(
this,
Collections.<Attribute>emptyList(), // TODO
Collections.<Annotation>emptyList(), // TODO
isPrimary);
}
}
......@@ -14,8 +14,8 @@ public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements
private final String name;
private final DeclarationDescriptor containingDeclaration;
public DeclarationDescriptorImpl(@Nullable DeclarationDescriptor containingDeclaration, List<Attribute> attributes, String name) {
super(attributes);
public DeclarationDescriptorImpl(@Nullable DeclarationDescriptor containingDeclaration, List<Annotation> annotations, String name) {
super(annotations);
this.name = name;
this.containingDeclaration = containingDeclaration;
}
......
......@@ -80,8 +80,8 @@ public class ErrorUtils {
}
};
private static final ClassDescriptorImpl ERROR_CLASS = new ClassDescriptorImpl(ERROR_MODULE, Collections.<Attribute>emptyList(), "<ERROR CLASS>");
private static final ConstructorDescriptor ERROR_CONSTRUCTOR = new ConstructorDescriptorImpl(ERROR_CLASS, Collections.<Attribute>emptyList(), true);
private static final ClassDescriptorImpl ERROR_CLASS = new ClassDescriptorImpl(ERROR_MODULE, Collections.<Annotation>emptyList(), "<ERROR CLASS>");
private static final ConstructorDescriptor ERROR_CONSTRUCTOR = new ConstructorDescriptorImpl(ERROR_CLASS, Collections.<Annotation>emptyList(), true);
static {
ERROR_CLASS.initialize(
true, Collections.<TypeParameterDescriptor>emptyList(), Collections.<JetType>emptyList(), getErrorScope(), ERROR_FUNCTION_GROUP, ERROR_CONSTRUCTOR);
......@@ -93,10 +93,10 @@ public class ErrorUtils {
private static final JetType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>");
private static final VariableDescriptor ERROR_PROPERTY = new PropertyDescriptor(
ERROR_CLASS, Collections.<Attribute>emptyList(), new MemberModifiers(false, false, false), true, "<ERROR PROPERTY>", ERROR_PROPERTY_TYPE, ERROR_PROPERTY_TYPE);
ERROR_CLASS, Collections.<Annotation>emptyList(), new MemberModifiers(false, false, false), true, "<ERROR PROPERTY>", ERROR_PROPERTY_TYPE, ERROR_PROPERTY_TYPE);
private static FunctionDescriptor createErrorFunction(List<TypeParameterDescriptor> typeParameters, List<JetType> positionedValueArgumentTypes) {
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(ERROR_CLASS, Collections.<Attribute>emptyList(), "<ERROR FUNCTION>");
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(ERROR_CLASS, Collections.<Annotation>emptyList(), "<ERROR FUNCTION>");
return functionDescriptor.initialize(
typeParameters,
getValueParameters(functionDescriptor, positionedValueArgumentTypes),
......@@ -109,7 +109,7 @@ public class ErrorUtils {
}
private static FunctionDescriptor createErrorFunction(int typeParameterCount, List<JetType> positionedValueParameterTypes) {
return new FunctionDescriptorImpl(ERROR_CLASS, Collections.<Attribute>emptyList(), "<ERROR FUNCTION>").initialize(
return new FunctionDescriptorImpl(ERROR_CLASS, Collections.<Annotation>emptyList(), "<ERROR FUNCTION>").initialize(
Collections.<TypeParameterDescriptor>emptyList(), // TODO
Collections.<ValueParameterDescriptor>emptyList(), // TODO
createErrorType("<ERROR FUNCTION RETURN TYPE>")
......@@ -123,7 +123,7 @@ public class ErrorUtils {
result.add(new ValueParameterDescriptorImpl(
functionDescriptor,
i,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"<ERROR PARAMETER>",
ERROR_PARAMETER_TYPE,
ERROR_PARAMETER_TYPE,
......@@ -138,7 +138,7 @@ public class ErrorUtils {
}
private static JetType createErrorType(String debugMessage, JetScope memberScope) {
return new ErrorTypeImpl(new TypeConstructorImpl(ERROR_CLASS, Collections.<Attribute>emptyList(), false, "[ERROR : " + debugMessage + "]", Collections.<TypeParameterDescriptor>emptyList(), Collections.<JetType>emptyList()), memberScope);
return new ErrorTypeImpl(new TypeConstructorImpl(ERROR_CLASS, Collections.<Annotation>emptyList(), false, "[ERROR : " + debugMessage + "]", Collections.<TypeParameterDescriptor>emptyList(), Collections.<JetType>emptyList()), memberScope);
}
public static JetType createWrongVarianceErrorType(TypeProjection value) {
......@@ -192,7 +192,7 @@ public class ErrorUtils {
}
@Override
public List<Attribute> getAttributes() {
public List<Annotation> getAnnotations() {
return Collections.emptyList();
}
......
......@@ -20,17 +20,17 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
public FunctionDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name) {
super(containingDeclaration, attributes, name);
super(containingDeclaration, annotations, name);
this.original = this;
}
public FunctionDescriptorImpl(
@NotNull FunctionDescriptor original,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name) {
super(original.getContainingDeclaration(), attributes, name);
super(original.getContainingDeclaration(), annotations, name);
this.original = original;
}
......@@ -108,7 +108,7 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
return new FunctionDescriptorImpl(
this,
// TODO : safeSubstitute
getAttributes(),
getAnnotations(),
getName());
}
......
......@@ -69,7 +69,7 @@ public class FunctionDescriptorUtil {
result.add(new ValueParameterDescriptorImpl(
substitutedDescriptor,
i,
unsubstitutedValueParameter.getAttributes(),
unsubstitutedValueParameter.getAnnotations(),
unsubstitutedValueParameter.getName(),
unsubstitutedValueParameter.getInType() == null ? null : substitutedType,
substitutedType,
......
......@@ -21,11 +21,11 @@ public class JetStandardClasses {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private static NamespaceDescriptor STANDARD_CLASSES_NAMESPACE = new NamespaceDescriptor(null, Collections.<Attribute>emptyList(), "jet");
private static NamespaceDescriptor STANDARD_CLASSES_NAMESPACE = new NamespaceDescriptor(null, Collections.<Annotation>emptyList(), "jet");
private static final ClassDescriptor NOTHING_CLASS = new ClassDescriptorImpl(
STANDARD_CLASSES_NAMESPACE,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"Nothing"
).initialize(
true,
......@@ -53,7 +53,7 @@ public class JetStandardClasses {
private static final JetType NOTHING_TYPE = new JetTypeImpl(getNothing());
private static final JetType NULLABLE_NOTHING_TYPE = new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
getNothing().getTypeConstructor(),
true,
Collections.<TypeProjection>emptyList(),
......@@ -63,7 +63,7 @@ public class JetStandardClasses {
private static final ClassDescriptor ANY = new ClassDescriptorImpl(
STANDARD_CLASSES_NAMESPACE,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"Any").initialize(
false,
Collections.<TypeParameterDescriptor>emptyList(),
......@@ -91,12 +91,12 @@ public class JetStandardClasses {
List<TypeParameterDescriptor> parameters = new ArrayList<TypeParameterDescriptor>();
ClassDescriptorImpl classDescriptor = new ClassDescriptorImpl(
STANDARD_CLASSES_NAMESPACE,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"Tuple" + i);
for (int j = 0; j < i; j++) {
parameters.add(new TypeParameterDescriptor(
classDescriptor,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
Variance.OUT_VARIANCE, "T" + j));
}
TUPLE[i] = classDescriptor.initialize(
......@@ -120,7 +120,7 @@ public class JetStandardClasses {
for (int i = 0; i < FUNCTION_COUNT; i++) {
ClassDescriptorImpl function = new ClassDescriptorImpl(
STANDARD_CLASSES_NAMESPACE,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"Function" + i);
FUNCTION[i] = function.initialize(
false,
......@@ -129,12 +129,12 @@ public class JetStandardClasses {
ClassDescriptorImpl receiverFunction = new ClassDescriptorImpl(
STANDARD_CLASSES_NAMESPACE,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
"ReceiverFunction" + i);
List<TypeParameterDescriptor> parameters = createTypeParameters(i, receiverFunction);
parameters.add(0, new TypeParameterDescriptor(
receiverFunction,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
Variance.IN_VARIANCE, "T"));
RECEIVER_FUNCTION[i] = receiverFunction.initialize(
false,
......@@ -148,12 +148,12 @@ public class JetStandardClasses {
for (int j = 0; j < parameterCount; j++) {
parameters.add(new TypeParameterDescriptor(
function,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
Variance.IN_VARIANCE, "P" + j));
}
parameters.add(new TypeParameterDescriptor(
function,
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
Variance.OUT_VARIANCE, "R"));
return parameters;
}
......@@ -258,29 +258,29 @@ public class JetStandardClasses {
type.getConstructor() == NOTHING_CLASS.getTypeConstructor();
}
public static JetType getTupleType(List<Attribute> attributes, List<JetType> arguments) {
if (attributes.isEmpty() && arguments.isEmpty()) {
public static JetType getTupleType(List<Annotation> annotations, List<JetType> arguments) {
if (annotations.isEmpty() && arguments.isEmpty()) {
return getUnitType();
}
return new JetTypeImpl(attributes, getTuple(arguments.size()).getTypeConstructor(), false, toProjections(arguments), STUB);
return new JetTypeImpl(annotations, getTuple(arguments.size()).getTypeConstructor(), false, toProjections(arguments), STUB);
}
public static JetType getTupleType(List<JetType> arguments) {
return getTupleType(Collections.<Attribute>emptyList(), arguments);
return getTupleType(Collections.<Annotation>emptyList(), arguments);
}
public static JetType getTupleType(JetType... arguments) {
return getTupleType(Collections.<Attribute>emptyList(), Arrays.asList(arguments));
return getTupleType(Collections.<Annotation>emptyList(), Arrays.asList(arguments));
}
public static JetType getLabeledTupleType(List<Attribute> attributes, List<ValueParameterDescriptor> arguments) {
public static JetType getLabeledTupleType(List<Annotation> annotations, List<ValueParameterDescriptor> arguments) {
// TODO
return getTupleType(attributes, toTypes(arguments));
return getTupleType(annotations, toTypes(arguments));
}
public static JetType getLabeledTupleType(List<ValueParameterDescriptor> arguments) {
// TODO
return getLabeledTupleType(Collections.<Attribute>emptyList(), arguments);
return getLabeledTupleType(Collections.<Annotation>emptyList(), arguments);
}
private static List<TypeProjection> toProjections(List<JetType> arguments) {
......@@ -300,7 +300,7 @@ public class JetStandardClasses {
}
// TODO : labeled version?
public static JetType getFunctionType(List<Attribute> attributes, @Nullable JetType receiverType, @NotNull List<JetType> parameterTypes, @NotNull JetType returnType) {
public static JetType getFunctionType(List<Annotation> annotations, @Nullable JetType receiverType, @NotNull List<JetType> parameterTypes, @NotNull JetType returnType) {
List<TypeProjection> arguments = new ArrayList<TypeProjection>();
if (receiverType != null) {
arguments.add(defaultProjection(receiverType));
......@@ -311,7 +311,7 @@ public class JetStandardClasses {
arguments.add(defaultProjection(returnType));
int size = parameterTypes.size();
TypeConstructor constructor = receiverType == null ? FUNCTION[size].getTypeConstructor() : RECEIVER_FUNCTION[size].getTypeConstructor();
return new JetTypeImpl(attributes, constructor, false, arguments, STUB);
return new JetTypeImpl(annotations, constructor, false, arguments, STUB);
}
private static TypeProjection defaultProjection(JetType returnType) {
......
......@@ -217,7 +217,7 @@ public class JetStandardLibrary {
public JetType getArrayType(@NotNull Variance variance, @NotNull JetType argument) {
List<TypeProjection> types = Collections.singletonList(new TypeProjection(variance, argument));
return new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
getArray().getTypeConstructor(),
false,
types,
......@@ -229,7 +229,7 @@ public class JetStandardLibrary {
public JetType getIterableType(@NotNull JetType argument) {
List<TypeProjection> types = Collections.singletonList(new TypeProjection(Variance.INVARIANT, argument));
return new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
getIterable().getTypeConstructor(),
false,
types,
......
......@@ -134,7 +134,7 @@ public class JetTypeChecker {
}
// TODO : attributes?
return new JetTypeImpl(Collections.<Attribute>emptyList(), constructor, nullable, newProjections, JetStandardClasses.STUB);
return new JetTypeImpl(Collections.<Annotation>emptyList(), constructor, nullable, newProjections, JetStandardClasses.STUB);
}
@NotNull
......
......@@ -17,8 +17,8 @@ public final class JetTypeImpl extends AnnotatedImpl implements JetType {
private final boolean nullable;
private JetScope memberScope;
public JetTypeImpl(List<Attribute> attributes, TypeConstructor constructor, boolean nullable, List<TypeProjection> arguments, JetScope memberScope) {
super(attributes);
public JetTypeImpl(List<Annotation> annotations, TypeConstructor constructor, boolean nullable, List<TypeProjection> arguments, JetScope memberScope) {
super(annotations);
this.constructor = constructor;
this.nullable = nullable;
this.arguments = arguments;
......@@ -26,11 +26,11 @@ public final class JetTypeImpl extends AnnotatedImpl implements JetType {
}
public JetTypeImpl(TypeConstructor constructor, JetScope memberScope) {
this(Collections.<Attribute>emptyList(), constructor, false, Collections.<TypeProjection>emptyList(), memberScope);
this(Collections.<Annotation>emptyList(), constructor, false, Collections.<TypeProjection>emptyList(), memberScope);
}
public JetTypeImpl(@NotNull ClassDescriptor classDescriptor) {
this(Collections.<Attribute>emptyList(),
this(Collections.<Annotation>emptyList(),
classDescriptor.getTypeConstructor(),
false,
Collections.<TypeProjection>emptyList(),
......
......@@ -684,7 +684,7 @@ public class JetTypeInferrer {
return;
}
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(scope.getContainingDeclaration(), Collections.<Attribute>emptyList(), "<anonymous>");
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(scope.getContainingDeclaration(), Collections.<Annotation>emptyList(), "<anonymous>");
JetTypeReference returnTypeRef = expression.getReturnTypeRef();
......@@ -721,7 +721,7 @@ public class JetTypeInferrer {
}
JetType effectiveReceiverType = receiverTypeRef == null ? null : receiverType;
JetType safeReturnType = returnType == null ? ErrorUtils.createErrorType("<return type>") : returnType;
result = JetStandardClasses.getFunctionType(Collections.<Attribute>emptyList(), effectiveReceiverType, parameterTypes, safeReturnType);
result = JetStandardClasses.getFunctionType(Collections.<Annotation>emptyList(), effectiveReceiverType, parameterTypes, safeReturnType);
}
@Override
......
......@@ -11,11 +11,11 @@ import java.util.List;
public class LocalVariableDescriptor extends VariableDescriptorImpl {
public LocalVariableDescriptor(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name,
@Nullable JetType type,
boolean mutable) {
super(containingDeclaration, attributes, name, mutable ? type : null, type);
super(containingDeclaration, annotations, name, mutable ? type : null, type);
}
@NotNull
......
......@@ -9,7 +9,7 @@ import java.util.Collections;
*/
public class ModuleDescriptor extends DeclarationDescriptorImpl {
public ModuleDescriptor(String name) {
super(null, Collections.<Attribute>emptyList(), name);
super(null, Collections.<Annotation>emptyList(), name);
}
@NotNull
......
......@@ -14,8 +14,8 @@ public class NamespaceDescriptor extends DeclarationDescriptorImpl {
private JetScope memberScope;
public NamespaceDescriptor(@Nullable DeclarationDescriptor containingDeclaration, @NotNull List<Attribute> attributes, @NotNull String name) {
super(containingDeclaration, attributes, name);
public NamespaceDescriptor(@Nullable DeclarationDescriptor containingDeclaration, @NotNull List<Annotation> annotations, @NotNull String name) {
super(containingDeclaration, annotations, name);
}
public void initialize(@NotNull JetScope memberScope) {
......
......@@ -51,7 +51,7 @@ public class NamespaceType implements JetType {
}
@Override
public List<Attribute> getAttributes() {
public List<Annotation> getAnnotations() {
throwException();
return null;
}
......
......@@ -12,8 +12,8 @@ public abstract class PropertyAccessorDescriptor extends DeclarationDescriptorIm
private final boolean hasBody;
protected PropertyAccessorDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Attribute> attributes, @NotNull String name, boolean hasBody) {
super(correspondingProperty.getContainingDeclaration(), attributes, name);
protected PropertyAccessorDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Annotation> annotations, @NotNull String name, boolean hasBody) {
super(correspondingProperty.getContainingDeclaration(), annotations, name);
this.hasBody = hasBody;
}
......
......@@ -17,13 +17,13 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Member
public PropertyDescriptor(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull MemberModifiers memberModifiers,
boolean isVar,
@NotNull String name,
@Nullable JetType inType,
@Nullable JetType outType) {
super(containingDeclaration, attributes, name, inType, outType);
super(containingDeclaration, annotations, name, inType, outType);
assert !isVar || inType != null;
assert outType != null;
this.isVar = isVar;
......@@ -36,7 +36,7 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Member
@Nullable JetType outType) {
this(
original.getContainingDeclaration(),
original.getAttributes(), // TODO : substitute?
original.getAnnotations(), // TODO : substitute?
original.getModifiers(),
original.isVar,
original.getName(),
......
......@@ -12,8 +12,8 @@ import java.util.List;
public class PropertyGetterDescriptor extends PropertyAccessorDescriptor implements MutableFunctionDescriptor {
private JetType returnType;
public PropertyGetterDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Attribute> attributes, @Nullable JetType returnType, boolean hasBody) {
super(correspondingProperty, attributes, "get-" + correspondingProperty.getName(), hasBody);
public PropertyGetterDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Annotation> annotations, @Nullable JetType returnType, boolean hasBody) {
super(correspondingProperty, annotations, "get-" + correspondingProperty.getName(), hasBody);
this.returnType = returnType == null ? correspondingProperty.getOutType() : returnType;
}
......
......@@ -12,8 +12,8 @@ public class PropertySetterDescriptor extends PropertyAccessorDescriptor impleme
private MutableValueParameterDescriptor parameter;
public PropertySetterDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Attribute> attributes, boolean hasBody) {
super(correspondingProperty, attributes, "set-" + correspondingProperty.getName(), hasBody);
public PropertySetterDescriptor(@NotNull PropertyDescriptor correspondingProperty, @NotNull List<Annotation> annotations, boolean hasBody) {
super(correspondingProperty, annotations, "set-" + correspondingProperty.getName(), hasBody);
}
public void initialize(@NotNull MutableValueParameterDescriptor parameter) {
......
......@@ -21,12 +21,12 @@ public class TypeConstructorImpl extends AnnotatedImpl implements TypeConstructo
public TypeConstructorImpl(
@Nullable DeclarationDescriptor declarationDescriptor,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
boolean sealed,
@NotNull String debugName,
@NotNull List<TypeParameterDescriptor> parameters,
@NotNull Collection<? extends JetType> supertypes) {
super(attributes);
super(annotations);
this.declarationDescriptor = declarationDescriptor;
this.sealed = sealed;
this.debugName = debugName;
......
......@@ -17,18 +17,18 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl implement
public TypeParameterDescriptor(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull Variance variance,
@NotNull String name,
@NotNull Set<JetType> upperBounds,
@NotNull JetType boundsAsType) {
super(containingDeclaration, attributes, name);
super(containingDeclaration, annotations, name);
this.variance = variance;
this.upperBounds = upperBounds;
// TODO: Should we actually pass the attributes on to the type constructor?
// TODO: Should we actually pass the annotations on to the type constructor?
this.typeConstructor = new TypeConstructorImpl(
this,
attributes,
annotations,
false,
"&" + name,
Collections.<TypeParameterDescriptor>emptyList(),
......@@ -38,12 +38,12 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl implement
public TypeParameterDescriptor(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull Variance variance,
@NotNull String name) {
this(
containingDeclaration,
attributes,
annotations,
variance,
name,
Collections.singleton(JetStandardClasses.getNullableAnyType()),
......
......@@ -94,7 +94,7 @@ public class TypeSubstitutor {
callSiteVariance));
}
return new JetTypeImpl(
subjectType.getAttributes(),
subjectType.getAnnotations(),
subjectType.getConstructor(),
subjectType.isNullable(),
newArguments,
......
......@@ -24,7 +24,7 @@ public class TypeUtils {
if (type.isNullable() == nullable) {
return type;
}
return new JetTypeImpl(type.getAttributes(), type.getConstructor(), nullable, type.getArguments(), type.getMemberScope());
return new JetTypeImpl(type.getAnnotations(), type.getConstructor(), nullable, type.getArguments(), type.getMemberScope());
}
@NotNull
......@@ -64,10 +64,10 @@ public class TypeUtils {
}
}
List<Attribute> noAttributes = Collections.<Attribute>emptyList();
TypeConstructor constructor = new TypeConstructorImpl(null, noAttributes, false, debugName.toString(), Collections.<TypeParameterDescriptor>emptyList(), types);
List<Annotation> noAnnotations = Collections.<Annotation>emptyList();
TypeConstructor constructor = new TypeConstructorImpl(null, noAnnotations, false, debugName.toString(), Collections.<TypeParameterDescriptor>emptyList(), types);
return new JetTypeImpl(
noAttributes,
noAnnotations,
constructor,
nullable,
Collections.<TypeProjection>emptyList(),
......@@ -159,7 +159,7 @@ public class TypeUtils {
public static JetType makeUnsubstitutedType(ClassDescriptor classDescriptor, JetScope unsubstitutedMemberScope) {
List<TypeProjection> arguments = getArguments(classDescriptor);
return new JetTypeImpl(
Collections.<Attribute>emptyList(),
Collections.<Annotation>emptyList(),
classDescriptor.getTypeConstructor(),
false,
arguments,
......
......@@ -17,13 +17,13 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
public ValueParameterDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name,
@Nullable JetType inType,
@NotNull JetType outType,
boolean hasDefaultValue,
boolean isVararg) {
super(containingDeclaration, attributes, name, inType, outType);
super(containingDeclaration, annotations, name, inType, outType);
this.index = index;
this.hasDefaultValue = hasDefaultValue;
this.isVararg = isVararg;
......@@ -33,12 +33,12 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
public ValueParameterDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name,
boolean isVar,
boolean hasDefaultValue,
boolean isVararg) {
super(containingDeclaration, attributes, name, null, null);
super(containingDeclaration, annotations, name, null, null);
this.index = index;
this.hasDefaultValue = hasDefaultValue;
this.isVararg = isVararg;
......
......@@ -14,11 +14,11 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl i
public VariableDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull List<Attribute> attributes,
@NotNull List<Annotation> annotations,
@NotNull String name,
@Nullable JetType inType,
@Nullable JetType outType) {
super(containingDeclaration, attributes, name);
super(containingDeclaration, annotations, name);
assert (inType != null) || (outType != null);
this.inType = inType;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册