1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.bcel.internal.generic;
  23 
  24 import com.sun.org.apache.bcel.internal.Constants;
  25 import com.sun.org.apache.bcel.internal.ExceptionConstants;
  26 
  27 /**
  28  * INVOKESTATIC - Invoke a class (static) method
  29  *
  30  * <PRE>Stack: ..., [arg1, [arg2 ...]] -&gt; ...</PRE>
  31  *
  32  * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  33  */
  34 public class INVOKESTATIC extends InvokeInstruction {
  35   /**
  36    * Empty constructor needed for the Class.newInstance() statement in
  37    * Instruction.readInstruction(). Not to be used otherwise.
  38    */
  39   INVOKESTATIC() {}
  40 
  41   public INVOKESTATIC(int index) {
  42     super(Constants.INVOKESTATIC, index);
  43   }
  44 
  45   public Class[] getExceptions() {
  46     Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
  47 
  48     System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0,
  49                      cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
  50 
  51     cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
  52     cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
  53 
  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.visitINVOKESTATIC(this);
  76   }
  77 }