Don't fail on annotated built-ins

Unit.VALUE is annotated right now (with "suppress"), so deserialization was
throwing an exception from AnnotationDeserializer.UNSUPPORTED. Return empty
collections of annotations instead; here we use the fact that it's the only
annotation in built-ins and its presence is useless to the type checker
This commit is contained in:
Alexander Udalov
2014-01-16 23:29:55 +04:00
parent 61ad9fba4a
commit 5cae5c0338
2 changed files with 37 additions and 5 deletions
@@ -60,6 +60,37 @@ public interface AnnotationDeserializer {
}
};
AnnotationDeserializer EMPTY = new AnnotationDeserializer() {
@NotNull
@Override
public Annotations loadClassAnnotations(@NotNull ClassDescriptor descriptor, @NotNull ProtoBuf.Class classProto) {
return Annotations.EMPTY;
}
@NotNull
@Override
public Annotations loadCallableAnnotations(
@NotNull ClassOrPackageFragmentDescriptor container,
@NotNull ProtoBuf.Callable proto,
@NotNull NameResolver nameResolver,
@NotNull AnnotatedCallableKind kind
) {
return Annotations.EMPTY;
}
@NotNull
@Override
public Annotations loadValueParameterAnnotations(
@NotNull ClassOrPackageFragmentDescriptor container,
@NotNull ProtoBuf.Callable callable,
@NotNull NameResolver nameResolver,
@NotNull AnnotatedCallableKind kind,
@NotNull ProtoBuf.Callable.ValueParameter proto
) {
return Annotations.EMPTY;
}
};
enum AnnotatedCallableKind {
FUNCTION,
PROPERTY,