diff options
| author | 2019-03-16 09:45:42 +0200 | |
|---|---|---|
| committer | 2019-03-16 09:45:42 +0200 | |
| commit | 19a77fbb472592e116f2f6654657eeec81d40b18 (patch) | |
| tree | e15a39e89887ee8a478ee8c8b7d8cb4b4b64668b /src/main/java/cuchaz/enigma/translation/representation | |
| parent | Adds a red highlight for overridden methods in method inheritance tree gui (#... (diff) | |
| download | enigma-fork-19a77fbb472592e116f2f6654657eeec81d40b18.tar.gz enigma-fork-19a77fbb472592e116f2f6654657eeec81d40b18.tar.xz enigma-fork-19a77fbb472592e116f2f6654657eeec81d40b18.zip | |
Index lambda local variables to correct declaring method
Diffstat (limited to 'src/main/java/cuchaz/enigma/translation/representation')
3 files changed, 18 insertions, 39 deletions
diff --git a/src/main/java/cuchaz/enigma/translation/representation/ProcyonEntryFactory.java b/src/main/java/cuchaz/enigma/translation/representation/ProcyonEntryFactory.java deleted file mode 100644 index a9ec5fa..0000000 --- a/src/main/java/cuchaz/enigma/translation/representation/ProcyonEntryFactory.java +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.translation.representation; | ||
| 13 | |||
| 14 | import com.strobel.assembler.metadata.FieldDefinition; | ||
| 15 | import com.strobel.assembler.metadata.MemberReference; | ||
| 16 | import com.strobel.assembler.metadata.MethodDefinition; | ||
| 17 | import cuchaz.enigma.translation.representation.entry.*; | ||
| 18 | |||
| 19 | public class ProcyonEntryFactory { | ||
| 20 | public FieldEntry getFieldEntry(MemberReference def) { | ||
| 21 | ClassEntry classEntry = new ClassEntry(def.getDeclaringType().getInternalName()); | ||
| 22 | return new FieldEntry(classEntry, def.getName(), new TypeDescriptor(def.getErasedSignature())); | ||
| 23 | } | ||
| 24 | |||
| 25 | public FieldDefEntry getFieldDefEntry(FieldDefinition def) { | ||
| 26 | ClassEntry classEntry = new ClassEntry(def.getDeclaringType().getInternalName()); | ||
| 27 | return new FieldDefEntry(classEntry, def.getName(), new TypeDescriptor(def.getErasedSignature()), Signature.createTypedSignature(def.getSignature()), new AccessFlags(def.getModifiers())); | ||
| 28 | } | ||
| 29 | |||
| 30 | public MethodEntry getMethodEntry(MemberReference def) { | ||
| 31 | ClassEntry classEntry = new ClassEntry(def.getDeclaringType().getInternalName()); | ||
| 32 | return new MethodEntry(classEntry, def.getName(), new MethodDescriptor(def.getErasedSignature())); | ||
| 33 | } | ||
| 34 | |||
| 35 | public MethodDefEntry getMethodDefEntry(MethodDefinition def) { | ||
| 36 | ClassEntry classEntry = new ClassEntry(def.getDeclaringType().getInternalName()); | ||
| 37 | return new MethodDefEntry(classEntry, def.getName(), new MethodDescriptor(def.getErasedSignature()), Signature.createSignature(def.getSignature()), new AccessFlags(def.getModifiers())); | ||
| 38 | } | ||
| 39 | } | ||
diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java index 2703301..74176fd 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.strobel.assembler.metadata.FieldDefinition; | ||
| 15 | import cuchaz.enigma.translation.Translator; | 16 | import cuchaz.enigma.translation.Translator; |
| 16 | import cuchaz.enigma.translation.mapping.EntryMapping; | 17 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 17 | import cuchaz.enigma.translation.representation.AccessFlags; | 18 | import cuchaz.enigma.translation.representation.AccessFlags; |
| @@ -36,6 +37,14 @@ public class FieldDefEntry extends FieldEntry implements DefEntry<ClassEntry> { | |||
| 36 | return new FieldDefEntry(owner, name, new TypeDescriptor(desc), Signature.createTypedSignature(signature), new AccessFlags(access)); | 37 | return new FieldDefEntry(owner, name, new TypeDescriptor(desc), Signature.createTypedSignature(signature), new AccessFlags(access)); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | public static FieldDefEntry parse(FieldDefinition definition) { | ||
| 41 | ClassEntry owner = ClassEntry.parse(definition.getDeclaringType()); | ||
| 42 | TypeDescriptor descriptor = new TypeDescriptor(definition.getErasedSignature()); | ||
| 43 | Signature signature = Signature.createTypedSignature(definition.getSignature()); | ||
| 44 | AccessFlags access = new AccessFlags(definition.getModifiers()); | ||
| 45 | return new FieldDefEntry(owner, definition.getName(), descriptor, signature, access); | ||
| 46 | } | ||
| 47 | |||
| 39 | @Override | 48 | @Override |
| 40 | public AccessFlags getAccess() { | 49 | public AccessFlags getAccess() { |
| 41 | return access; | 50 | return access; |
diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java index 5184244..bbcaf23 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.strobel.assembler.metadata.MethodDefinition; | ||
| 15 | import cuchaz.enigma.translation.Translator; | 16 | import cuchaz.enigma.translation.Translator; |
| 16 | import cuchaz.enigma.translation.mapping.EntryMapping; | 17 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 17 | import cuchaz.enigma.translation.representation.AccessFlags; | 18 | import cuchaz.enigma.translation.representation.AccessFlags; |
| @@ -36,6 +37,14 @@ public class MethodDefEntry extends MethodEntry implements DefEntry<ClassEntry> | |||
| 36 | return new MethodDefEntry(owner, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access)); | 37 | return new MethodDefEntry(owner, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access)); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | public static MethodDefEntry parse(MethodDefinition definition) { | ||
| 41 | ClassEntry classEntry = ClassEntry.parse(definition.getDeclaringType()); | ||
| 42 | MethodDescriptor descriptor = new MethodDescriptor(definition.getErasedSignature()); | ||
| 43 | Signature signature = Signature.createSignature(definition.getSignature()); | ||
| 44 | AccessFlags access = new AccessFlags(definition.getModifiers()); | ||
| 45 | return new MethodDefEntry(classEntry, definition.getName(), descriptor, signature, access); | ||
| 46 | } | ||
| 47 | |||
| 39 | @Override | 48 | @Override |
| 40 | public AccessFlags getAccess() { | 49 | public AccessFlags getAccess() { |
| 41 | return access; | 50 | return access; |