Source Code Cross Referenced for MethodVisitor.java in  » Testing » Ejb3Unit » org » ejb3unit » asm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » Ejb3Unit » org.ejb3unit.asm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***
002:         * ASM: a very small and fast Java bytecode manipulation framework
003:         * Copyright (c) 2000-2005 INRIA, France Telecom
004:         * All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         * 1. Redistributions of source code must retain the above copyright
010:         *    notice, this list of conditions and the following disclaimer.
011:         * 2. Redistributions in binary form must reproduce the above copyright
012:         *    notice, this list of conditions and the following disclaimer in the
013:         *    documentation and/or other materials provided with the distribution.
014:         * 3. Neither the name of the copyright holders nor the names of its
015:         *    contributors may be used to endorse or promote products derived from
016:         *    this software without specific prior written permission.
017:         *
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021:         * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022:         * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023:         * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024:         * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025:         * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026:         * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
028:         * THE POSSIBILITY OF SUCH DAMAGE.
029:         */package org.ejb3unit.asm;
030:
031:        /**
032:         * A visitor to visit a Java method. The methods of this interface must be
033:         * called in the following order: [ <tt>visitAnnotationDefault</tt> ] (
034:         * <tt>visitAnnotation</tt> | <tt>visitParameterAnnotation</tt> |
035:         * <tt>visitAttribute</tt> )* [ <tt>visitCode</tt> ( <tt>visitFrame</tt> |
036:         * <tt>visit</tt><i>X</i>Insn</tt> | <tt>visitLabel</tt> | <tt>visitTryCatchBlock</tt> |
037:         * <tt>visitLocalVariable</tt> | <tt>visitLineNumber</tt>)* <tt>visitMaxs</tt> ]
038:         * <tt>visitEnd</tt>. In addition, the <tt>visit</tt><i>X</i>Insn</tt>
039:         * and <tt>visitLabel</tt> methods must be called in the sequential order of
040:         * the bytecode instructions of the visited code, <tt>visitTryCatchBlock</tt>
041:         * must be called <i>before</i> the labels passed as arguments have been
042:         * visited, and the <tt>visitLocalVariable</tt> and <tt>visitLineNumber</tt>
043:         * methods must be called <i>after</i> the labels passed as arguments have been
044:         * visited.
045:         * 
046:         * @author Eric Bruneton
047:         */
048:        public interface MethodVisitor {
049:
050:            // -------------------------------------------------------------------------
051:            // Annotations and non standard attributes
052:            // -------------------------------------------------------------------------
053:
054:            /**
055:             * Visits the default value of this annotation interface method.
056:             * 
057:             * @return a visitor to the visit the actual default value of this
058:             *         annotation interface method, or <tt>null</tt> if this visitor
059:             *         is not interested in visiting this default value. The 'name'
060:             *         parameters passed to the methods of this annotation visitor are
061:             *         ignored. Moreover, exacly one visit method must be called on this
062:             *         annotation visitor, followed by visitEnd.
063:             */
064:            AnnotationVisitor visitAnnotationDefault();
065:
066:            /**
067:             * Visits an annotation of this method.
068:             * 
069:             * @param desc the class descriptor of the annotation class.
070:             * @param visible <tt>true</tt> if the annotation is visible at runtime.
071:             * @return a visitor to visit the annotation values, or <tt>null</tt> if
072:             *         this visitor is not interested in visiting this annotation.
073:             */
074:            AnnotationVisitor visitAnnotation(String desc, boolean visible);
075:
076:            /**
077:             * Visits an annotation of a parameter this method.
078:             * 
079:             * @param parameter the parameter index.
080:             * @param desc the class descriptor of the annotation class.
081:             * @param visible <tt>true</tt> if the annotation is visible at runtime.
082:             * @return a visitor to visit the annotation values, or <tt>null</tt> if
083:             *         this visitor is not interested in visiting this annotation.
084:             */
085:            AnnotationVisitor visitParameterAnnotation(int parameter,
086:                    String desc, boolean visible);
087:
088:            /**
089:             * Visits a non standard attribute of this method.
090:             * 
091:             * @param attr an attribute.
092:             */
093:            void visitAttribute(Attribute attr);
094:
095:            /**
096:             * Starts the visit of the method's code, if any (i.e. non abstract method).
097:             */
098:            void visitCode();
099:
100:            /**
101:             * Visits the current state of the local variables and operand stack
102:             * elements. This method must(*) be called <i>just before</i> any
103:             * instruction <b>i</b> that follows an unconditionnal branch instruction
104:             * such as GOTO or THROW, that is the target of a jump instruction, or that
105:             * starts an exception handler block. The visited types must describe the
106:             * values of the local variables and of the operand stack elements <i>just
107:             * before</i> <b>i</b> is executed. <br> <br> (*) this is mandatory only
108:             * for classes whose version is greater than or equal to
109:             * {@link Opcodes#V1_6 V1_6}. <br> <br> Packed frames are basically
110:             * "deltas" from the state of the previous frame (very first frame is
111:             * implicitly defined by the method's parameters and access flags): <ul>
112:             * <li>{@link Opcodes#F_SAME} representing frame with exactly the same
113:             * locals as the previous frame and with the empty stack.</li> <li>{@link Opcodes#F_SAME1}
114:             * representing frame with exactly the same locals as the previous frame and
115:             * with single value on the stack (<code>nStack</code> is 1 and
116:             * <code>stack[0]</code> contains value for the type of the stack item).</li>
117:             * <li>{@link Opcodes#F_APPEND} representing frame with current locals are
118:             * the same as the locals in the previous frame, except that additional
119:             * locals are defined (<code>nLocal</code> is 1, 2 or 3 and
120:             * <code>local</code> elements contains values representing added types).</li>
121:             * <li>{@link Opcodes#F_CHOP} representing frame with current locals are
122:             * the same as the locals in the previous frame, except that the last 1-3
123:             * locals are absent and with the empty stack (<code>nLocals</code> is 1,
124:             * 2 or 3). </li> <li>{@link Opcodes#F_FULL} representing complete frame
125:             * data.</li> </li> </ul>
126:             * 
127:             * @param type the type of this stack map frame. Must be
128:             *        {@link Opcodes#F_NEW} for expanded frames, or
129:             *        {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND},
130:             *        {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
131:             *        {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed
132:             *        frames.
133:             * @param nLocal the number of local variables in the visited frame.
134:             * @param local the local variable types in this frame. This array must not
135:             *        be modified. Primitive types are represented by
136:             *        {@link Opcodes#TOP}, {@link Opcodes#INTEGER},
137:             *        {@link Opcodes#FLOAT}, {@link Opcodes#LONG},
138:             *        {@link Opcodes#DOUBLE},{@link Opcodes#NULL} or
139:             *        {@link Opcodes#UNINITIALIZED_THIS} (long and double are
140:             *        represented by a single element). Reference types are represented
141:             *        by String objects (representing internal names, or type
142:             *        descriptors for array types), and uninitialized types by Label
143:             *        objects (this label designates the NEW instruction that created
144:             *        this uninitialized value).
145:             * @param nStack the number of operand stack elements in the visited frame.
146:             * @param stack the operand stack types in this frame. This array must not
147:             *        be modified. Its content has the same format as the "local" array.
148:             */
149:            void visitFrame(int type, int nLocal, Object[] local, int nStack,
150:                    Object[] stack);
151:
152:            // -------------------------------------------------------------------------
153:            // Normal instructions
154:            // -------------------------------------------------------------------------
155:
156:            /**
157:             * Visits a zero operand instruction.
158:             * 
159:             * @param opcode the opcode of the instruction to be visited. This opcode is
160:             *        either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2,
161:             *        ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0,
162:             *        FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, FALOAD,
163:             *        DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE,
164:             *        DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP,
165:             *        DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, FADD,
166:             *        DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV,
167:             *        FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL,
168:             *        LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR,
169:             *        I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B,
170:             *        I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN,
171:             *        FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW,
172:             *        MONITORENTER, or MONITOREXIT.
173:             */
174:            void visitInsn(int opcode);
175:
176:            /**
177:             * Visits an instruction with a single int operand.
178:             * 
179:             * @param opcode the opcode of the instruction to be visited. This opcode is
180:             *        either BIPUSH, SIPUSH or NEWARRAY.
181:             * @param operand the operand of the instruction to be visited.<br> When
182:             *        opcode is BIPUSH, operand value should be between Byte.MIN_VALUE
183:             *        and Byte.MAX_VALUE.<br> When opcode is SIPUSH, operand value
184:             *        should be between Short.MIN_VALUE and Short.MAX_VALUE.<br> When
185:             *        opcode is NEWARRAY, operand value should be one of
186:             *        {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR},
187:             *        {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE},
188:             *        {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT},
189:             *        {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}.
190:             */
191:            void visitIntInsn(int opcode, int operand);
192:
193:            /**
194:             * Visits a local variable instruction. A local variable instruction is an
195:             * instruction that loads or stores the value of a local variable.
196:             * 
197:             * @param opcode the opcode of the local variable instruction to be visited.
198:             *        This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE,
199:             *        LSTORE, FSTORE, DSTORE, ASTORE or RET.
200:             * @param var the operand of the instruction to be visited. This operand is
201:             *        the index of a local variable.
202:             */
203:            void visitVarInsn(int opcode, int var);
204:
205:            /**
206:             * Visits a type instruction. A type instruction is an instruction that
207:             * takes a type descriptor as parameter.
208:             * 
209:             * @param opcode the opcode of the type instruction to be visited. This
210:             *        opcode is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
211:             * @param desc the operand of the instruction to be visited. This operand is
212:             *        must be a fully qualified class name in internal form, or the type
213:             *        descriptor of an array type (see {@link Type Type}).
214:             */
215:            void visitTypeInsn(int opcode, String desc);
216:
217:            /**
218:             * Visits a field instruction. A field instruction is an instruction that
219:             * loads or stores the value of a field of an object.
220:             * 
221:             * @param opcode the opcode of the type instruction to be visited. This
222:             *        opcode is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
223:             * @param owner the internal name of the field's owner class (see {@link
224:             *        Type#getInternalName() getInternalName}).
225:             * @param name the field's name.
226:             * @param desc the field's descriptor (see {@link Type Type}).
227:             */
228:            void visitFieldInsn(int opcode, String owner, String name,
229:                    String desc);
230:
231:            /**
232:             * Visits a method instruction. A method instruction is an instruction that
233:             * invokes a method.
234:             * 
235:             * @param opcode the opcode of the type instruction to be visited. This
236:             *        opcode is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
237:             *        INVOKEINTERFACE.
238:             * @param owner the internal name of the method's owner class (see {@link
239:             *        Type#getInternalName() getInternalName}).
240:             * @param name the method's name.
241:             * @param desc the method's descriptor (see {@link Type Type}).
242:             */
243:            void visitMethodInsn(int opcode, String owner, String name,
244:                    String desc);
245:
246:            /**
247:             * Visits a jump instruction. A jump instruction is an instruction that may
248:             * jump to another instruction.
249:             * 
250:             * @param opcode the opcode of the type instruction to be visited. This
251:             *        opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
252:             *        IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ,
253:             *        IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.
254:             * @param label the operand of the instruction to be visited. This operand
255:             *        is a label that designates the instruction to which the jump
256:             *        instruction may jump.
257:             */
258:            void visitJumpInsn(int opcode, Label label);
259:
260:            /**
261:             * Visits a label. A label designates the instruction that will be visited
262:             * just after it.
263:             * 
264:             * @param label a {@link Label Label} object.
265:             */
266:            void visitLabel(Label label);
267:
268:            // -------------------------------------------------------------------------
269:            // Special instructions
270:            // -------------------------------------------------------------------------
271:
272:            /**
273:             * Visits a LDC instruction.
274:             * 
275:             * @param cst the constant to be loaded on the stack. This parameter must be
276:             *        a non null {@link Integer}, a {@link Float}, a {@link Long}, a
277:             *        {@link Double} a {@link String} (or a {@link Type} for
278:             *        <tt>.class</tt> constants, for classes whose version is 49.0 or
279:             *        more).
280:             */
281:            void visitLdcInsn(Object cst);
282:
283:            /**
284:             * Visits an IINC instruction.
285:             * 
286:             * @param var index of the local variable to be incremented.
287:             * @param increment amount to increment the local variable by.
288:             */
289:            void visitIincInsn(int var, int increment);
290:
291:            /**
292:             * Visits a TABLESWITCH instruction.
293:             * 
294:             * @param min the minimum key value.
295:             * @param max the maximum key value.
296:             * @param dflt beginning of the default handler block.
297:             * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is
298:             *        the beginning of the handler block for the <tt>min + i</tt> key.
299:             */
300:            void visitTableSwitchInsn(int min, int max, Label dflt,
301:                    Label labels[]);
302:
303:            /**
304:             * Visits a LOOKUPSWITCH instruction.
305:             * 
306:             * @param dflt beginning of the default handler block.
307:             * @param keys the values of the keys.
308:             * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is
309:             *        the beginning of the handler block for the <tt>keys[i]</tt> key.
310:             */
311:            void visitLookupSwitchInsn(Label dflt, int keys[], Label labels[]);
312:
313:            /**
314:             * Visits a MULTIANEWARRAY instruction.
315:             * 
316:             * @param desc an array type descriptor (see {@link Type Type}).
317:             * @param dims number of dimensions of the array to allocate.
318:             */
319:            void visitMultiANewArrayInsn(String desc, int dims);
320:
321:            // -------------------------------------------------------------------------
322:            // Exceptions table entries, debug information, max stack and max locals
323:            // -------------------------------------------------------------------------
324:
325:            /**
326:             * Visits a try catch block.
327:             * 
328:             * @param start beginning of the exception handler's scope (inclusive).
329:             * @param end end of the exception handler's scope (exclusive).
330:             * @param handler beginning of the exception handler's code.
331:             * @param type internal name of the type of exceptions handled by the
332:             *        handler, or <tt>null</tt> to catch any exceptions (for "finally"
333:             *        blocks).
334:             * @throws IllegalArgumentException if one of the labels has already been
335:             *         visited by this visitor (by the {@link #visitLabel visitLabel}
336:             *         method).
337:             */
338:            void visitTryCatchBlock(Label start, Label end, Label handler,
339:                    String type);
340:
341:            /**
342:             * Visits a local variable declaration.
343:             * 
344:             * @param name the name of a local variable.
345:             * @param desc the type descriptor of this local variable.
346:             * @param signature the type signature of this local variable. May be
347:             *        <tt>null</tt> if the local variable type does not use generic
348:             *        types.
349:             * @param start the first instruction corresponding to the scope of this
350:             *        local variable (inclusive).
351:             * @param end the last instruction corresponding to the scope of this local
352:             *        variable (exclusive).
353:             * @param index the local variable's index.
354:             * @throws IllegalArgumentException if one of the labels has not already
355:             *         been visited by this visitor (by the
356:             *         {@link #visitLabel visitLabel} method).
357:             */
358:            void visitLocalVariable(String name, String desc, String signature,
359:                    Label start, Label end, int index);
360:
361:            /**
362:             * Visits a line number declaration.
363:             * 
364:             * @param line a line number. This number refers to the source file from
365:             *        which the class was compiled.
366:             * @param start the first instruction corresponding to this line number.
367:             * @throws IllegalArgumentException if <tt>start</tt> has not already been
368:             *         visited by this visitor (by the {@link #visitLabel visitLabel}
369:             *         method).
370:             */
371:            void visitLineNumber(int line, Label start);
372:
373:            /**
374:             * Visits the maximum stack size and the maximum number of local variables
375:             * of the method.
376:             * 
377:             * @param maxStack maximum stack size of the method.
378:             * @param maxLocals maximum number of local variables for the method.
379:             */
380:            void visitMaxs(int maxStack, int maxLocals);
381:
382:            /**
383:             * Visits the end of the method. This method, which is the last one to be
384:             * called, is used to inform the visitor that all the annotations and
385:             * attributes of the method have been visited.
386:             */
387:            void visitEnd();
388:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.