author | joehw |
Sun, 13 Aug 2017 21:10:40 -0700 | |
changeset 46174 | 5611d2529b49 |
parent 44797 | 8b3b3b911b8a |
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 |
||
24 |
import com.sun.org.apache.bcel.internal.classfile.ConstantPool; |
|
25 |
||
26 |
/** |
|
27 |
* Super class for the GET/PUTxxx family of instructions. |
|
28 |
* |
|
46174 | 29 |
* @version $Id: FieldInstruction.java 1747278 2016-06-07 17:28:43Z britter $ |
6 | 30 |
*/ |
46174 | 31 |
public abstract class FieldInstruction extends FieldOrMethod { |
32 |
||
33 |
/** |
|
34 |
* Empty constructor needed for the Class.newInstance() statement in |
|
35 |
* Instruction.readInstruction(). Not to be used otherwise. |
|
36 |
*/ |
|
37 |
FieldInstruction() { |
|
38 |
} |
|
39 |
||
6 | 40 |
|
46174 | 41 |
/** |
42 |
* @param index to constant pool |
|
43 |
*/ |
|
44 |
protected FieldInstruction(final short opcode, final int index) { |
|
45 |
super(opcode, index); |
|
46 |
} |
|
47 |
||
6 | 48 |
|
46174 | 49 |
/** |
50 |
* @return mnemonic for instruction with symbolic references resolved |
|
51 |
*/ |
|
52 |
@Override |
|
53 |
public String toString( final ConstantPool cp ) { |
|
54 |
return com.sun.org.apache.bcel.internal.Const.getOpcodeName(super.getOpcode()) + " " |
|
55 |
+ cp.constantToString(super.getIndex(), com.sun.org.apache.bcel.internal.Const.CONSTANT_Fieldref); |
|
56 |
} |
|
6 | 57 |
|
46174 | 58 |
|
59 |
/** @return size of field (1 or 2) |
|
60 |
*/ |
|
61 |
protected int getFieldSize( final ConstantPoolGen cpg ) { |
|
62 |
return Type.size(Type.getTypeSize(getSignature(cpg))); |
|
63 |
} |
|
6 | 64 |
|
46174 | 65 |
|
66 |
/** @return return type of referenced field |
|
67 |
*/ |
|
68 |
@Override |
|
69 |
public Type getType( final ConstantPoolGen cpg ) { |
|
70 |
return getFieldType(cpg); |
|
71 |
} |
|
6 | 72 |
|
46174 | 73 |
|
74 |
/** @return type of field |
|
75 |
*/ |
|
76 |
public Type getFieldType( final ConstantPoolGen cpg ) { |
|
77 |
return Type.getType(getSignature(cpg)); |
|
78 |
} |
|
6 | 79 |
|
46174 | 80 |
|
81 |
/** @return name of referenced field. |
|
82 |
*/ |
|
83 |
public String getFieldName( final ConstantPoolGen cpg ) { |
|
84 |
return getName(cpg); |
|
85 |
} |
|
6 | 86 |
} |