diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/EntryReference.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/EntryReference.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/EntryReference.java b/src/main/java/cuchaz/enigma/analysis/EntryReference.java index e122210..2e738c0 100644 --- a/src/main/java/cuchaz/enigma/analysis/EntryReference.java +++ b/src/main/java/cuchaz/enigma/analysis/EntryReference.java | |||
| @@ -29,6 +29,7 @@ public class EntryReference<E extends Entry<?>, C extends Entry<?>> implements T | |||
| 29 | private static final List<String> CONSTRUCTOR_NON_NAMES = Arrays.asList("this", "super", "static"); | 29 | private static final List<String> CONSTRUCTOR_NON_NAMES = Arrays.asList("this", "super", "static"); |
| 30 | public E entry; | 30 | public E entry; |
| 31 | public C context; | 31 | public C context; |
| 32 | public ReferenceTargetType targetType; | ||
| 32 | 33 | ||
| 33 | private boolean sourceName; | 34 | private boolean sourceName; |
| 34 | 35 | ||
| @@ -37,12 +38,17 @@ public class EntryReference<E extends Entry<?>, C extends Entry<?>> implements T | |||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | public EntryReference(E entry, String sourceName, C context) { | 40 | public EntryReference(E entry, String sourceName, C context) { |
| 41 | this(entry, sourceName, context, ReferenceTargetType.none()); | ||
| 42 | } | ||
| 43 | |||
| 44 | public EntryReference(E entry, String sourceName, C context, ReferenceTargetType targetType) { | ||
| 40 | if (entry == null) { | 45 | if (entry == null) { |
| 41 | throw new IllegalArgumentException("Entry cannot be null!"); | 46 | throw new IllegalArgumentException("Entry cannot be null!"); |
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | this.entry = entry; | 49 | this.entry = entry; |
| 45 | this.context = context; | 50 | this.context = context; |
| 51 | this.targetType = targetType; | ||
| 46 | 52 | ||
| 47 | this.sourceName = sourceName != null && !sourceName.isEmpty(); | 53 | this.sourceName = sourceName != null && !sourceName.isEmpty(); |
| 48 | if (entry instanceof MethodEntry && ((MethodEntry) entry).isConstructor() && CONSTRUCTOR_NON_NAMES.contains(sourceName)) { | 54 | if (entry instanceof MethodEntry && ((MethodEntry) entry).isConstructor() && CONSTRUCTOR_NON_NAMES.contains(sourceName)) { |
| @@ -54,6 +60,7 @@ public class EntryReference<E extends Entry<?>, C extends Entry<?>> implements T | |||
| 54 | this.entry = entry; | 60 | this.entry = entry; |
| 55 | this.context = context; | 61 | this.context = context; |
| 56 | this.sourceName = other.sourceName; | 62 | this.sourceName = other.sourceName; |
| 63 | this.targetType = other.targetType; | ||
| 57 | } | 64 | } |
| 58 | 65 | ||
| 59 | public ClassEntry getLocationClassEntry() { | 66 | public ClassEntry getLocationClassEntry() { |
| @@ -112,10 +119,17 @@ public class EntryReference<E extends Entry<?>, C extends Entry<?>> implements T | |||
| 112 | public String toString() { | 119 | public String toString() { |
| 113 | StringBuilder buf = new StringBuilder(); | 120 | StringBuilder buf = new StringBuilder(); |
| 114 | buf.append(entry); | 121 | buf.append(entry); |
| 122 | |||
| 115 | if (context != null) { | 123 | if (context != null) { |
| 116 | buf.append(" called from "); | 124 | buf.append(" called from "); |
| 117 | buf.append(context); | 125 | buf.append(context); |
| 118 | } | 126 | } |
| 127 | |||
| 128 | if (targetType != null && targetType.getKind() != ReferenceTargetType.Kind.NONE) { | ||
| 129 | buf.append(" on target of type "); | ||
| 130 | buf.append(targetType); | ||
| 131 | } | ||
| 132 | |||
| 119 | return buf.toString(); | 133 | return buf.toString(); |
| 120 | } | 134 | } |
| 121 | 135 | ||