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

Renamed Attribute into Annotation

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