1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.generic;
18
19 import org.apache.bcel.Const;
20
21
22
23
24
25
26 public class ReturnaddressType extends Type {
27
28 public static final ReturnaddressType NO_TARGET = new ReturnaddressType();
29 private InstructionHandle returnTarget;
30
31
32
33
34 private ReturnaddressType() {
35 super(Const.T_ADDRESS, "<return address>");
36 }
37
38
39
40
41 public ReturnaddressType(final InstructionHandle returnTarget) {
42 super(Const.T_ADDRESS, "<return address targeting " + returnTarget + ">");
43 this.returnTarget = returnTarget;
44 }
45
46
47
48
49 @Override
50 public boolean equals(final Object rat) {
51 if (!(rat instanceof ReturnaddressType)) {
52 return false;
53 }
54 final ReturnaddressType that = (ReturnaddressType) rat;
55 if (this.returnTarget == null || that.returnTarget == null) {
56 return that.returnTarget == this.returnTarget;
57 }
58 return that.returnTarget.equals(this.returnTarget);
59 }
60
61
62
63
64 public InstructionHandle getTarget() {
65 return returnTarget;
66 }
67
68
69
70
71 @Override
72 public int hashCode() {
73 if (returnTarget == null) {
74 return 0;
75 }
76 return returnTarget.hashCode();
77 }
78 }