Mercurial > lasercutter
view 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 |
line wrap: on
line source
1 /***2 * ASM: a very small and fast Java bytecode manipulation framework3 * Copyright (c) 2000-2005 INRIA, France Telecom4 * All rights reserved.5 *6 * Redistribution and use in source and binary forms, with or without7 * modification, are permitted provided that the following conditions8 * are met:9 * 1. Redistributions of source code must retain the above copyright10 * notice, this list of conditions and the following disclaimer.11 * 2. Redistributions in binary form must reproduce the above copyright12 * notice, this list of conditions and the following disclaimer in the13 * documentation and/or other materials provided with the distribution.14 * 3. Neither the name of the copyright holders nor the names of its15 * contributors may be used to endorse or promote products derived from16 * this software without specific prior written permission.17 *18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF28 * THE POSSIBILITY OF SUCH DAMAGE.29 */30 package clojure.asm;32 /**33 * A visitor to visit a Java class. The methods of this interface must be called34 * in the following order: <tt>visit</tt> [ <tt>visitSource</tt> ] [35 * <tt>visitOuterClass</tt> ] ( <tt>visitAnnotation</tt> |36 * <tt>visitAttribute</tt> )* (<tt>visitInnerClass</tt> |37 * <tt>visitField</tt> | <tt>visitMethod</tt> )* <tt>visitEnd</tt>.38 *39 * @author Eric Bruneton40 */41 public interface ClassVisitor{43 /**44 * Visits the header of the class.45 *46 * @param version the class version.47 * @param access the class's access flags (see {@link Opcodes}). This48 * parameter also indicates if the class is deprecated.49 * @param name the internal name of the class (see50 * {@link Type#getInternalName() getInternalName}).51 * @param signature the signature of this class. May be <tt>null</tt> if52 * the class is not a generic one, and does not extend or implement53 * generic classes or interfaces.54 * @param superName the internal of name of the super class (see55 * {@link Type#getInternalName() getInternalName}). For interfaces,56 * the super class is {@link Object}. May be <tt>null</tt>, but57 * only for the {@link Object} class.58 * @param interfaces the internal names of the class's interfaces (see59 * {@link Type#getInternalName() getInternalName}). May be60 * <tt>null</tt>.61 */62 void visit(63 int version,64 int access,65 String name,66 String signature,67 String superName,68 String[] interfaces);70 /**71 * Visits the source of the class.72 *73 * @param source the name of the source file from which the class was74 * compiled. May be <tt>null</tt>.75 * @param debug additional debug information to compute the correspondance76 * between source and compiled elements of the class. May be77 * <tt>null</tt>.78 */79 void visitSource(String source, String debug);81 /**82 * Visits the enclosing class of the class. This method must be called only83 * if the class has an enclosing class.84 *85 * @param owner internal name of the enclosing class of the class.86 * @param name the name of the method that contains the class, or87 * <tt>null</tt> if the class is not enclosed in a method of its88 * enclosing class.89 * @param desc the descriptor of the method that contains the class, or90 * <tt>null</tt> if the class is not enclosed in a method of its91 * enclosing class.92 */93 void visitOuterClass(String owner, String name, String desc);95 /**96 * Visits an annotation of the class.97 *98 * @param desc the class descriptor of the annotation class.99 * @param visible <tt>true</tt> if the annotation is visible at runtime.100 * @return a visitor to visit the annotation values, or <tt>null</tt> if101 * this visitor is not interested in visiting this annotation.102 */103 AnnotationVisitor visitAnnotation(String desc, boolean visible);105 /**106 * Visits a non standard attribute of the class.107 *108 * @param attr an attribute.109 */110 void visitAttribute(Attribute attr);112 /**113 * Visits information about an inner class. This inner class is not114 * necessarily a member of the class being visited.115 *116 * @param name the internal name of an inner class (see117 * {@link Type#getInternalName() getInternalName}).118 * @param outerName the internal name of the class to which the inner class119 * belongs (see {@link Type#getInternalName() getInternalName}). May120 * be <tt>null</tt> for not member classes.121 * @param innerName the (simple) name of the inner class inside its122 * enclosing class. May be <tt>null</tt> for anonymous inner123 * classes.124 * @param access the access flags of the inner class as originally declared125 * in the enclosing class.126 */127 void visitInnerClass(128 String name,129 String outerName,130 String innerName,131 int access);133 /**134 * Visits a field of the class.135 *136 * @param access the field's access flags (see {@link Opcodes}). This137 * parameter also indicates if the field is synthetic and/or138 * deprecated.139 * @param name the field's name.140 * @param desc the field's descriptor (see {@link Type Type}).141 * @param signature the field's signature. May be <tt>null</tt> if the142 * field's type does not use generic types.143 * @param value the field's initial value. This parameter, which may be144 * <tt>null</tt> if the field does not have an initial value, must145 * be an {@link Integer}, a {@link Float}, a {@link Long}, a146 * {@link Double} or a {@link String} (for <tt>int</tt>,147 * <tt>float</tt>, <tt>long</tt> or <tt>String</tt> fields148 * respectively). <i>This parameter is only used for static fields</i>.149 * Its value is ignored for non static fields, which must be150 * initialized through bytecode instructions in constructors or151 * methods.152 * @return a visitor to visit field annotations and attributes, or153 * <tt>null</tt> if this class visitor is not interested in154 * visiting these annotations and attributes.155 */156 FieldVisitor visitField(157 int access,158 String name,159 String desc,160 String signature,161 Object value);163 /**164 * Visits a method of the class. This method <i>must</i> return a new165 * {@link MethodVisitor} instance (or <tt>null</tt>) each time it is166 * called, i.e., it should not return a previously returned visitor.167 *168 * @param access the method's access flags (see {@link Opcodes}). This169 * parameter also indicates if the method is synthetic and/or170 * deprecated.171 * @param name the method's name.172 * @param desc the method's descriptor (see {@link Type Type}).173 * @param signature the method's signature. May be <tt>null</tt> if the174 * method parameters, return type and exceptions do not use generic175 * types.176 * @param exceptions the internal names of the method's exception classes177 * (see {@link Type#getInternalName() getInternalName}). May be178 * <tt>null</tt>.179 * @return an object to visit the byte code of the method, or <tt>null</tt>180 * if this class visitor is not interested in visiting the code of181 * this method.182 */183 MethodVisitor visitMethod(184 int access,185 String name,186 String desc,187 String signature,188 String[] exceptions);190 /**191 * Visits the end of the class. This method, which is the last one to be192 * called, is used to inform the visitor that all the fields and methods of193 * the class have been visited.194 */195 void visitEnd();196 }