Blame contrib/asm/src/org/objectweb/asm/signature/SignatureVisitor.java

Packit 5e46da
/***
Packit 5e46da
 * ASM: a very small and fast Java bytecode manipulation framework
Packit 5e46da
 * Copyright (c) 2000-2011 INRIA, France Telecom
Packit 5e46da
 * All rights reserved.
Packit 5e46da
 *
Packit 5e46da
 * Redistribution and use in source and binary forms, with or without
Packit 5e46da
 * modification, are permitted provided that the following conditions
Packit 5e46da
 * are met:
Packit 5e46da
 * 1. Redistributions of source code must retain the above copyright
Packit 5e46da
 *    notice, this list of conditions and the following disclaimer.
Packit 5e46da
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 5e46da
 *    notice, this list of conditions and the following disclaimer in the
Packit 5e46da
 *    documentation and/or other materials provided with the distribution.
Packit 5e46da
 * 3. Neither the name of the copyright holders nor the names of its
Packit 5e46da
 *    contributors may be used to endorse or promote products derived from
Packit 5e46da
 *    this software without specific prior written permission.
Packit 5e46da
 *
Packit 5e46da
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 5e46da
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 5e46da
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 5e46da
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
Packit 5e46da
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Packit 5e46da
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Packit 5e46da
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 5e46da
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Packit 5e46da
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Packit 5e46da
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
Packit 5e46da
 * THE POSSIBILITY OF SUCH DAMAGE.
Packit 5e46da
 */
Packit 5e46da
package org.objectweb.asm.signature;
Packit 5e46da
Packit 5e46da
import org.objectweb.asm.Opcodes;
Packit 5e46da
Packit 5e46da
/**
Packit 5e46da
 * A visitor to visit a generic signature. The methods of this interface must be
Packit 5e46da
 * called in one of the three following orders (the last one is the only valid
Packit 5e46da
 * order for a {@link SignatureVisitor} that is returned by a method of this
Packit 5e46da
 * interface):
Packit 5e46da
 * 
    Packit 5e46da
     * 
  • ClassSignature = ( <tt>visitFormalTypeParameter</tt>
  • Packit 5e46da
     * <tt>visitClassBound</tt>? <tt>visitInterfaceBound</tt>* )* (
    Packit 5e46da
     * <tt>visitSuperclass</tt> <tt>visitInterface</tt>* )
    Packit 5e46da
     * 
  • MethodSignature = ( <tt>visitFormalTypeParameter</tt>
  • Packit 5e46da
     * <tt>visitClassBound</tt>? <tt>visitInterfaceBound</tt>* )* (
    Packit 5e46da
     * <tt>visitParameterType</tt>* <tt>visitReturnType</tt>
    Packit 5e46da
     * <tt>visitExceptionType</tt>* )
    Packit 5e46da
     * 
  • TypeSignature = <tt>visitBaseType</tt> |
  • Packit 5e46da
     * <tt>visitTypeVariable</tt> | <tt>visitArrayType</tt> | (
    Packit 5e46da
     * <tt>visitClassType</tt> <tt>visitTypeArgument</tt>* (
    Packit 5e46da
     * <tt>visitInnerClassType</tt> <tt>visitTypeArgument</tt>* )* <tt>visitEnd</tt>
    Packit 5e46da
     * ) )
    Packit 5e46da
     * 
    Packit 5e46da
     * 
    Packit 5e46da
     * @author Thomas Hallgren
    Packit 5e46da
     * @author Eric Bruneton
    Packit 5e46da
     */
    Packit 5e46da
    public abstract class SignatureVisitor {
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Wildcard for an "extends" type argument.
    Packit 5e46da
         */
    Packit 5e46da
        public final static char EXTENDS = '+';
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Wildcard for a "super" type argument.
    Packit 5e46da
         */
    Packit 5e46da
        public final static char SUPER = '-';
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Wildcard for a normal type argument.
    Packit 5e46da
         */
    Packit 5e46da
        public final static char INSTANCEOF = '=';
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * The ASM API version implemented by this visitor. The value of this field
    Packit 5e46da
         * must be one of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
    Packit 5e46da
         */
    Packit 5e46da
        protected final int api;
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Constructs a new {@link SignatureVisitor}.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param api
    Packit 5e46da
         *            the ASM API version implemented by this visitor. Must be one
    Packit 5e46da
         *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor(final int api) {
    Packit 5e46da
            if (api != Opcodes.ASM4 && api != Opcodes.ASM5) {
    Packit 5e46da
                throw new IllegalArgumentException();
    Packit 5e46da
            }
    Packit 5e46da
            this.api = api;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits a formal type parameter.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param name
    Packit 5e46da
         *            the name of the formal parameter.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitFormalTypeParameter(String name) {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the class bound of the last visited formal type parameter.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the class bound.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitClassBound() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits an interface bound of the last visited formal type parameter.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the interface bound.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitInterfaceBound() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the type of the super class.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the super class
    Packit 5e46da
         *         type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitSuperclass() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the type of an interface implemented by the class.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the interface type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitInterface() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the type of a method parameter.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the parameter type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitParameterType() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the return type of the method.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the return type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitReturnType() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits the type of a method exception.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the exception type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitExceptionType() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits a signature corresponding to a primitive type.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param descriptor
    Packit 5e46da
         *            the descriptor of the primitive type, or 'V' for <tt>void</tt>
    Packit 5e46da
         *            .
    Packit 5e46da
         */
    Packit 5e46da
        public void visitBaseType(char descriptor) {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits a signature corresponding to a type variable.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param name
    Packit 5e46da
         *            the name of the type variable.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitTypeVariable(String name) {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits a signature corresponding to an array type.
    Packit 5e46da
         * 
    Packit 5e46da
         * @return a non null visitor to visit the signature of the array element
    Packit 5e46da
         *         type.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitArrayType() {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Starts the visit of a signature corresponding to a class or interface
    Packit 5e46da
         * type.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param name
    Packit 5e46da
         *            the internal name of the class or interface.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitClassType(String name) {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits an inner class.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param name
    Packit 5e46da
         *            the local name of the inner class in its enclosing class.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitInnerClassType(String name) {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits an unbounded type argument of the last visited class or inner
    Packit 5e46da
         * class type.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitTypeArgument() {
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Visits a type argument of the last visited class or inner class type.
    Packit 5e46da
         * 
    Packit 5e46da
         * @param wildcard
    Packit 5e46da
         *            '+', '-' or '='.
    Packit 5e46da
         * @return a non null visitor to visit the signature of the type argument.
    Packit 5e46da
         */
    Packit 5e46da
        public SignatureVisitor visitTypeArgument(char wildcard) {
    Packit 5e46da
            return this;
    Packit 5e46da
        }
    Packit 5e46da
    Packit 5e46da
        /**
    Packit 5e46da
         * Ends the visit of a signature corresponding to a class or interface type.
    Packit 5e46da
         */
    Packit 5e46da
        public void visitEnd() {
    Packit 5e46da
        }
    Packit 5e46da
    }