diff src/clojure/asm/ClassAdapter.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/ClassAdapter.java	Sat Aug 21 06:25:44 2010 -0400
     1.3 @@ -0,0 +1,115 @@
     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 + * An empty {@link ClassVisitor} that delegates to another {@link ClassVisitor}.
    1.37 + * This class can be used as a super class to quickly implement usefull class
    1.38 + * adapter classes, just by overriding the necessary methods.
    1.39 + *
    1.40 + * @author Eric Bruneton
    1.41 + */
    1.42 +public class ClassAdapter implements ClassVisitor{
    1.43 +
    1.44 +/**
    1.45 + * The {@link ClassVisitor} to which this adapter delegates calls.
    1.46 + */
    1.47 +protected ClassVisitor cv;
    1.48 +
    1.49 +/**
    1.50 + * Constructs a new {@link ClassAdapter} object.
    1.51 + *
    1.52 + * @param cv the class visitor to which this adapter must delegate calls.
    1.53 + */
    1.54 +public ClassAdapter(final ClassVisitor cv){
    1.55 +	this.cv = cv;
    1.56 +}
    1.57 +
    1.58 +public void visit(
    1.59 +		final int version,
    1.60 +		final int access,
    1.61 +		final String name,
    1.62 +		final String signature,
    1.63 +		final String superName,
    1.64 +		final String[] interfaces){
    1.65 +	cv.visit(version, access, name, signature, superName, interfaces);
    1.66 +}
    1.67 +
    1.68 +public void visitSource(final String source, final String debug){
    1.69 +	cv.visitSource(source, debug);
    1.70 +}
    1.71 +
    1.72 +public void visitOuterClass(
    1.73 +		final String owner,
    1.74 +		final String name,
    1.75 +		final String desc){
    1.76 +	cv.visitOuterClass(owner, name, desc);
    1.77 +}
    1.78 +
    1.79 +public AnnotationVisitor visitAnnotation(
    1.80 +		final String desc,
    1.81 +		final boolean visible){
    1.82 +	return cv.visitAnnotation(desc, visible);
    1.83 +}
    1.84 +
    1.85 +public void visitAttribute(final Attribute attr){
    1.86 +	cv.visitAttribute(attr);
    1.87 +}
    1.88 +
    1.89 +public void visitInnerClass(
    1.90 +		final String name,
    1.91 +		final String outerName,
    1.92 +		final String innerName,
    1.93 +		final int access){
    1.94 +	cv.visitInnerClass(name, outerName, innerName, access);
    1.95 +}
    1.96 +
    1.97 +public FieldVisitor visitField(
    1.98 +		final int access,
    1.99 +		final String name,
   1.100 +		final String desc,
   1.101 +		final String signature,
   1.102 +		final Object value){
   1.103 +	return cv.visitField(access, name, desc, signature, value);
   1.104 +}
   1.105 +
   1.106 +public MethodVisitor visitMethod(
   1.107 +		final int access,
   1.108 +		final String name,
   1.109 +		final String desc,
   1.110 +		final String signature,
   1.111 +		final String[] exceptions){
   1.112 +	return cv.visitMethod(access, name, desc, signature, exceptions);
   1.113 +}
   1.114 +
   1.115 +public void visitEnd(){
   1.116 +	cv.visitEnd();
   1.117 +}
   1.118 +}