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