view src/clojure/asm/MethodAdapter.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 framework
3 * Copyright (c) 2000-2005 INRIA, France Telecom
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * 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, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 package clojure.asm;
32 /**
33 * An empty {@link MethodVisitor} that delegates to another
34 * {@link MethodVisitor}. This class can be used as a super class to quickly
35 * implement usefull method adapter classes, just by overriding the necessary
36 * methods.
37 *
38 * @author Eric Bruneton
39 */
40 public class MethodAdapter implements MethodVisitor{
42 /**
43 * The {@link MethodVisitor} to which this adapter delegates calls.
44 */
45 protected MethodVisitor mv;
47 /**
48 * Constructs a new {@link MethodAdapter} object.
49 *
50 * @param mv the code visitor to which this adapter must delegate calls.
51 */
52 public MethodAdapter(final MethodVisitor mv){
53 this.mv = mv;
54 }
56 public AnnotationVisitor visitAnnotationDefault(){
57 return mv.visitAnnotationDefault();
58 }
60 public AnnotationVisitor visitAnnotation(
61 final String desc,
62 final boolean visible){
63 return mv.visitAnnotation(desc, visible);
64 }
66 public AnnotationVisitor visitParameterAnnotation(
67 final int parameter,
68 final String desc,
69 final boolean visible){
70 return mv.visitParameterAnnotation(parameter, desc, visible);
71 }
73 public void visitAttribute(final Attribute attr){
74 mv.visitAttribute(attr);
75 }
77 public void visitCode(){
78 mv.visitCode();
79 }
81 public void visitFrame(
82 final int type,
83 final int nLocal,
84 final Object[] local,
85 final int nStack,
86 final Object[] stack){
87 mv.visitFrame(type, nLocal, local, nStack, stack);
88 }
90 public void visitInsn(final int opcode){
91 mv.visitInsn(opcode);
92 }
94 public void visitIntInsn(final int opcode, final int operand){
95 mv.visitIntInsn(opcode, operand);
96 }
98 public void visitVarInsn(final int opcode, final int var){
99 mv.visitVarInsn(opcode, var);
100 }
102 public void visitTypeInsn(final int opcode, final String desc){
103 mv.visitTypeInsn(opcode, desc);
104 }
106 public void visitFieldInsn(
107 final int opcode,
108 final String owner,
109 final String name,
110 final String desc){
111 mv.visitFieldInsn(opcode, owner, name, desc);
112 }
114 public void visitMethodInsn(
115 final int opcode,
116 final String owner,
117 final String name,
118 final String desc){
119 mv.visitMethodInsn(opcode, owner, name, desc);
120 }
122 public void visitJumpInsn(final int opcode, final Label label){
123 mv.visitJumpInsn(opcode, label);
124 }
126 public void visitLabel(final Label label){
127 mv.visitLabel(label);
128 }
130 public void visitLdcInsn(final Object cst){
131 mv.visitLdcInsn(cst);
132 }
134 public void visitIincInsn(final int var, final int increment){
135 mv.visitIincInsn(var, increment);
136 }
138 public void visitTableSwitchInsn(
139 final int min,
140 final int max,
141 final Label dflt,
142 final Label labels[]){
143 mv.visitTableSwitchInsn(min, max, dflt, labels);
144 }
146 public void visitLookupSwitchInsn(
147 final Label dflt,
148 final int keys[],
149 final Label labels[]){
150 mv.visitLookupSwitchInsn(dflt, keys, labels);
151 }
153 public void visitMultiANewArrayInsn(final String desc, final int dims){
154 mv.visitMultiANewArrayInsn(desc, dims);
155 }
157 public void visitTryCatchBlock(
158 final Label start,
159 final Label end,
160 final Label handler,
161 final String type){
162 mv.visitTryCatchBlock(start, end, handler, type);
163 }
165 public void visitLocalVariable(
166 final String name,
167 final String desc,
168 final String signature,
169 final Label start,
170 final Label end,
171 final int index){
172 mv.visitLocalVariable(name, desc, signature, start, end, index);
173 }
175 public void visitLineNumber(final int line, final Label start){
176 mv.visitLineNumber(line, start);
177 }
179 public void visitMaxs(final int maxStack, final int maxLocals){
180 mv.visitMaxs(maxStack, maxLocals);
181 }
183 public void visitEnd(){
184 mv.visitEnd();
185 }
186 }