author | joehw |
Wed, 26 Jun 2019 05:49:59 +0000 | |
changeset 55496 | 8e0ae3830fca |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
6 | 1 |
/* |
45853
bfa06be36a17
8181154: Fix lint warnings in JAXP repo: deprecation
joehw
parents:
44797
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
6 | 3 |
*/ |
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
4 |
/* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
5 |
* 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
|
6 |
* contributor license agreements. See the NOTICE file distributed with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
7 |
* this work for additional information regarding copyright ownership. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
8 |
* 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
|
9 |
* (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
|
10 |
* 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
|
11 |
* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0 |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
13 |
* |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
14 |
* 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
|
15 |
* 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
|
16 |
* 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
|
17 |
* See the License for the specific language governing permissions and |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
18 |
* limitations under the License. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
19 |
*/ |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
20 |
|
6 | 21 |
package com.sun.org.apache.bcel.internal.generic; |
22 |
||
46174 | 23 |
import java.io.DataOutputStream; |
24 |
import java.io.IOException; |
|
25 |
||
6 | 26 |
import com.sun.org.apache.bcel.internal.util.ByteSequence; |
27 |
||
28 |
/** |
|
29 |
* SIPUSH - Push short |
|
30 |
* |
|
31 |
* <PRE>Stack: ... -> ..., value</PRE> |
|
32 |
* |
|
55496 | 33 |
* @version $Id$ |
6 | 34 |
*/ |
35 |
public class SIPUSH extends Instruction implements ConstantPushInstruction { |
|
46174 | 36 |
|
37 |
private short b; |
|
38 |
||
6 | 39 |
|
46174 | 40 |
/** |
55496 | 41 |
* Empty constructor needed for Instruction.readInstruction. |
42 |
* Not to be used otherwise. |
|
46174 | 43 |
*/ |
44 |
SIPUSH() { |
|
45 |
} |
|
6 | 46 |
|
46174 | 47 |
|
48 |
public SIPUSH(final short b) { |
|
49 |
super(com.sun.org.apache.bcel.internal.Const.SIPUSH, (short) 3); |
|
50 |
this.b = b; |
|
51 |
} |
|
52 |
||
6 | 53 |
|
46174 | 54 |
/** |
55 |
* Dump instruction as short code to stream out. |
|
56 |
*/ |
|
57 |
@Override |
|
58 |
public void dump( final DataOutputStream out ) throws IOException { |
|
59 |
super.dump(out); |
|
60 |
out.writeShort(b); |
|
61 |
} |
|
6 | 62 |
|
46174 | 63 |
|
64 |
/** |
|
65 |
* @return mnemonic for instruction |
|
66 |
*/ |
|
67 |
@Override |
|
68 |
public String toString( final boolean verbose ) { |
|
69 |
return super.toString(verbose) + " " + b; |
|
70 |
} |
|
71 |
||
6 | 72 |
|
46174 | 73 |
/** |
74 |
* Read needed data (e.g. index) from file. |
|
75 |
*/ |
|
76 |
@Override |
|
77 |
protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException { |
|
78 |
super.setLength(3); |
|
79 |
b = bytes.readShort(); |
|
80 |
} |
|
6 | 81 |
|
82 |
||
46174 | 83 |
@Override |
84 |
public Number getValue() { |
|
85 |
return Integer.valueOf(b); |
|
86 |
} |
|
87 |
||
6 | 88 |
|
46174 | 89 |
/** @return Type.SHORT |
90 |
*/ |
|
91 |
@Override |
|
92 |
public Type getType( final ConstantPoolGen cp ) { |
|
93 |
return Type.SHORT; |
|
94 |
} |
|
95 |
||
96 |
||
97 |
/** |
|
98 |
* Call corresponding visitor method(s). The order is: |
|
99 |
* Call visitor methods of implemented interfaces first, then |
|
100 |
* call methods according to the class hierarchy in descending order, |
|
101 |
* i.e., the most specific visitXXX() call comes last. |
|
102 |
* |
|
103 |
* @param v Visitor object |
|
104 |
*/ |
|
105 |
@Override |
|
106 |
public void accept( final Visitor v ) { |
|
107 |
v.visitPushInstruction(this); |
|
108 |
v.visitStackProducer(this); |
|
109 |
v.visitTypedInstruction(this); |
|
110 |
v.visitConstantPushInstruction(this); |
|
111 |
v.visitSIPUSH(this); |
|
112 |
} |
|
6 | 113 |
} |