annotate src/clojure/asm/ClassVisitor.java @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
rev   line source
rlm@10 1 /***
rlm@10 2 * ASM: a very small and fast Java bytecode manipulation framework
rlm@10 3 * Copyright (c) 2000-2005 INRIA, France Telecom
rlm@10 4 * All rights reserved.
rlm@10 5 *
rlm@10 6 * Redistribution and use in source and binary forms, with or without
rlm@10 7 * modification, are permitted provided that the following conditions
rlm@10 8 * are met:
rlm@10 9 * 1. Redistributions of source code must retain the above copyright
rlm@10 10 * notice, this list of conditions and the following disclaimer.
rlm@10 11 * 2. Redistributions in binary form must reproduce the above copyright
rlm@10 12 * notice, this list of conditions and the following disclaimer in the
rlm@10 13 * documentation and/or other materials provided with the distribution.
rlm@10 14 * 3. Neither the name of the copyright holders nor the names of its
rlm@10 15 * contributors may be used to endorse or promote products derived from
rlm@10 16 * this software without specific prior written permission.
rlm@10 17 *
rlm@10 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
rlm@10 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
rlm@10 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
rlm@10 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
rlm@10 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
rlm@10 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
rlm@10 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
rlm@10 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
rlm@10 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
rlm@10 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
rlm@10 28 * THE POSSIBILITY OF SUCH DAMAGE.
rlm@10 29 */
rlm@10 30 package clojure.asm;
rlm@10 31
rlm@10 32 /**
rlm@10 33 * A visitor to visit a Java class. The methods of this interface must be called
rlm@10 34 * in the following order: <tt>visit</tt> [ <tt>visitSource</tt> ] [
rlm@10 35 * <tt>visitOuterClass</tt> ] ( <tt>visitAnnotation</tt> |
rlm@10 36 * <tt>visitAttribute</tt> )* (<tt>visitInnerClass</tt> |
rlm@10 37 * <tt>visitField</tt> | <tt>visitMethod</tt> )* <tt>visitEnd</tt>.
rlm@10 38 *
rlm@10 39 * @author Eric Bruneton
rlm@10 40 */
rlm@10 41 public interface ClassVisitor{
rlm@10 42
rlm@10 43 /**
rlm@10 44 * Visits the header of the class.
rlm@10 45 *
rlm@10 46 * @param version the class version.
rlm@10 47 * @param access the class's access flags (see {@link Opcodes}). This
rlm@10 48 * parameter also indicates if the class is deprecated.
rlm@10 49 * @param name the internal name of the class (see
rlm@10 50 * {@link Type#getInternalName() getInternalName}).
rlm@10 51 * @param signature the signature of this class. May be <tt>null</tt> if
rlm@10 52 * the class is not a generic one, and does not extend or implement
rlm@10 53 * generic classes or interfaces.
rlm@10 54 * @param superName the internal of name of the super class (see
rlm@10 55 * {@link Type#getInternalName() getInternalName}). For interfaces,
rlm@10 56 * the super class is {@link Object}. May be <tt>null</tt>, but
rlm@10 57 * only for the {@link Object} class.
rlm@10 58 * @param interfaces the internal names of the class's interfaces (see
rlm@10 59 * {@link Type#getInternalName() getInternalName}). May be
rlm@10 60 * <tt>null</tt>.
rlm@10 61 */
rlm@10 62 void visit(
rlm@10 63 int version,
rlm@10 64 int access,
rlm@10 65 String name,
rlm@10 66 String signature,
rlm@10 67 String superName,
rlm@10 68 String[] interfaces);
rlm@10 69
rlm@10 70 /**
rlm@10 71 * Visits the source of the class.
rlm@10 72 *
rlm@10 73 * @param source the name of the source file from which the class was
rlm@10 74 * compiled. May be <tt>null</tt>.
rlm@10 75 * @param debug additional debug information to compute the correspondance
rlm@10 76 * between source and compiled elements of the class. May be
rlm@10 77 * <tt>null</tt>.
rlm@10 78 */
rlm@10 79 void visitSource(String source, String debug);
rlm@10 80
rlm@10 81 /**
rlm@10 82 * Visits the enclosing class of the class. This method must be called only
rlm@10 83 * if the class has an enclosing class.
rlm@10 84 *
rlm@10 85 * @param owner internal name of the enclosing class of the class.
rlm@10 86 * @param name the name of the method that contains the class, or
rlm@10 87 * <tt>null</tt> if the class is not enclosed in a method of its
rlm@10 88 * enclosing class.
rlm@10 89 * @param desc the descriptor of the method that contains the class, or
rlm@10 90 * <tt>null</tt> if the class is not enclosed in a method of its
rlm@10 91 * enclosing class.
rlm@10 92 */
rlm@10 93 void visitOuterClass(String owner, String name, String desc);
rlm@10 94
rlm@10 95 /**
rlm@10 96 * Visits an annotation of the class.
rlm@10 97 *
rlm@10 98 * @param desc the class descriptor of the annotation class.
rlm@10 99 * @param visible <tt>true</tt> if the annotation is visible at runtime.
rlm@10 100 * @return a visitor to visit the annotation values, or <tt>null</tt> if
rlm@10 101 * this visitor is not interested in visiting this annotation.
rlm@10 102 */
rlm@10 103 AnnotationVisitor visitAnnotation(String desc, boolean visible);
rlm@10 104
rlm@10 105 /**
rlm@10 106 * Visits a non standard attribute of the class.
rlm@10 107 *
rlm@10 108 * @param attr an attribute.
rlm@10 109 */
rlm@10 110 void visitAttribute(Attribute attr);
rlm@10 111
rlm@10 112 /**
rlm@10 113 * Visits information about an inner class. This inner class is not
rlm@10 114 * necessarily a member of the class being visited.
rlm@10 115 *
rlm@10 116 * @param name the internal name of an inner class (see
rlm@10 117 * {@link Type#getInternalName() getInternalName}).
rlm@10 118 * @param outerName the internal name of the class to which the inner class
rlm@10 119 * belongs (see {@link Type#getInternalName() getInternalName}). May
rlm@10 120 * be <tt>null</tt> for not member classes.
rlm@10 121 * @param innerName the (simple) name of the inner class inside its
rlm@10 122 * enclosing class. May be <tt>null</tt> for anonymous inner
rlm@10 123 * classes.
rlm@10 124 * @param access the access flags of the inner class as originally declared
rlm@10 125 * in the enclosing class.
rlm@10 126 */
rlm@10 127 void visitInnerClass(
rlm@10 128 String name,
rlm@10 129 String outerName,
rlm@10 130 String innerName,
rlm@10 131 int access);
rlm@10 132
rlm@10 133 /**
rlm@10 134 * Visits a field of the class.
rlm@10 135 *
rlm@10 136 * @param access the field's access flags (see {@link Opcodes}). This
rlm@10 137 * parameter also indicates if the field is synthetic and/or
rlm@10 138 * deprecated.
rlm@10 139 * @param name the field's name.
rlm@10 140 * @param desc the field's descriptor (see {@link Type Type}).
rlm@10 141 * @param signature the field's signature. May be <tt>null</tt> if the
rlm@10 142 * field's type does not use generic types.
rlm@10 143 * @param value the field's initial value. This parameter, which may be
rlm@10 144 * <tt>null</tt> if the field does not have an initial value, must
rlm@10 145 * be an {@link Integer}, a {@link Float}, a {@link Long}, a
rlm@10 146 * {@link Double} or a {@link String} (for <tt>int</tt>,
rlm@10 147 * <tt>float</tt>, <tt>long</tt> or <tt>String</tt> fields
rlm@10 148 * respectively). <i>This parameter is only used for static fields</i>.
rlm@10 149 * Its value is ignored for non static fields, which must be
rlm@10 150 * initialized through bytecode instructions in constructors or
rlm@10 151 * methods.
rlm@10 152 * @return a visitor to visit field annotations and attributes, or
rlm@10 153 * <tt>null</tt> if this class visitor is not interested in
rlm@10 154 * visiting these annotations and attributes.
rlm@10 155 */
rlm@10 156 FieldVisitor visitField(
rlm@10 157 int access,
rlm@10 158 String name,
rlm@10 159 String desc,
rlm@10 160 String signature,
rlm@10 161 Object value);
rlm@10 162
rlm@10 163 /**
rlm@10 164 * Visits a method of the class. This method <i>must</i> return a new
rlm@10 165 * {@link MethodVisitor} instance (or <tt>null</tt>) each time it is
rlm@10 166 * called, i.e., it should not return a previously returned visitor.
rlm@10 167 *
rlm@10 168 * @param access the method's access flags (see {@link Opcodes}). This
rlm@10 169 * parameter also indicates if the method is synthetic and/or
rlm@10 170 * deprecated.
rlm@10 171 * @param name the method's name.
rlm@10 172 * @param desc the method's descriptor (see {@link Type Type}).
rlm@10 173 * @param signature the method's signature. May be <tt>null</tt> if the
rlm@10 174 * method parameters, return type and exceptions do not use generic
rlm@10 175 * types.
rlm@10 176 * @param exceptions the internal names of the method's exception classes
rlm@10 177 * (see {@link Type#getInternalName() getInternalName}). May be
rlm@10 178 * <tt>null</tt>.
rlm@10 179 * @return an object to visit the byte code of the method, or <tt>null</tt>
rlm@10 180 * if this class visitor is not interested in visiting the code of
rlm@10 181 * this method.
rlm@10 182 */
rlm@10 183 MethodVisitor visitMethod(
rlm@10 184 int access,
rlm@10 185 String name,
rlm@10 186 String desc,
rlm@10 187 String signature,
rlm@10 188 String[] exceptions);
rlm@10 189
rlm@10 190 /**
rlm@10 191 * Visits the end of the class. This method, which is the last one to be
rlm@10 192 * called, is used to inform the visitor that all the fields and methods of
rlm@10 193 * the class have been visited.
rlm@10 194 */
rlm@10 195 void visitEnd();
rlm@10 196 }