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.codegen; 018 019 import com.intellij.psi.PsiElement; 020 import org.jetbrains.annotations.NotNull; 021 import org.jetbrains.annotations.Nullable; 022 import org.jetbrains.kotlin.codegen.inline.FileMapping; 023 import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; 024 import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; 025 import org.jetbrains.org.objectweb.asm.AnnotationVisitor; 026 import org.jetbrains.org.objectweb.asm.ClassVisitor; 027 import org.jetbrains.org.objectweb.asm.FieldVisitor; 028 import org.jetbrains.org.objectweb.asm.MethodVisitor; 029 030 public interface ClassBuilder { 031 @NotNull 032 FieldVisitor newField( 033 @NotNull JvmDeclarationOrigin origin, 034 int access, 035 @NotNull String name, 036 @NotNull String desc, 037 @Nullable String signature, 038 @Nullable Object value 039 ); 040 041 @NotNull 042 MethodVisitor newMethod( 043 @NotNull JvmDeclarationOrigin origin, 044 int access, 045 @NotNull String name, 046 @NotNull String desc, 047 @Nullable String signature, 048 @Nullable String[] exceptions 049 ); 050 051 @NotNull 052 JvmSerializationBindings getSerializationBindings(); 053 054 @NotNull 055 AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible); 056 057 void done(); 058 059 @NotNull 060 ClassVisitor getVisitor(); 061 062 void defineClass( 063 @Nullable PsiElement origin, 064 int version, 065 int access, 066 @NotNull String name, 067 @Nullable String signature, 068 @NotNull String superName, 069 @NotNull String[] interfaces 070 ); 071 072 void visitSource(@NotNull String name, @Nullable String debug); 073 074 void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc); 075 076 void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access); 077 078 @NotNull 079 String getThisName(); 080 081 void addSMAP(FileMapping mapping); 082 }