diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/entry')
4 files changed, 32 insertions, 7 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java index 75e7f1b..ac1fe2a 100644 --- a/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java | |||
| @@ -13,16 +13,24 @@ package cuchaz.enigma.mapping.entry; | |||
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import cuchaz.enigma.bytecode.AccessFlags; | 15 | import cuchaz.enigma.bytecode.AccessFlags; |
| 16 | import cuchaz.enigma.mapping.Signature; | ||
| 16 | 17 | ||
| 17 | public class ClassDefEntry extends ClassEntry { | 18 | public class ClassDefEntry extends ClassEntry { |
| 18 | private final AccessFlags access; | 19 | private final AccessFlags access; |
| 20 | private final Signature signature; | ||
| 19 | 21 | ||
| 20 | public ClassDefEntry(String className, AccessFlags access) { | 22 | public ClassDefEntry(String className, Signature signature, AccessFlags access) { |
| 21 | super(className); | 23 | super(className); |
| 24 | Preconditions.checkNotNull(signature, "Class signature cannot be null"); | ||
| 22 | Preconditions.checkNotNull(access, "Class access cannot be null"); | 25 | Preconditions.checkNotNull(access, "Class access cannot be null"); |
| 26 | this.signature = signature; | ||
| 23 | this.access = access; | 27 | this.access = access; |
| 24 | } | 28 | } |
| 25 | 29 | ||
| 30 | public Signature getSignature() { | ||
| 31 | return signature; | ||
| 32 | } | ||
| 33 | |||
| 26 | public AccessFlags getAccess() { | 34 | public AccessFlags getAccess() { |
| 27 | return access; | 35 | return access; |
| 28 | } | 36 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java index 78ea5f7..d18115b 100644 --- a/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java | |||
| @@ -13,23 +13,31 @@ package cuchaz.enigma.mapping.entry; | |||
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import cuchaz.enigma.bytecode.AccessFlags; | 15 | import cuchaz.enigma.bytecode.AccessFlags; |
| 16 | import cuchaz.enigma.mapping.Signature; | ||
| 16 | import cuchaz.enigma.mapping.TypeDescriptor; | 17 | import cuchaz.enigma.mapping.TypeDescriptor; |
| 17 | 18 | ||
| 18 | public class FieldDefEntry extends FieldEntry { | 19 | public class FieldDefEntry extends FieldEntry { |
| 19 | private final AccessFlags access; | 20 | private final AccessFlags access; |
| 21 | private final Signature signature; | ||
| 20 | 22 | ||
| 21 | public FieldDefEntry(ClassEntry ownerEntry, String name, TypeDescriptor desc, AccessFlags access) { | 23 | public FieldDefEntry(ClassEntry ownerEntry, String name, TypeDescriptor desc, Signature signature, AccessFlags access) { |
| 22 | super(ownerEntry, name, desc); | 24 | super(ownerEntry, name, desc); |
| 23 | Preconditions.checkNotNull(access, "Field access cannot be null"); | 25 | Preconditions.checkNotNull(access, "Field access cannot be null"); |
| 26 | Preconditions.checkNotNull(signature, "Field signature cannot be null"); | ||
| 24 | this.access = access; | 27 | this.access = access; |
| 28 | this.signature = signature; | ||
| 25 | } | 29 | } |
| 26 | 30 | ||
| 27 | public AccessFlags getAccess() { | 31 | public AccessFlags getAccess() { |
| 28 | return access; | 32 | return access; |
| 29 | } | 33 | } |
| 30 | 34 | ||
| 35 | public Signature getSignature() { | ||
| 36 | return signature; | ||
| 37 | } | ||
| 38 | |||
| 31 | @Override | 39 | @Override |
| 32 | public FieldDefEntry updateOwnership(ClassEntry owner) { | 40 | public FieldDefEntry updateOwnership(ClassEntry owner) { |
| 33 | return new FieldDefEntry(owner, this.name, this.desc, access); | 41 | return new FieldDefEntry(owner, this.name, this.desc, signature, access); |
| 34 | } | 42 | } |
| 35 | } | 43 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java index 1d2c094..ec3af69 100644 --- a/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java | |||
| @@ -14,23 +14,31 @@ package cuchaz.enigma.mapping.entry; | |||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import cuchaz.enigma.bytecode.AccessFlags; | 15 | import cuchaz.enigma.bytecode.AccessFlags; |
| 16 | import cuchaz.enigma.mapping.MethodDescriptor; | 16 | import cuchaz.enigma.mapping.MethodDescriptor; |
| 17 | import cuchaz.enigma.mapping.Signature; | ||
| 17 | 18 | ||
| 18 | public class MethodDefEntry extends MethodEntry { | 19 | public class MethodDefEntry extends MethodEntry { |
| 19 | 20 | ||
| 20 | private final AccessFlags access; | 21 | private final AccessFlags access; |
| 22 | private final Signature signature; | ||
| 21 | 23 | ||
| 22 | public MethodDefEntry(ClassEntry classEntry, String name, MethodDescriptor descriptor, AccessFlags access) { | 24 | public MethodDefEntry(ClassEntry classEntry, String name, MethodDescriptor descriptor, Signature signature, AccessFlags access) { |
| 23 | super(classEntry, name, descriptor); | 25 | super(classEntry, name, descriptor); |
| 24 | Preconditions.checkNotNull(access, "Method access cannot be null"); | 26 | Preconditions.checkNotNull(access, "Method access cannot be null"); |
| 27 | Preconditions.checkNotNull(signature, "Method signature cannot be null"); | ||
| 25 | this.access = access; | 28 | this.access = access; |
| 29 | this.signature = signature; | ||
| 26 | } | 30 | } |
| 27 | 31 | ||
| 28 | public AccessFlags getAccess() { | 32 | public AccessFlags getAccess() { |
| 29 | return access; | 33 | return access; |
| 30 | } | 34 | } |
| 31 | 35 | ||
| 36 | public Signature getSignature() { | ||
| 37 | return signature; | ||
| 38 | } | ||
| 39 | |||
| 32 | @Override | 40 | @Override |
| 33 | public MethodDefEntry updateOwnership(ClassEntry classEntry) { | 41 | public MethodDefEntry updateOwnership(ClassEntry classEntry) { |
| 34 | return new MethodDefEntry(new ClassEntry(classEntry.getName()), name, descriptor, access); | 42 | return new MethodDefEntry(new ClassEntry(classEntry.getName()), name, descriptor, signature, access); |
| 35 | } | 43 | } |
| 36 | } | 44 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/ProcyonEntryFactory.java b/src/main/java/cuchaz/enigma/mapping/entry/ProcyonEntryFactory.java index e42a334..5892a03 100644 --- a/src/main/java/cuchaz/enigma/mapping/entry/ProcyonEntryFactory.java +++ b/src/main/java/cuchaz/enigma/mapping/entry/ProcyonEntryFactory.java | |||
| @@ -14,6 +14,7 @@ package cuchaz.enigma.mapping.entry; | |||
| 14 | import com.strobel.assembler.metadata.*; | 14 | import com.strobel.assembler.metadata.*; |
| 15 | import cuchaz.enigma.bytecode.AccessFlags; | 15 | import cuchaz.enigma.bytecode.AccessFlags; |
| 16 | import cuchaz.enigma.mapping.MethodDescriptor; | 16 | import cuchaz.enigma.mapping.MethodDescriptor; |
| 17 | import cuchaz.enigma.mapping.Signature; | ||
| 17 | import cuchaz.enigma.mapping.TypeDescriptor; | 18 | import cuchaz.enigma.mapping.TypeDescriptor; |
| 18 | 19 | ||
| 19 | import java.util.List; | 20 | import java.util.List; |
| @@ -56,7 +57,7 @@ public class ProcyonEntryFactory { | |||
| 56 | 57 | ||
| 57 | public FieldDefEntry getFieldDefEntry(FieldDefinition def) { | 58 | public FieldDefEntry getFieldDefEntry(FieldDefinition def) { |
| 58 | ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName()); | 59 | ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName()); |
| 59 | return new FieldDefEntry(classEntry, def.getName(), new TypeDescriptor(def.getErasedSignature()), new AccessFlags(def.getModifiers())); | 60 | return new FieldDefEntry(classEntry, def.getName(), new TypeDescriptor(def.getErasedSignature()), Signature.createTypedSignature(def.getSignature()), new AccessFlags(def.getModifiers())); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | public MethodEntry getMethodEntry(MemberReference def) { | 63 | public MethodEntry getMethodEntry(MemberReference def) { |
| @@ -66,6 +67,6 @@ public class ProcyonEntryFactory { | |||
| 66 | 67 | ||
| 67 | public MethodDefEntry getMethodDefEntry(MethodDefinition def) { | 68 | public MethodDefEntry getMethodDefEntry(MethodDefinition def) { |
| 68 | ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName()); | 69 | ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName()); |
| 69 | return new MethodDefEntry(classEntry, def.getName(), new MethodDescriptor(def.getErasedSignature()), new AccessFlags(def.getModifiers())); | 70 | return new MethodDefEntry(classEntry, def.getName(), new MethodDescriptor(def.getErasedSignature()), Signature.createSignature(def.getSignature()), new AccessFlags(def.getModifiers())); |
| 70 | } | 71 | } |
| 71 | } | 72 | } |