1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.generic;
18
19 import org.apache.bcel.Constants;
20 import org.apache.bcel.ExceptionConstants;
21
22 /***
23 * INVOKESPECIAL - Invoke instance method; special handling for superclass, private
24 * and instance initialization method invocations
25 *
26 * <PRE>Stack: ..., objectref, [arg1, [arg2 ...]] -> ...</PRE>
27 *
28 * @version $Id: INVOKESPECIAL.java 386056 2006-03-15 11:31:56Z tcurdt $
29 * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
30 */
31 public class INVOKESPECIAL extends InvokeInstruction {
32
33 /***
34 * Empty constructor needed for the Class.newInstance() statement in
35 * Instruction.readInstruction(). Not to be used otherwise.
36 */
37 INVOKESPECIAL() {
38 }
39
40
41 public INVOKESPECIAL(int index) {
42 super(Constants.INVOKESPECIAL, index);
43 }
44
45
46 public Class[] getExceptions() {
47 Class[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
48 System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
49 ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
50 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 3] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
51 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ABSTRACT_METHOD_ERROR;
52 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
53 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION;
54 return cs;
55 }
56
57
58 /***
59 * Call corresponding visitor method(s). The order is:
60 * Call visitor methods of implemented interfaces first, then
61 * call methods according to the class hierarchy in descending order,
62 * i.e., the most specific visitXXX() call comes last.
63 *
64 * @param v Visitor object
65 */
66 public void accept( Visitor v ) {
67 v.visitExceptionThrower(this);
68 v.visitTypedInstruction(this);
69 v.visitStackConsumer(this);
70 v.visitStackProducer(this);
71 v.visitLoadClass(this);
72 v.visitCPInstruction(this);
73 v.visitFieldOrMethod(this);
74 v.visitInvokeInstruction(this);
75 v.visitINVOKESPECIAL(this);
76 }
77 }