1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| package com.jeantessier.classreader.impl; |
34 |
| |
35 |
| import java.io.*; |
36 |
| |
37 |
| import com.jeantessier.classreader.*; |
38 |
| |
39 |
| public class MethodRef_info extends FeatureRef_info implements com.jeantessier.classreader.MethodRef_info { |
40 |
3145
| public MethodRef_info(ConstantPool constantPool, DataInput in) throws IOException {
|
41 |
3145
| super(constantPool, in);
|
42 |
| } |
43 |
| |
44 |
3851
| public boolean isConstructor() {
|
45 |
3851
| return getRawNameAndType().getName().equals("<init>");
|
46 |
| } |
47 |
| |
48 |
7010
| public boolean isStaticInitializer() {
|
49 |
7010
| return getRawNameAndType().getName().equals("<clinit>");
|
50 |
| } |
51 |
| |
52 |
0
| public String getReturnType() {
|
53 |
0
| return DescriptorHelper.getReturnType(getRawNameAndType().getType());
|
54 |
| } |
55 |
| |
56 |
3827
| public String getName() {
|
57 |
3827
| String result;
|
58 |
| |
59 |
3827
| if (isConstructor()) {
|
60 |
719
| result = getClassSimpleName();
|
61 |
3108
| } else if (isStaticInitializer()) {
|
62 |
0
| result = "static {}";
|
63 |
| } else { |
64 |
3108
| result = getRawNameAndType().getName();
|
65 |
| } |
66 |
| |
67 |
3827
| return result;
|
68 |
| } |
69 |
| |
70 |
3827
| public String getSignature() {
|
71 |
3827
| StringBuilder result = new StringBuilder();
|
72 |
| |
73 |
3827
| result.append(getName());
|
74 |
3827
| if (!isStaticInitializer()) {
|
75 |
3827
| result.append(DescriptorHelper.getSignature(getRawNameAndType().getType()));
|
76 |
| } |
77 |
| |
78 |
3827
| return result.toString();
|
79 |
| } |
80 |
| |
81 |
3843
| public void accept(Visitor visitor) {
|
82 |
3843
| visitor.visitMethodRef_info(this);
|
83 |
| } |
84 |
| |
85 |
0
| public String toString() {
|
86 |
0
| StringBuilder result = new StringBuilder();
|
87 |
| |
88 |
0
| if (!isConstructor() && !isStaticInitializer()) {
|
89 |
0
| result.append(getReturnType());
|
90 |
0
| result.append(" ");
|
91 |
| } |
92 |
0
| result.append(getFullSignature());
|
93 |
| |
94 |
0
| return result.toString();
|
95 |
| } |
96 |
| } |