diff options
| author | 2022-12-07 20:11:41 +0100 | |
|---|---|---|
| committer | 2022-12-07 19:11:41 +0000 | |
| commit | df86dab1abe133b8b7e7e262a2bb5c0baf87f388 (patch) | |
| tree | a1d0602d00bfa21fc857773611e817180382d777 /enigma | |
| parent | Fix constructor references being remapped (#480) (diff) | |
| download | enigma-fork-df86dab1abe133b8b7e7e262a2bb5c0baf87f388.tar.gz enigma-fork-df86dab1abe133b8b7e7e262a2bb5c0baf87f388.tar.xz enigma-fork-df86dab1abe133b8b7e7e262a2bb5c0baf87f388.zip | |
Make enum methods `values` and `valueOf` unmappable (#470)
* Make enum methods `values` and `valueOf` unmappable
* Fix constructor references being remapped
* Fix checkstyle
* Revert "Fix constructor references being remapped"
This reverts commit c65d59c0bcfbecaa31494aa3bd0d493f43bbc099.
Co-authored-by: ByMartrixx <bymartrixx@gmail.com>
Diffstat (limited to 'enigma')
| -rw-r--r-- | enigma/src/main/java/cuchaz/enigma/EnigmaProject.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java b/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java index 15d5e98..48d6736 100644 --- a/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java +++ b/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java | |||
| @@ -38,6 +38,7 @@ import cuchaz.enigma.translation.mapping.EntryRemapper; | |||
| 38 | import cuchaz.enigma.translation.mapping.MappingsChecker; | 38 | import cuchaz.enigma.translation.mapping.MappingsChecker; |
| 39 | import cuchaz.enigma.translation.mapping.tree.DeltaTrackingTree; | 39 | import cuchaz.enigma.translation.mapping.tree.DeltaTrackingTree; |
| 40 | import cuchaz.enigma.translation.mapping.tree.EntryTree; | 40 | import cuchaz.enigma.translation.mapping.tree.EntryTree; |
| 41 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; | ||
| 41 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 42 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 42 | import cuchaz.enigma.translation.representation.entry.Entry; | 43 | import cuchaz.enigma.translation.representation.entry.Entry; |
| 43 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | 44 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; |
| @@ -150,6 +151,16 @@ public class EnigmaProject { | |||
| 150 | return false; | 151 | return false; |
| 151 | } else if (name.equals("wait") && sig.equals("(JI)V")) { | 152 | } else if (name.equals("wait") && sig.equals("(JI)V")) { |
| 152 | return false; | 153 | return false; |
| 154 | } else { | ||
| 155 | ClassDefEntry parent = jarIndex.getEntryIndex().getDefinition(obfMethodEntry.getParent()); | ||
| 156 | |||
| 157 | if (parent != null && parent.getSuperClass() != null && parent.getSuperClass().getFullName().equals("java/lang/Enum")) { | ||
| 158 | if (name.equals("values") && sig.equals("()[L" + parent.getFullName() + ";")) { | ||
| 159 | return false; | ||
| 160 | } else if (name.equals("valueOf") && sig.equals("(Ljava/lang/String;)L" + parent.getFullName() + ";")) { | ||
| 161 | return false; | ||
| 162 | } | ||
| 163 | } | ||
| 153 | } | 164 | } |
| 154 | } else if (obfEntry instanceof LocalVariableEntry && !((LocalVariableEntry) obfEntry).isArgument()) { | 165 | } else if (obfEntry instanceof LocalVariableEntry && !((LocalVariableEntry) obfEntry).isArgument()) { |
| 155 | return false; | 166 | return false; |