From 6dde064791ae914d13bd63942c1986809f1f6386 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 27 Sep 2013 18:31:36 -0700 Subject: [PATCH] Collections in interfaces marked @ReadOnly --- .idea/libraries/kotlin_annotations_ext.xml | 9 +++++++++ build.xml | 3 +++ core/descriptors/descriptors.iml | 1 + .../jetbrains/jet/lang/descriptors/ClassDescriptor.java | 2 ++ .../jet/lang/descriptors/annotations/Annotated.java | 3 +++ .../impl/AbstractLazyTypeParameterDescriptor.java | 2 ++ .../org/jetbrains/jet/lang/resolve/scopes/JetScope.java | 8 ++++++++ .../src/org/jetbrains/jet/lang/types/JetType.java | 5 ++++- .../org/jetbrains/jet/lang/types/TypeConstructor.java | 3 +++ 9 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .idea/libraries/kotlin_annotations_ext.xml diff --git a/.idea/libraries/kotlin_annotations_ext.xml b/.idea/libraries/kotlin_annotations_ext.xml new file mode 100644 index 00000000000..5d04b2a1c30 --- /dev/null +++ b/.idea/libraries/kotlin_annotations_ext.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/build.xml b/build.xml index cc2e2688e24..5a7146685ff 100644 --- a/build.xml +++ b/build.xml @@ -12,6 +12,7 @@ + @@ -28,6 +29,7 @@ + @@ -375,6 +377,7 @@ -libraryjars '${rtjar}' -libraryjars '${bootstrap.runtime}' + -libraryjars '${bootstrap.annotations.ext}' -target 1.6 -dontoptimize diff --git a/core/descriptors/descriptors.iml b/core/descriptors/descriptors.iml index bbd44fe9e51..5b73f2110a0 100644 --- a/core/descriptors/descriptors.iml +++ b/core/descriptors/descriptors.iml @@ -10,6 +10,7 @@ + diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java index 1aee6cdb6a2..ff2e14dcaf4 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.descriptors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeProjection; @@ -35,6 +36,7 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor, JetScope getUnsubstitutedInnerClassesScope(); @NotNull + @ReadOnly Collection getConstructors(); @Override diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/annotations/Annotated.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/annotations/Annotated.java index 7c1bcc6da88..cabbf3c9f3b 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/annotations/Annotated.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/annotations/Annotated.java @@ -16,8 +16,11 @@ package org.jetbrains.jet.lang.descriptors.annotations; +import org.jetbrains.annotations.ReadOnly; + import java.util.List; public interface Annotated { + @ReadOnly List getAnnotations(); } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/AbstractLazyTypeParameterDescriptor.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/AbstractLazyTypeParameterDescriptor.java index bc362bd2732..f08ef908ec1 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/AbstractLazyTypeParameterDescriptor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/AbstractLazyTypeParameterDescriptor.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.descriptors.impl; import jet.Function0; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor; @@ -109,6 +110,7 @@ public abstract class AbstractLazyTypeParameterDescriptor implements TypeParamet } @NotNull + @ReadOnly protected abstract Set resolveUpperBounds(); @NotNull diff --git a/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/JetScope.java b/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/JetScope.java index 31e4d09af99..bbc6064cf3f 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/JetScope.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/JetScope.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.resolve.scopes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.resolve.name.LabelName; import org.jetbrains.jet.lang.resolve.name.Name; @@ -49,24 +50,28 @@ public interface JetScope { ClassDescriptor getObjectDescriptor(@NotNull Name name); @NotNull + @ReadOnly Collection getObjectDescriptors(); @Nullable NamespaceDescriptor getNamespace(@NotNull Name name); @NotNull + @ReadOnly Collection getProperties(@NotNull Name name); @Nullable VariableDescriptor getLocalVariable(@NotNull Name name); @NotNull + @ReadOnly Collection getFunctions(@NotNull Name name); @NotNull DeclarationDescriptor getContainingDeclaration(); @NotNull + @ReadOnly Collection getDeclarationsByLabel(@NotNull LabelName labelName); /** @@ -75,14 +80,17 @@ public interface JetScope { * @return All visible descriptors from current scope. */ @NotNull + @ReadOnly Collection getAllDescriptors(); /** * Adds receivers to the list in order of locality, so that the closest (the most local) receiver goes first */ @NotNull + @ReadOnly List getImplicitReceiversHierarchy(); @NotNull + @ReadOnly Collection getOwnDeclaredDescriptors(); } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java b/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java index fd56e2375e2..2b7f96b1196 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java @@ -17,6 +17,7 @@ package org.jetbrains.jet.lang.types; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.descriptors.annotations.Annotated; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.types.checker.JetTypeChecker; @@ -29,7 +30,9 @@ import java.util.List; public interface JetType extends Annotated { @NotNull TypeConstructor getConstructor(); - @NotNull List getArguments(); + @NotNull + @ReadOnly + List getArguments(); boolean isNullable(); diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeConstructor.java b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeConstructor.java index 8615b11164b..9abb487aaf7 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeConstructor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeConstructor.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.types; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor; import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.Annotated; @@ -27,9 +28,11 @@ import java.util.List; public interface TypeConstructor extends Annotated { @NotNull + @ReadOnly List getParameters(); @NotNull + @ReadOnly Collection getSupertypes(); /**