001 /* 002 * Copyright 2010-2013 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.jet.lang.resolve.kotlin; 018 019 import org.jetbrains.annotations.NotNull; 020 import org.jetbrains.annotations.Nullable; 021 import org.jetbrains.jet.lang.resolve.java.JvmClassName; 022 import org.jetbrains.jet.lang.resolve.name.Name; 023 024 public interface KotlinJvmBinaryClass { 025 @NotNull 026 JvmClassName getClassName(); 027 028 void loadClassAnnotations(@NotNull AnnotationVisitor visitor); 029 030 void loadMemberAnnotations(@NotNull MemberVisitor visitor); 031 032 interface MemberVisitor { 033 // TODO: abstract signatures for methods and fields instead of ASM 'desc' strings? 034 035 @Nullable 036 MethodAnnotationVisitor visitMethod(@NotNull Name name, @NotNull String desc); 037 038 @Nullable 039 AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc); 040 } 041 042 interface AnnotationVisitor { 043 @Nullable 044 AnnotationArgumentVisitor visitAnnotation(@NotNull JvmClassName className); 045 046 void visitEnd(); 047 } 048 049 interface MethodAnnotationVisitor extends AnnotationVisitor { 050 @Nullable 051 AnnotationArgumentVisitor visitParameterAnnotation(int index, @NotNull JvmClassName className); 052 } 053 054 interface AnnotationArgumentVisitor { 055 // TODO: annotations, java.lang.Class 056 void visit(@Nullable Name name, @Nullable Object value); 057 058 void visitEnum(@NotNull Name name, @NotNull JvmClassName enumClassName, @NotNull Name enumEntryName); 059 060 @Nullable 061 AnnotationArgumentVisitor visitArray(@NotNull Name name); 062 063 void visitEnd(); 064 } 065 }