001 /*
002 * Copyright 2010-2015 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.serialization.deserialization;
018
019 import com.google.protobuf.MessageLite;
020 import org.jetbrains.annotations.NotNull;
021 import org.jetbrains.annotations.Nullable;
022 import org.jetbrains.kotlin.serialization.ProtoBuf;
023 import org.jetbrains.kotlin.types.KotlinType;
024
025 import java.util.List;
026
027 // The MessageLite instance everywhere should be Constructor, Function or Property
028 // TODO: simplify this interface
029 public interface AnnotationAndConstantLoader<A, C, T> {
030 @NotNull
031 List<A> loadClassAnnotations(
032 @NotNull ProtoBuf.Class classProto,
033 @NotNull NameResolver nameResolver
034 );
035
036 @NotNull
037 List<T> loadCallableAnnotations(
038 @NotNull ProtoContainer container,
039 @NotNull MessageLite message,
040 @NotNull AnnotatedCallableKind kind
041 );
042
043 @NotNull
044 List<A> loadValueParameterAnnotations(
045 @NotNull ProtoContainer container,
046 @NotNull MessageLite message,
047 @NotNull AnnotatedCallableKind kind,
048 int parameterIndex,
049 @NotNull ProtoBuf.ValueParameter proto
050 );
051
052 @NotNull
053 List<A> loadExtensionReceiverParameterAnnotations(
054 @NotNull ProtoContainer container,
055 @NotNull MessageLite message,
056 @NotNull AnnotatedCallableKind kind
057 );
058
059 @NotNull
060 List<A> loadTypeAnnotations(
061 @NotNull ProtoBuf.Type type,
062 @NotNull NameResolver nameResolver
063 );
064
065 @NotNull
066 List<A> loadTypeParameterAnnotations(
067 @NotNull ProtoBuf.TypeParameter typeParameter,
068 @NotNull NameResolver nameResolver
069 );
070
071 @Nullable
072 C loadPropertyConstant(
073 @NotNull ProtoContainer container,
074 @NotNull ProtoBuf.Property proto,
075 @NotNull KotlinType expectedType
076 );
077 }