diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/bytecode')
| -rw-r--r-- | src/main/java/cuchaz/enigma/bytecode/AccessFlags.java | 27 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/bytecode/translators/TranslationClassVisitor.java | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/bytecode/AccessFlags.java b/src/main/java/cuchaz/enigma/bytecode/AccessFlags.java index 0bfc59b..31c8691 100644 --- a/src/main/java/cuchaz/enigma/bytecode/AccessFlags.java +++ b/src/main/java/cuchaz/enigma/bytecode/AccessFlags.java | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | package cuchaz.enigma.bytecode; | 1 | package cuchaz.enigma.bytecode; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.analysis.Access; | ||
| 3 | import org.objectweb.asm.Opcodes; | 4 | import org.objectweb.asm.Opcodes; |
| 4 | 5 | ||
| 5 | import java.lang.reflect.Modifier; | 6 | import java.lang.reflect.Modifier; |
| @@ -35,6 +36,10 @@ public class AccessFlags { | |||
| 35 | return (flags & Opcodes.ACC_ENUM) != 0; | 36 | return (flags & Opcodes.ACC_ENUM) != 0; |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 39 | public boolean isBridge() { | ||
| 40 | return (flags & Opcodes.ACC_BRIDGE) != 0; | ||
| 41 | } | ||
| 42 | |||
| 38 | public AccessFlags setPrivate() { | 43 | public AccessFlags setPrivate() { |
| 39 | this.setVisibility(Opcodes.ACC_PRIVATE); | 44 | this.setVisibility(Opcodes.ACC_PRIVATE); |
| 40 | return this; | 45 | return this; |
| @@ -50,11 +55,16 @@ public class AccessFlags { | |||
| 50 | return this; | 55 | return this; |
| 51 | } | 56 | } |
| 52 | 57 | ||
| 53 | public AccessFlags setBridged() { | 58 | public AccessFlags setBridge() { |
| 54 | flags |= Opcodes.ACC_BRIDGE; | 59 | flags |= Opcodes.ACC_BRIDGE; |
| 55 | return this; | 60 | return this; |
| 56 | } | 61 | } |
| 57 | 62 | ||
| 63 | @Deprecated | ||
| 64 | public AccessFlags setBridged() { | ||
| 65 | return setBridge(); | ||
| 66 | } | ||
| 67 | |||
| 58 | public void setVisibility(int visibility) { | 68 | public void setVisibility(int visibility) { |
| 59 | this.resetVisibility(); | 69 | this.resetVisibility(); |
| 60 | this.flags |= visibility; | 70 | this.flags |= visibility; |
| @@ -77,4 +87,19 @@ public class AccessFlags { | |||
| 77 | public int hashCode() { | 87 | public int hashCode() { |
| 78 | return flags; | 88 | return flags; |
| 79 | } | 89 | } |
| 90 | |||
| 91 | @Override | ||
| 92 | public String toString() { | ||
| 93 | StringBuilder builder = new StringBuilder(Access.get(this).toString().toLowerCase()); | ||
| 94 | if (isStatic()) { | ||
| 95 | builder.append(" static"); | ||
| 96 | } | ||
| 97 | if (isSynthetic()) { | ||
| 98 | builder.append(" synthetic"); | ||
| 99 | } | ||
| 100 | if (isBridge()) { | ||
| 101 | builder.append(" bridge"); | ||
| 102 | } | ||
| 103 | return builder.toString(); | ||
| 104 | } | ||
| 80 | } | 105 | } |
diff --git a/src/main/java/cuchaz/enigma/bytecode/translators/TranslationClassVisitor.java b/src/main/java/cuchaz/enigma/bytecode/translators/TranslationClassVisitor.java index 234d11f..5b16138 100644 --- a/src/main/java/cuchaz/enigma/bytecode/translators/TranslationClassVisitor.java +++ b/src/main/java/cuchaz/enigma/bytecode/translators/TranslationClassVisitor.java | |||
| @@ -61,7 +61,7 @@ public class TranslationClassVisitor extends ClassVisitor { | |||
| 61 | MethodDefEntry entry = new MethodDefEntry(obfClassEntry, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access)); | 61 | MethodDefEntry entry = new MethodDefEntry(obfClassEntry, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access)); |
| 62 | MethodDefEntry translatedEntry = translator.getTranslatedMethodDef(entry); | 62 | MethodDefEntry translatedEntry = translator.getTranslatedMethodDef(entry); |
| 63 | if (jarIndex.getBridgedMethod(entry) != null) { | 63 | if (jarIndex.getBridgedMethod(entry) != null) { |
| 64 | translatedEntry.getAccess().setBridged(); | 64 | translatedEntry.getAccess().setBridge(); |
| 65 | } | 65 | } |
| 66 | String[] translatedExceptions = new String[exceptions.length]; | 66 | String[] translatedExceptions = new String[exceptions.length]; |
| 67 | for (int i = 0; i < exceptions.length; i++) { | 67 | for (int i = 0; i < exceptions.length; i++) { |