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.classfile.ConstantCP;
25 import com.sun.org.apache.bcel.internal.classfile.ConstantNameAndType;
26 import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
27 import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
28
29 /**
30 * Super class for FieldOrMethod and INVOKEDYNAMIC, since they both have
31 * names and signatures
32 *
33 * @version $Id: FieldOrMethod.java 1481383 2013-05-11 17:34:32Z dbrosius $
34 * @since 6.0
35 */
36 public abstract class NameSignatureInstruction extends CPInstruction {
37
38 public NameSignatureInstruction() {
39 super();
40 }
41
42 public NameSignatureInstruction(final short opcode, final int index) {
43 super(opcode, index);
44 }
45
46 public ConstantNameAndType getNameAndType(final ConstantPoolGen cpg) {
47 final ConstantPool cp = cpg.getConstantPool();
48 final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex());
49 return (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
50 }
51 /** @return signature of referenced method/field.
52 */
53 public String getSignature(final ConstantPoolGen cpg) {
|
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.classfile.ConstantCP;
25 import com.sun.org.apache.bcel.internal.classfile.ConstantNameAndType;
26 import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
27 import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
28
29 /**
30 * Super class for FieldOrMethod and INVOKEDYNAMIC, since they both have
31 * names and signatures
32 *
33 * @since 6.0
34 */
35 public abstract class NameSignatureInstruction extends CPInstruction {
36
37 public NameSignatureInstruction() {
38 super();
39 }
40
41 public NameSignatureInstruction(final short opcode, final int index) {
42 super(opcode, index);
43 }
44
45 public ConstantNameAndType getNameAndType(final ConstantPoolGen cpg) {
46 final ConstantPool cp = cpg.getConstantPool();
47 final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex());
48 return (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
49 }
50 /** @return signature of referenced method/field.
51 */
52 public String getSignature(final ConstantPoolGen cpg) {
|