diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/AccessorForPropertyDescriptor.java b/compiler/backend/src/org/jetbrains/jet/codegen/AccessorForPropertyDescriptor.java index ac6d40c8c45..21d2a33011d 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/AccessorForPropertyDescriptor.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/AccessorForPropertyDescriptor.java @@ -43,7 +43,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl { @NotNull DeclarationDescriptor containingDeclaration, int index ) { - super(containingDeclaration, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL, + super(null, containingDeclaration, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL, original.isVar(), Name.identifier(original.getName() + "$b$" + index), Kind.DECLARATION); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index 47b57cff004..6137454bd2e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -821,7 +821,7 @@ public class DescriptorResolver { ) { DeclarationDescriptor containingDeclaration = scope.getContainingDeclaration(); if (JetPsiUtil.isScriptDeclaration(variable)) { - PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl( + PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create( containingDeclaration, annotationResolver.resolveAnnotationsWithArguments(scope, variable.getModifierList(), trace), Modality.FINAL, @@ -883,7 +883,7 @@ public class DescriptorResolver { ? resolveModalityFromModifiers(property, getDefaultModality(containingDeclaration, hasBody)) : Modality.FINAL; Visibility visibility = resolveVisibilityFromModifiers(property, getDefaultVisibility(property, containingDeclaration)); - PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl( + PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create( containingDeclaration, annotationResolver.resolveAnnotationsWithoutArguments(scope, modifierList, trace), modality, @@ -1287,7 +1287,7 @@ public class DescriptorResolver { } } - PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl( + PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create( classDescriptor, valueParameter.getAnnotations(), resolveModalityFromModifiers(parameter, Modality.FINAL), diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/descriptor/JavaPropertyDescriptor.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/descriptor/JavaPropertyDescriptor.java index 81c3a25fb5c..5c0fbc4b95b 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/descriptor/JavaPropertyDescriptor.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/descriptor/JavaPropertyDescriptor.java @@ -32,6 +32,6 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja boolean isVar, @NotNull Name name ) { - super(containingDeclaration, annotations, Modality.FINAL, visibility, isVar, name, Kind.DECLARATION); + super(null, containingDeclaration, annotations, Modality.FINAL, visibility, isVar, name, Kind.DECLARATION); } } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ScriptDescriptor.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ScriptDescriptor.java index 43d386be3fc..1c036910e12 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ScriptDescriptor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ScriptDescriptor.java @@ -80,13 +80,13 @@ public class ScriptDescriptor extends DeclarationDescriptorNonRootImpl { this.returnType = returnType; scriptCodeDescriptor.initialize(implicitReceiver, valueParameters, returnType); - PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl(classDescriptor, - Annotations.EMPTY, - Modality.FINAL, - Visibilities.PUBLIC, - false, - Name.identifier(LAST_EXPRESSION_VALUE_FIELD_NAME), - CallableMemberDescriptor.Kind.DECLARATION); + PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create(classDescriptor, + Annotations.EMPTY, + Modality.FINAL, + Visibilities.PUBLIC, + false, + Name.identifier(LAST_EXPRESSION_VALUE_FIELD_NAME), + CallableMemberDescriptor.Kind.DECLARATION); propertyDescriptor.setType( returnType, Collections.emptyList(), @@ -164,13 +164,13 @@ public class ScriptDescriptor extends DeclarationDescriptorNonRootImpl { classDescriptor.setPrimaryConstructor(constructorDescriptor); for (ValueParameterDescriptor parameter : valueParameters) { - PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl(classDescriptor, - Annotations.EMPTY, - Modality.FINAL, - Visibilities.PUBLIC, - false, - parameter.getName(), - CallableMemberDescriptor.Kind.DECLARATION); + PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create(classDescriptor, + Annotations.EMPTY, + Modality.FINAL, + Visibilities.PUBLIC, + false, + parameter.getName(), + CallableMemberDescriptor.Kind.DECLARATION); propertyDescriptor.setType( parameter.getType(), Collections.emptyList(), diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/PropertyDescriptorImpl.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/PropertyDescriptorImpl.java index 9299e016454..83d41923a58 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/PropertyDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/PropertyDescriptorImpl.java @@ -70,7 +70,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr this.kind = kind; } - public PropertyDescriptorImpl( + public static PropertyDescriptorImpl create( @NotNull DeclarationDescriptor containingDeclaration, @NotNull Annotations annotations, @NotNull Modality modality, @@ -79,23 +79,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr @NotNull Name name, @NotNull Kind kind ) { - this(null, containingDeclaration, annotations, modality, visibility, isVar, name, kind); - } - - public PropertyDescriptorImpl( - @NotNull DeclarationDescriptor containingDeclaration, - @NotNull Annotations annotations, - @NotNull Modality modality, - @NotNull Visibility visibility, - boolean isVar, - @Nullable JetType receiverType, - @Nullable ReceiverParameterDescriptor expectedThisObject, - @NotNull Name name, - @NotNull JetType outType, - @NotNull Kind kind - ) { - this(containingDeclaration, annotations, modality, visibility, isVar, name, kind); - setType(outType, Collections.emptyList(), expectedThisObject, receiverType); + return new PropertyDescriptorImpl(null, containingDeclaration, annotations, modality, visibility, isVar, name, kind); } public void setType( diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/ErrorUtils.java b/core/descriptors/src/org/jetbrains/jet/lang/types/ErrorUtils.java index 7dab43cffb4..d8c5baaa148 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/ErrorUtils.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/ErrorUtils.java @@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.PlatformToKotlinClassMap; import org.jetbrains.jet.lang.descriptors.*; -import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.Annotations; import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl; import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl; @@ -243,19 +242,30 @@ public class ErrorUtils { } private static final JetType ERROR_PROPERTY_TYPE = createErrorType(""); - private static final VariableDescriptor ERROR_PROPERTY = new PropertyDescriptorImpl( - ERROR_CLASS, - Annotations.EMPTY, - Modality.OPEN, - Visibilities.INTERNAL, - true, - null, - ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER, - Name.special(""), - ERROR_PROPERTY_TYPE, - CallableMemberDescriptor.Kind.DECLARATION); + private static final VariableDescriptor ERROR_PROPERTY = createErrorProperty(); + private static final Set ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY); + @NotNull + private static PropertyDescriptorImpl createErrorProperty() { + PropertyDescriptorImpl descriptor = PropertyDescriptorImpl.create( + ERROR_CLASS, + Annotations.EMPTY, + Modality.OPEN, + Visibilities.INTERNAL, + true, + Name.special(""), + CallableMemberDescriptor.Kind.DECLARATION + ); + descriptor.setType(ERROR_PROPERTY_TYPE, + Collections.emptyList(), + ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER, + (JetType) null + ); + + return descriptor; + } + @NotNull private static SimpleFunctionDescriptor createErrorFunction(@NotNull ErrorScope ownerScope) { ErrorSimpleFunctionDescriptorImpl function = new ErrorSimpleFunctionDescriptorImpl(ownerScope);