View Javadoc

1   /*
2    * Copyright  2000-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License"); 
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License. 
15   *
16   */
17  package org.apache.bcel.generic;
18  
19  import org.apache.bcel.Constants;
20  import org.apache.bcel.ExceptionConstants;
21  
22  /*** 
23   * INVOKESTATIC - Invoke a class (static) method
24   *
25   * <PRE>Stack: ..., [arg1, [arg2 ...]] -&gt; ...</PRE>
26   *
27   * @version $Id: INVOKESTATIC.java 386056 2006-03-15 11:31:56Z tcurdt $
28   * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
29   */
30  public class INVOKESTATIC extends InvokeInstruction {
31  
32      /***
33       * Empty constructor needed for the Class.newInstance() statement in
34       * Instruction.readInstruction(). Not to be used otherwise.
35       */
36      INVOKESTATIC() {
37      }
38  
39  
40      public INVOKESTATIC(int index) {
41          super(Constants.INVOKESTATIC, index);
42      }
43  
44  
45      public Class[] getExceptions() {
46          Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
47          System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
48                  ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
49          cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
50          cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
51          return cs;
52      }
53  
54  
55      /***
56       * Call corresponding visitor method(s). The order is:
57       * Call visitor methods of implemented interfaces first, then
58       * call methods according to the class hierarchy in descending order,
59       * i.e., the most specific visitXXX() call comes last.
60       *
61       * @param v Visitor object
62       */
63      public void accept( Visitor v ) {
64          v.visitExceptionThrower(this);
65          v.visitTypedInstruction(this);
66          v.visitStackConsumer(this);
67          v.visitStackProducer(this);
68          v.visitLoadClass(this);
69          v.visitCPInstruction(this);
70          v.visitFieldOrMethod(this);
71          v.visitInvokeInstruction(this);
72          v.visitINVOKESTATIC(this);
73      }
74  }