author | joehw |
Wed, 26 Jun 2019 05:49:59 +0000 | |
changeset 55496 | 8e0ae3830fca |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
6 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
4 |
*/ |
|
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
5 |
/* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
7 |
* contributor license agreements. See the NOTICE file distributed with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
8 |
* this work for additional information regarding copyright ownership. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
9 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
10 |
* (the "License"); you may not use this file except in compliance with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
11 |
* the License. You may obtain a copy of the License at |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
12 |
* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
14 |
* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
15 |
* Unless required by applicable law or agreed to in writing, software |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
16 |
* distributed under the License is distributed on an "AS IS" BASIS, |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
17 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
18 |
* See the License for the specific language governing permissions and |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
19 |
* limitations under the License. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
20 |
*/ |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
21 |
|
6 | 22 |
package com.sun.org.apache.bcel.internal.generic; |
23 |
||
46174 | 24 |
import com.sun.org.apache.bcel.internal.ExceptionConst; |
6 | 25 |
|
26 |
/** |
|
27 |
* Super class for instructions dealing with array access such as IALOAD. |
|
28 |
* |
|
55496 | 29 |
* @version $Id$ |
6 | 30 |
*/ |
46174 | 31 |
public abstract class ArrayInstruction extends Instruction implements ExceptionThrower, |
32 |
TypedInstruction { |
|
33 |
||
34 |
/** |
|
55496 | 35 |
* Empty constructor needed for Instruction.readInstruction. |
36 |
* Not to be used otherwise. |
|
46174 | 37 |
*/ |
38 |
ArrayInstruction() { |
|
39 |
} |
|
40 |
||
6 | 41 |
|
46174 | 42 |
/** |
43 |
* @param opcode of instruction |
|
44 |
*/ |
|
45 |
protected ArrayInstruction(final short opcode) { |
|
46 |
super(opcode, (short) 1); |
|
47 |
} |
|
6 | 48 |
|
46174 | 49 |
|
50 |
@Override |
|
51 |
public Class<?>[] getExceptions() { |
|
52 |
return ExceptionConst.createExceptions(ExceptionConst.EXCS.EXCS_ARRAY_EXCEPTION); |
|
53 |
} |
|
54 |
||
6 | 55 |
|
46174 | 56 |
/** @return type associated with the instruction |
57 |
*/ |
|
58 |
@Override |
|
59 |
public Type getType( final ConstantPoolGen cp ) { |
|
60 |
final short _opcode = super.getOpcode(); |
|
61 |
switch (_opcode) { |
|
62 |
case com.sun.org.apache.bcel.internal.Const.IALOAD: |
|
63 |
case com.sun.org.apache.bcel.internal.Const.IASTORE: |
|
64 |
return Type.INT; |
|
65 |
case com.sun.org.apache.bcel.internal.Const.CALOAD: |
|
66 |
case com.sun.org.apache.bcel.internal.Const.CASTORE: |
|
67 |
return Type.CHAR; |
|
68 |
case com.sun.org.apache.bcel.internal.Const.BALOAD: |
|
69 |
case com.sun.org.apache.bcel.internal.Const.BASTORE: |
|
70 |
return Type.BYTE; |
|
71 |
case com.sun.org.apache.bcel.internal.Const.SALOAD: |
|
72 |
case com.sun.org.apache.bcel.internal.Const.SASTORE: |
|
73 |
return Type.SHORT; |
|
74 |
case com.sun.org.apache.bcel.internal.Const.LALOAD: |
|
75 |
case com.sun.org.apache.bcel.internal.Const.LASTORE: |
|
76 |
return Type.LONG; |
|
77 |
case com.sun.org.apache.bcel.internal.Const.DALOAD: |
|
78 |
case com.sun.org.apache.bcel.internal.Const.DASTORE: |
|
79 |
return Type.DOUBLE; |
|
80 |
case com.sun.org.apache.bcel.internal.Const.FALOAD: |
|
81 |
case com.sun.org.apache.bcel.internal.Const.FASTORE: |
|
82 |
return Type.FLOAT; |
|
83 |
case com.sun.org.apache.bcel.internal.Const.AALOAD: |
|
84 |
case com.sun.org.apache.bcel.internal.Const.AASTORE: |
|
85 |
return Type.OBJECT; |
|
86 |
default: |
|
87 |
throw new ClassGenException("Oops: unknown case in switch" + _opcode); |
|
88 |
} |
|
6 | 89 |
} |
90 |
} |