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> loadEnumEntryAnnotations( 045 @NotNull ProtoContainer container, 046 @NotNull ProtoBuf.EnumEntry proto 047 ); 048 049 @NotNull 050 List<A> loadValueParameterAnnotations( 051 @NotNull ProtoContainer container, 052 @NotNull MessageLite message, 053 @NotNull AnnotatedCallableKind kind, 054 int parameterIndex, 055 @NotNull ProtoBuf.ValueParameter proto 056 ); 057 058 @NotNull 059 List<A> loadExtensionReceiverParameterAnnotations( 060 @NotNull ProtoContainer container, 061 @NotNull MessageLite message, 062 @NotNull AnnotatedCallableKind kind 063 ); 064 065 @NotNull 066 List<A> loadTypeAnnotations( 067 @NotNull ProtoBuf.Type type, 068 @NotNull NameResolver nameResolver 069 ); 070 071 @NotNull 072 List<A> loadTypeParameterAnnotations( 073 @NotNull ProtoBuf.TypeParameter typeParameter, 074 @NotNull NameResolver nameResolver 075 ); 076 077 @Nullable 078 C loadPropertyConstant( 079 @NotNull ProtoContainer container, 080 @NotNull ProtoBuf.Property proto, 081 @NotNull KotlinType expectedType 082 ); 083 }