diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojure/asm/ClassVisitor.java	Sat Aug 21 06:25:44 2010 -0400
     1.3 @@ -0,0 +1,196 @@
     1.4 +/***
     1.5 + * ASM: a very small and fast Java bytecode manipulation framework
     1.6 + * Copyright (c) 2000-2005 INRIA, France Telecom
     1.7 + * All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 3. Neither the name of the copyright holders nor the names of its
    1.18 + *    contributors may be used to endorse or promote products derived from
    1.19 + *    this software without specific prior written permission.
    1.20 + *
    1.21 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.22 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    1.25 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.26 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.27 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.28 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.29 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.30 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    1.31 + * THE POSSIBILITY OF SUCH DAMAGE.
    1.32 + */
    1.33 +package clojure.asm;
    1.34 +
    1.35 +/**
    1.36 + * A visitor to visit a Java class. The methods of this interface must be called
    1.37 + * in the following order: <tt>visit</tt> [ <tt>visitSource</tt> ] [
    1.38 + * <tt>visitOuterClass</tt> ] ( <tt>visitAnnotation</tt> |
    1.39 + * <tt>visitAttribute</tt> )* (<tt>visitInnerClass</tt> |
    1.40 + * <tt>visitField</tt> | <tt>visitMethod</tt> )* <tt>visitEnd</tt>.
    1.41 + *
    1.42 + * @author Eric Bruneton
    1.43 + */
    1.44 +public interface ClassVisitor{
    1.45 +
    1.46 +/**
    1.47 + * Visits the header of the class.
    1.48 + *
    1.49 + * @param version    the class version.
    1.50 + * @param access     the class's access flags (see {@link Opcodes}). This
    1.51 + *                   parameter also indicates if the class is deprecated.
    1.52 + * @param name       the internal name of the class (see
    1.53 + *                   {@link Type#getInternalName() getInternalName}).
    1.54 + * @param signature  the signature of this class. May be <tt>null</tt> if
    1.55 + *                   the class is not a generic one, and does not extend or implement
    1.56 + *                   generic classes or interfaces.
    1.57 + * @param superName  the internal of name of the super class (see
    1.58 + *                   {@link Type#getInternalName() getInternalName}). For interfaces,
    1.59 + *                   the super class is {@link Object}. May be <tt>null</tt>, but
    1.60 + *                   only for the {@link Object} class.
    1.61 + * @param interfaces the internal names of the class's interfaces (see
    1.62 + *                   {@link Type#getInternalName() getInternalName}). May be
    1.63 + *                   <tt>null</tt>.
    1.64 + */
    1.65 +void visit(
    1.66 +		int version,
    1.67 +		int access,
    1.68 +		String name,
    1.69 +		String signature,
    1.70 +		String superName,
    1.71 +		String[] interfaces);
    1.72 +
    1.73 +/**
    1.74 + * Visits the source of the class.
    1.75 + *
    1.76 + * @param source the name of the source file from which the class was
    1.77 + *               compiled. May be <tt>null</tt>.
    1.78 + * @param debug  additional debug information to compute the correspondance
    1.79 + *               between source and compiled elements of the class. May be
    1.80 + *               <tt>null</tt>.
    1.81 + */
    1.82 +void visitSource(String source, String debug);
    1.83 +
    1.84 +/**
    1.85 + * Visits the enclosing class of the class. This method must be called only
    1.86 + * if the class has an enclosing class.
    1.87 + *
    1.88 + * @param owner internal name of the enclosing class of the class.
    1.89 + * @param name  the name of the method that contains the class, or
    1.90 + *              <tt>null</tt> if the class is not enclosed in a method of its
    1.91 + *              enclosing class.
    1.92 + * @param desc  the descriptor of the method that contains the class, or
    1.93 + *              <tt>null</tt> if the class is not enclosed in a method of its
    1.94 + *              enclosing class.
    1.95 + */
    1.96 +void visitOuterClass(String owner, String name, String desc);
    1.97 +
    1.98 +/**
    1.99 + * Visits an annotation of the class.
   1.100 + *
   1.101 + * @param desc    the class descriptor of the annotation class.
   1.102 + * @param visible <tt>true</tt> if the annotation is visible at runtime.
   1.103 + * @return a visitor to visit the annotation values, or <tt>null</tt> if
   1.104 + *         this visitor is not interested in visiting this annotation.
   1.105 + */
   1.106 +AnnotationVisitor visitAnnotation(String desc, boolean visible);
   1.107 +
   1.108 +/**
   1.109 + * Visits a non standard attribute of the class.
   1.110 + *
   1.111 + * @param attr an attribute.
   1.112 + */
   1.113 +void visitAttribute(Attribute attr);
   1.114 +
   1.115 +/**
   1.116 + * Visits information about an inner class. This inner class is not
   1.117 + * necessarily a member of the class being visited.
   1.118 + *
   1.119 + * @param name      the internal name of an inner class (see
   1.120 + *                  {@link Type#getInternalName() getInternalName}).
   1.121 + * @param outerName the internal name of the class to which the inner class
   1.122 + *                  belongs (see {@link Type#getInternalName() getInternalName}). May
   1.123 + *                  be <tt>null</tt> for not member classes.
   1.124 + * @param innerName the (simple) name of the inner class inside its
   1.125 + *                  enclosing class. May be <tt>null</tt> for anonymous inner
   1.126 + *                  classes.
   1.127 + * @param access    the access flags of the inner class as originally declared
   1.128 + *                  in the enclosing class.
   1.129 + */
   1.130 +void visitInnerClass(
   1.131 +		String name,
   1.132 +		String outerName,
   1.133 +		String innerName,
   1.134 +		int access);
   1.135 +
   1.136 +/**
   1.137 + * Visits a field of the class.
   1.138 + *
   1.139 + * @param access    the field's access flags (see {@link Opcodes}). This
   1.140 + *                  parameter also indicates if the field is synthetic and/or
   1.141 + *                  deprecated.
   1.142 + * @param name      the field's name.
   1.143 + * @param desc      the field's descriptor (see {@link Type Type}).
   1.144 + * @param signature the field's signature. May be <tt>null</tt> if the
   1.145 + *                  field's type does not use generic types.
   1.146 + * @param value     the field's initial value. This parameter, which may be
   1.147 + *                  <tt>null</tt> if the field does not have an initial value, must
   1.148 + *                  be an {@link Integer}, a {@link Float}, a {@link Long}, a
   1.149 + *                  {@link Double} or a {@link String} (for <tt>int</tt>,
   1.150 + *                  <tt>float</tt>, <tt>long</tt> or <tt>String</tt> fields
   1.151 + *                  respectively). <i>This parameter is only used for static fields</i>.
   1.152 + *                  Its value is ignored for non static fields, which must be
   1.153 + *                  initialized through bytecode instructions in constructors or
   1.154 + *                  methods.
   1.155 + * @return a visitor to visit field annotations and attributes, or
   1.156 + *         <tt>null</tt> if this class visitor is not interested in
   1.157 + *         visiting these annotations and attributes.
   1.158 + */
   1.159 +FieldVisitor visitField(
   1.160 +		int access,
   1.161 +		String name,
   1.162 +		String desc,
   1.163 +		String signature,
   1.164 +		Object value);
   1.165 +
   1.166 +/**
   1.167 + * Visits a method of the class. This method <i>must</i> return a new
   1.168 + * {@link MethodVisitor} instance (or <tt>null</tt>) each time it is
   1.169 + * called, i.e., it should not return a previously returned visitor.
   1.170 + *
   1.171 + * @param access     the method's access flags (see {@link Opcodes}). This
   1.172 + *                   parameter also indicates if the method is synthetic and/or
   1.173 + *                   deprecated.
   1.174 + * @param name       the method's name.
   1.175 + * @param desc       the method's descriptor (see {@link Type Type}).
   1.176 + * @param signature  the method's signature. May be <tt>null</tt> if the
   1.177 + *                   method parameters, return type and exceptions do not use generic
   1.178 + *                   types.
   1.179 + * @param exceptions the internal names of the method's exception classes
   1.180 + *                   (see {@link Type#getInternalName() getInternalName}). May be
   1.181 + *                   <tt>null</tt>.
   1.182 + * @return an object to visit the byte code of the method, or <tt>null</tt>
   1.183 + *         if this class visitor is not interested in visiting the code of
   1.184 + *         this method.
   1.185 + */
   1.186 +MethodVisitor visitMethod(
   1.187 +		int access,
   1.188 +		String name,
   1.189 +		String desc,
   1.190 +		String signature,
   1.191 +		String[] exceptions);
   1.192 +
   1.193 +/**
   1.194 + * Visits the end of the class. This method, which is the last one to be
   1.195 + * called, is used to inform the visitor that all the fields and methods of
   1.196 + * the class have been visited.
   1.197 + */
   1.198 +void visitEnd();
   1.199 +}