Annotations used instead of List<AnnotationDescriptor>
This commit is contained in:
+2
-4
@@ -18,16 +18,14 @@ package org.jetbrains.jet.lang.resolve.java.descriptor;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implements JavaCallableMemberDescriptor {
|
||||
public JavaMethodDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Name name
|
||||
) {
|
||||
super(containingDeclaration, annotations, name, Kind.DECLARATION);
|
||||
|
||||
+2
-4
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.DeclarationDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaPackageFragmentProvider;
|
||||
@@ -31,8 +31,6 @@ import org.jetbrains.jet.lang.resolve.java.scope.JavaPackageFragmentScope;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class JavaPackageFragmentDescriptorImpl extends DeclarationDescriptorImpl implements JavaPackageFragmentDescriptor {
|
||||
@Nullable
|
||||
public static JavaPackageFragmentDescriptorImpl create(
|
||||
@@ -54,7 +52,7 @@ public class JavaPackageFragmentDescriptorImpl extends DeclarationDescriptorImpl
|
||||
@NotNull FqName fqName,
|
||||
@NotNull NullableFunction<JavaPackageFragmentDescriptor, JavaPackageFragmentScope> scopeFactory
|
||||
) {
|
||||
super(Collections.<AnnotationDescriptor>emptyList(), fqName.shortNameOrSpecial());
|
||||
super(Annotations.EMPTY, fqName.shortNameOrSpecial());
|
||||
this.provider = provider;
|
||||
this.fqName = fqName;
|
||||
this.memberScope = scopeFactory.fun(this);
|
||||
|
||||
+2
-4
@@ -20,16 +20,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.Modality;
|
||||
import org.jetbrains.jet.lang.descriptors.Visibility;
|
||||
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.resolve.name.Name;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements JavaCallableMemberDescriptor {
|
||||
public JavaPropertyDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Visibility visibility,
|
||||
boolean isVar,
|
||||
@NotNull Name name
|
||||
|
||||
+7
-5
@@ -17,14 +17,16 @@
|
||||
package org.jetbrains.jet.lang.resolve.java.lazy
|
||||
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotation
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaAnnotationDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotationOwner
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationsImpl
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaAnnotationDescriptor
|
||||
|
||||
fun LazyJavaResolverContextWithTypes.resolveAnnotations(javaAnnotations: Collection<JavaAnnotation>): List<AnnotationDescriptor>
|
||||
= javaAnnotations.flatMap {
|
||||
fun LazyJavaResolverContextWithTypes.resolveAnnotations(javaAnnotations: Collection<JavaAnnotation>): Annotations
|
||||
= AnnotationsImpl(javaAnnotations.flatMap {
|
||||
jAnnotation ->
|
||||
// TODO: we resolve all annotations, which slightly compromises our laziness
|
||||
val fqName = jAnnotation.getFqName()
|
||||
@@ -32,7 +34,7 @@ fun LazyJavaResolverContextWithTypes.resolveAnnotations(javaAnnotations: Collect
|
||||
listOf<AnnotationDescriptor>()
|
||||
}
|
||||
else listOf(LazyJavaAnnotationDescriptor(this, jAnnotation))
|
||||
}
|
||||
})
|
||||
|
||||
private fun GlobalJavaResolverContext.hasAnnotation(owner: JavaAnnotationOwner, annotationFqName: FqName): Boolean
|
||||
= owner.findAnnotation(annotationFqName) != null || externalAnnotationResolver.findExternalAnnotation(owner, annotationFqName) != null
|
||||
|
||||
+3
-4
@@ -9,12 +9,10 @@ import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.jet.lang.types.JetType
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
||||
import org.jetbrains.jet.lang.types.TypeConstructor
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor
|
||||
import java.util.Collections
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContextWithTypes
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorFactory
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.child
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.resolveAnnotations
|
||||
@@ -33,6 +31,7 @@ import org.jetbrains.jet.lang.descriptors.Modality
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl
|
||||
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
|
||||
class LazyJavaClassDescriptor(
|
||||
private val outerC: LazyJavaResolverContextWithTypes,
|
||||
@@ -95,7 +94,7 @@ class LazyJavaClassDescriptor(
|
||||
override fun getConstructors() = _scopeForMemberLookup._constructors()
|
||||
|
||||
private val _annotations = c.storageManager.createLazyValue { c.resolveAnnotations(jClass.getAnnotations()) }
|
||||
override fun getAnnotations(): List<AnnotationDescriptor> = _annotations()
|
||||
override fun getAnnotations() = _annotations()
|
||||
|
||||
private val _functionTypeForSamInterface = c.storageManager.createNullableLazyValue {
|
||||
val samInterfaceMethod = SingleAbstractMethodUtils.getSamInterfaceMethod(jClass);
|
||||
@@ -160,7 +159,7 @@ class LazyJavaClassDescriptor(
|
||||
|
||||
override fun getSupertypes(): Collection<JetType> = _supertypes()
|
||||
|
||||
override fun getAnnotations() = Collections.emptyList<AnnotationDescriptor>()
|
||||
override fun getAnnotations() = Annotations.EMPTY
|
||||
|
||||
override fun isFinal() = !getModality().isOverridable()
|
||||
|
||||
|
||||
+4
-3
@@ -33,6 +33,7 @@ import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
||||
import org.jetbrains.jet.lang.descriptors.impl.EnumEntrySyntheticClassDescriptor
|
||||
import org.jetbrains.jet.lang.types.TypeUtils
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
|
||||
public class LazyJavaClassMemberScope(
|
||||
c: LazyJavaResolverContextWithTypes,
|
||||
@@ -65,7 +66,7 @@ public class LazyJavaClassMemberScope(
|
||||
}
|
||||
|
||||
private fun resolveConstructor(constructor: JavaMethod, classDescriptor: ClassDescriptor, isStaticClass: Boolean): ConstructorDescriptor {
|
||||
val constructorDescriptor = ConstructorDescriptorImpl(classDescriptor, Collections.emptyList(), isPrimary = false)
|
||||
val constructorDescriptor = ConstructorDescriptorImpl(classDescriptor, Annotations.EMPTY, isPrimary = false)
|
||||
|
||||
val valueParameters = resolveValueParameters(c, constructorDescriptor, constructor.getValueParameters())
|
||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
@@ -96,7 +97,7 @@ public class LazyJavaClassMemberScope(
|
||||
return null
|
||||
|
||||
val classDescriptor = getContainingDeclaration()
|
||||
val constructorDescriptor = ConstructorDescriptorImpl(classDescriptor, Collections.emptyList(), isPrimary = true)
|
||||
val constructorDescriptor = ConstructorDescriptorImpl(classDescriptor, Annotations.EMPTY, isPrimary = true)
|
||||
val typeParameters = classDescriptor.getTypeConstructor().getParameters()
|
||||
val valueParameters = if (isAnnotation) createAnnotationConstructorParameters(constructorDescriptor)
|
||||
else Collections.emptyList<ValueParameterDescriptor>()
|
||||
@@ -130,7 +131,7 @@ public class LazyJavaClassMemberScope(
|
||||
result.add(ValueParameterDescriptorImpl(
|
||||
constructor,
|
||||
index,
|
||||
Collections.emptyList(),
|
||||
Annotations.EMPTY,
|
||||
method.getName(),
|
||||
// Parameters of annotation constructors in Java are never nullable
|
||||
TypeUtils.makeNotNullable(returnType),
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor
|
||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaPackageFragmentDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver
|
||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentProvider
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
|
||||
fun LazyPackageFragmentForJavaPackage(
|
||||
c: LazyJavaResolverContext,
|
||||
@@ -37,7 +38,7 @@ class LazyJavaPackageFragment(
|
||||
val _kind: JavaPackageFragmentDescriptor.Kind,
|
||||
val _fqName: FqName,
|
||||
createMemberScope: LazyJavaPackageFragment.() -> LazyJavaPackageFragmentScope
|
||||
) : DeclarationDescriptorNonRootImpl(containingDeclaration, listOf(), _fqName.shortNameOrSpecial()),
|
||||
) : DeclarationDescriptorNonRootImpl(containingDeclaration, Annotations.EMPTY, _fqName.shortNameOrSpecial()),
|
||||
JavaPackageFragmentDescriptor, LazyJavaDescriptor
|
||||
{
|
||||
private val _memberScope = createMemberScope()
|
||||
|
||||
+2
-2
@@ -19,12 +19,12 @@ package org.jetbrains.jet.lang.resolve.java.lazy.types
|
||||
import org.jetbrains.jet.storage.StorageManager
|
||||
import org.jetbrains.jet.lang.types.TypeConstructor
|
||||
import org.jetbrains.jet.lang.types.TypeProjection
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||
import org.jetbrains.jet.lang.types.AbstractJetType
|
||||
import org.jetbrains.jet.lang.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.util.inn
|
||||
import org.jetbrains.jet.lang.types.LazyType
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
|
||||
abstract class LazyJavaType(storageManager: StorageManager) : AbstractJetType(), LazyType {
|
||||
|
||||
@@ -47,7 +47,7 @@ abstract class LazyJavaType(storageManager: StorageManager) : AbstractJetType(),
|
||||
|
||||
override fun isError()= getConstructor().getDeclarationDescriptor().inn({ d -> ErrorUtils.isError(d)}, false)
|
||||
|
||||
override fun getAnnotations(): List<AnnotationDescriptor> = listOf()
|
||||
override fun getAnnotations() = Annotations.EMPTY
|
||||
|
||||
override fun toString(): String? {
|
||||
if (!_typeConstructor.isComputed()) {
|
||||
|
||||
+6
-4
@@ -22,6 +22,8 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationsImpl;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap;
|
||||
@@ -82,17 +84,17 @@ public final class JavaAnnotationResolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<AnnotationDescriptor> resolveAnnotations(@NotNull JavaAnnotationOwner owner, @NotNull PostponedTasks tasks) {
|
||||
public Annotations resolveAnnotations(@NotNull JavaAnnotationOwner owner, @NotNull PostponedTasks tasks) {
|
||||
List<AnnotationDescriptor> result = new ArrayList<AnnotationDescriptor>();
|
||||
resolveAnnotations(owner.getAnnotations(), tasks, result);
|
||||
resolveAnnotations(externalAnnotationResolver.findExternalAnnotations(owner), tasks, result);
|
||||
return result;
|
||||
return new AnnotationsImpl(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<AnnotationDescriptor> resolveAnnotations(@NotNull JavaAnnotationOwner owner) {
|
||||
public Annotations resolveAnnotations(@NotNull JavaAnnotationOwner owner) {
|
||||
PostponedTasks postponedTasks = new PostponedTasks();
|
||||
List<AnnotationDescriptor> annotations = resolveAnnotations(owner, postponedTasks);
|
||||
Annotations annotations = resolveAnnotations(owner, postponedTasks);
|
||||
postponedTasks.performTasks();
|
||||
return annotations;
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ package org.jetbrains.jet.lang.resolve.java.resolver;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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.ConstructorDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaVisibilities;
|
||||
@@ -108,7 +108,7 @@ public final class JavaConstructorResolver {
|
||||
|
||||
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(
|
||||
containingClass,
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
Annotations.EMPTY,
|
||||
true);
|
||||
|
||||
List<TypeParameterDescriptor> typeParameters = containingClass.getTypeConstructor().getParameters();
|
||||
@@ -158,7 +158,7 @@ public final class JavaConstructorResolver {
|
||||
result.add(new ValueParameterDescriptorImpl(
|
||||
constructorDescriptor,
|
||||
index,
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
Annotations.EMPTY,
|
||||
method.getName(),
|
||||
// Parameters of annotation constructors in Java are never nullable
|
||||
TypeUtils.makeNotNullable(typeTransformer.transformToType(returnType, typeVariableResolver)),
|
||||
@@ -193,7 +193,7 @@ public final class JavaConstructorResolver {
|
||||
|
||||
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(
|
||||
classDescriptor,
|
||||
Collections.<AnnotationDescriptor>emptyList(), // TODO
|
||||
Annotations.EMPTY, // TODO
|
||||
false);
|
||||
|
||||
List<TypeParameterDescriptor> typeParameters = classDescriptor.getTypeConstructor().getParameters();
|
||||
|
||||
+6
-3
@@ -19,7 +19,7 @@ package org.jetbrains.jet.lang.resolve.java.resolver;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClassifierType;
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaTypeParameter;
|
||||
@@ -28,7 +28,10 @@ import org.jetbrains.jet.lang.types.Variance;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public final class JavaTypeParameterResolver {
|
||||
@NotNull
|
||||
@@ -63,7 +66,7 @@ public final class JavaTypeParameterResolver {
|
||||
private void addTypeParameter(@NotNull JavaTypeParameter typeParameter) {
|
||||
TypeParameterDescriptorImpl descriptor = TypeParameterDescriptorImpl.createForFurtherModification(
|
||||
owner,
|
||||
Collections.<AnnotationDescriptor>emptyList(), // TODO
|
||||
Annotations.EMPTY, // TODO
|
||||
false,
|
||||
Variance.INVARIANT,
|
||||
typeParameter.getName(),
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap;
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
@@ -212,7 +212,7 @@ public class JavaTypeTransformer {
|
||||
}
|
||||
|
||||
return new JetTypeImpl(
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
Annotations.EMPTY,
|
||||
classData.getTypeConstructor(),
|
||||
nullable,
|
||||
arguments,
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ package org.jetbrains.jet.lang.resolve.java.sam;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor;
|
||||
@@ -113,7 +113,7 @@ public class SingleAbstractMethodUtils {
|
||||
parameterTypes.add(parameter.getType());
|
||||
}
|
||||
return KotlinBuiltIns.getInstance().getFunctionType(
|
||||
Collections.<AnnotationDescriptor>emptyList(), null, parameterTypes, returnType);
|
||||
Annotations.EMPTY, null, parameterTypes, returnType);
|
||||
}
|
||||
|
||||
private static boolean isSamInterface(@NotNull ClassDescriptor klass) {
|
||||
@@ -148,7 +148,7 @@ public class SingleAbstractMethodUtils {
|
||||
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
||||
", substitutor = " + typeParameters.substitutor;
|
||||
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
|
||||
result, 0, Collections.<AnnotationDescriptor>emptyList(), Name.identifier("function"), parameterType, false, null);
|
||||
result, 0, Annotations.EMPTY, Name.identifier("function"), parameterType, false, null);
|
||||
|
||||
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
|
||||
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
|
||||
|
||||
+15
-13
@@ -26,6 +26,8 @@ import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeseria
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationsImpl;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.EnumValue;
|
||||
@@ -96,20 +98,20 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<AnnotationDescriptor> loadClassAnnotations(@NotNull ClassDescriptor descriptor, @NotNull ProtoBuf.Class classProto) {
|
||||
public Annotations loadClassAnnotations(@NotNull ClassDescriptor descriptor, @NotNull ProtoBuf.Class classProto) {
|
||||
KotlinJvmBinaryClass kotlinClass = findKotlinClassByDescriptor(descriptor);
|
||||
if (kotlinClass == null) {
|
||||
// This means that the resource we're constructing the descriptor from is no longer present: KotlinClassFinder had found the
|
||||
// class earlier, but it can't now
|
||||
errorReporter.reportAnnotationLoadingError("Kotlin class for loading class annotations is not found: " + descriptor, null);
|
||||
return Collections.emptyList();
|
||||
return Annotations.EMPTY;
|
||||
}
|
||||
try {
|
||||
return loadClassAnnotationsFromClass(kotlinClass);
|
||||
}
|
||||
catch (IOException e) {
|
||||
errorReporter.reportAnnotationLoadingError("Error loading member annotations from Kotlin class: " + kotlinClass, e);
|
||||
return Collections.emptyList();
|
||||
return Annotations.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +130,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<AnnotationDescriptor> loadClassAnnotationsFromClass(@NotNull KotlinJvmBinaryClass kotlinClass) throws IOException {
|
||||
private Annotations loadClassAnnotationsFromClass(@NotNull KotlinJvmBinaryClass kotlinClass) throws IOException {
|
||||
final List<AnnotationDescriptor> result = new ArrayList<AnnotationDescriptor>();
|
||||
|
||||
kotlinClass.loadClassAnnotations(new KotlinJvmBinaryClass.AnnotationVisitor() {
|
||||
@@ -143,7 +145,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
return new AnnotationsImpl(result);
|
||||
}
|
||||
|
||||
private static boolean ignoreAnnotation(@NotNull JvmClassName className) {
|
||||
@@ -221,20 +223,20 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<AnnotationDescriptor> loadCallableAnnotations(
|
||||
public Annotations loadCallableAnnotations(
|
||||
@NotNull ClassOrPackageFragmentDescriptor container,
|
||||
@NotNull ProtoBuf.Callable proto,
|
||||
@NotNull NameResolver nameResolver,
|
||||
@NotNull AnnotatedCallableKind kind
|
||||
) {
|
||||
MemberSignature signature = getCallableSignature(proto, nameResolver, kind);
|
||||
if (signature == null) return Collections.emptyList();
|
||||
if (signature == null) return Annotations.EMPTY;
|
||||
|
||||
return findClassAndLoadMemberAnnotations(container, proto, nameResolver, kind, signature);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<AnnotationDescriptor> findClassAndLoadMemberAnnotations(
|
||||
private Annotations findClassAndLoadMemberAnnotations(
|
||||
@NotNull ClassOrPackageFragmentDescriptor container,
|
||||
@NotNull ProtoBuf.Callable proto,
|
||||
@NotNull NameResolver nameResolver,
|
||||
@@ -244,11 +246,11 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
KotlinJvmBinaryClass kotlinClass = findClassWithMemberAnnotations(container, proto, nameResolver, kind);
|
||||
if (kotlinClass == null) {
|
||||
errorReporter.reportAnnotationLoadingError("Kotlin class for loading member annotations is not found: " + container, null);
|
||||
return Collections.emptyList();
|
||||
return Annotations.EMPTY;
|
||||
}
|
||||
|
||||
List<AnnotationDescriptor> annotations = memberAnnotations.invoke(kotlinClass).get(signature);
|
||||
return annotations == null ? Collections.<AnnotationDescriptor>emptyList() : annotations;
|
||||
Annotations annotations = new AnnotationsImpl(memberAnnotations.invoke(kotlinClass).get(signature));
|
||||
return annotations == null ? Annotations.EMPTY : annotations;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -500,7 +502,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<AnnotationDescriptor> loadValueParameterAnnotations(
|
||||
public Annotations loadValueParameterAnnotations(
|
||||
@NotNull ClassOrPackageFragmentDescriptor container,
|
||||
@NotNull ProtoBuf.Callable callable,
|
||||
@NotNull NameResolver nameResolver,
|
||||
@@ -516,6 +518,6 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
return Annotations.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user