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:
+31
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user