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.Const; |
6 | 25 |
|
26 |
/** |
|
27 |
* Returnaddress, the type JSR or JSR_W instructions push upon the stack. |
|
28 |
* |
|
29 |
* see vmspec2 3.3.3 |
|
55496 | 30 |
* @version $Id$ |
6 | 31 |
*/ |
32 |
public class ReturnaddressType extends Type { |
|
33 |
||
46174 | 34 |
public static final ReturnaddressType NO_TARGET = new ReturnaddressType(); |
35 |
private InstructionHandle returnTarget; |
|
36 |
||
6 | 37 |
|
46174 | 38 |
/** |
39 |
* A Returnaddress [that doesn't know where to return to]. |
|
40 |
*/ |
|
41 |
private ReturnaddressType() { |
|
42 |
super(Const.T_ADDRESS, "<return address>"); |
|
43 |
} |
|
44 |
||
6 | 45 |
|
46174 | 46 |
/** |
47 |
* Creates a ReturnaddressType object with a target. |
|
48 |
*/ |
|
49 |
public ReturnaddressType(final InstructionHandle returnTarget) { |
|
50 |
super(Const.T_ADDRESS, "<return address targeting " + returnTarget + ">"); |
|
6 | 51 |
this.returnTarget = returnTarget; |
46174 | 52 |
} |
53 |
||
6 | 54 |
|
46174 | 55 |
/** @return a hash code value for the object. |
56 |
*/ |
|
57 |
@Override |
|
58 |
public int hashCode() { |
|
59 |
if (returnTarget == null) { |
|
60 |
return 0; |
|
61 |
} |
|
62 |
return returnTarget.hashCode(); |
|
63 |
} |
|
64 |
||
17538 | 65 |
|
46174 | 66 |
/** |
67 |
* Returns if the two Returnaddresses refer to the same target. |
|
68 |
*/ |
|
69 |
@Override |
|
70 |
public boolean equals( final Object rat ) { |
|
71 |
if (!(rat instanceof ReturnaddressType)) { |
|
72 |
return false; |
|
73 |
} |
|
74 |
final ReturnaddressType that = (ReturnaddressType) rat; |
|
75 |
if (this.returnTarget == null || that.returnTarget == null) { |
|
76 |
return that.returnTarget == this.returnTarget; |
|
77 |
} |
|
78 |
return that.returnTarget.equals(this.returnTarget); |
|
79 |
} |
|
6 | 80 |
|
81 |
||
46174 | 82 |
/** |
83 |
* @return the target of this ReturnaddressType |
|
84 |
*/ |
|
85 |
public InstructionHandle getTarget() { |
|
86 |
return returnTarget; |
|
87 |
} |
|
6 | 88 |
} |