jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/GETSTATIC.java
changeset 46174 5611d2529b49
parent 44797 8b3b3b911b8a
equal deleted inserted replaced
46173:5546b5710844 46174:5611d2529b49
    19  * limitations under the License.
    19  * limitations under the License.
    20  */
    20  */
    21 
    21 
    22 package com.sun.org.apache.bcel.internal.generic;
    22 package com.sun.org.apache.bcel.internal.generic;
    23 
    23 
    24 
    24 import com.sun.org.apache.bcel.internal.Const;
    25 import com.sun.org.apache.bcel.internal.Constants;
    25 import com.sun.org.apache.bcel.internal.ExceptionConst;
    26 import com.sun.org.apache.bcel.internal.ExceptionConstants;
       
    27 
    26 
    28 /**
    27 /**
    29  * GETSTATIC - Fetch static field from class
    28  * GETSTATIC - Fetch static field from class
    30  * <PRE>Stack: ..., -&gt; ..., value</PRE>
    29  * <PRE>Stack: ..., -&gt; ..., value</PRE>
    31  * OR
    30  * OR
    32  * <PRE>Stack: ..., -&gt; ..., value.word1, value.word2</PRE>
    31  * <PRE>Stack: ..., -&gt; ..., value.word1, value.word2</PRE>
    33  *
    32  *
    34  * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
    33  * @version $Id: GETSTATIC.java 1747278 2016-06-07 17:28:43Z britter $
    35  */
    34  */
    36 public class GETSTATIC extends FieldInstruction implements PushInstruction, ExceptionThrower {
    35 public class GETSTATIC extends FieldInstruction implements PushInstruction, ExceptionThrower {
    37   /**
       
    38    * Empty constructor needed for the Class.newInstance() statement in
       
    39    * Instruction.readInstruction(). Not to be used otherwise.
       
    40    */
       
    41   GETSTATIC() {}
       
    42 
    36 
    43   public GETSTATIC(int index) {
    37     /**
    44     super(Constants.GETSTATIC, index);
    38      * Empty constructor needed for the Class.newInstance() statement in
    45   }
    39      * Instruction.readInstruction(). Not to be used otherwise.
    46 
    40      */
    47   public int produceStack(ConstantPoolGen cpg) { return getFieldSize(cpg); }
    41     GETSTATIC() {
    48 
    42     }
    49   public Class[] getExceptions() {
       
    50     Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
       
    51 
       
    52     System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0,
       
    53                      cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
       
    54     cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] =
       
    55       ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
       
    56 
       
    57     return cs;
       
    58   }
       
    59 
    43 
    60 
    44 
    61   /**
    45     public GETSTATIC(final int index) {
    62    * Call corresponding visitor method(s). The order is:
    46         super(Const.GETSTATIC, index);
    63    * Call visitor methods of implemented interfaces first, then
    47     }
    64    * call methods according to the class hierarchy in descending order,
    48 
    65    * i.e., the most specific visitXXX() call comes last.
    49 
    66    *
    50     @Override
    67    * @param v Visitor object
    51     public int produceStack( final ConstantPoolGen cpg ) {
    68    */
    52         return getFieldSize(cpg);
    69   public void accept(Visitor v) {
    53     }
    70     v.visitStackProducer(this);
    54 
    71     v.visitPushInstruction(this);
    55 
    72     v.visitExceptionThrower(this);
    56     @Override
    73     v.visitTypedInstruction(this);
    57     public Class<?>[] getExceptions() {
    74     v.visitLoadClass(this);
    58         return ExceptionConst.createExceptions(ExceptionConst.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
    75     v.visitCPInstruction(this);
    59             ExceptionConst.INCOMPATIBLE_CLASS_CHANGE_ERROR);
    76     v.visitFieldOrMethod(this);
    60     }
    77     v.visitFieldInstruction(this);
    61 
    78     v.visitGETSTATIC(this);
    62 
    79   }
    63     /**
       
    64      * Call corresponding visitor method(s). The order is:
       
    65      * Call visitor methods of implemented interfaces first, then
       
    66      * call methods according to the class hierarchy in descending order,
       
    67      * i.e., the most specific visitXXX() call comes last.
       
    68      *
       
    69      * @param v Visitor object
       
    70      */
       
    71     @Override
       
    72     public void accept( final Visitor v ) {
       
    73         v.visitStackProducer(this);
       
    74         v.visitPushInstruction(this);
       
    75         v.visitExceptionThrower(this);
       
    76         v.visitTypedInstruction(this);
       
    77         v.visitLoadClass(this);
       
    78         v.visitCPInstruction(this);
       
    79         v.visitFieldOrMethod(this);
       
    80         v.visitFieldInstruction(this);
       
    81         v.visitGETSTATIC(this);
       
    82     }
    80 }
    83 }