diff options
| author | 2021-06-08 13:16:57 +0200 | |
|---|---|---|
| committer | 2021-06-22 12:21:19 +0200 | |
| commit | ed3ad1ee8902e1fcf6828cbfe9d5814779fb5ab5 (patch) | |
| tree | e59f81cd5096421f1574641c9023a45a30e3eeb7 | |
| parent | Bump version (diff) | |
| download | enigma-ed3ad1ee8902e1fcf6828cbfe9d5814779fb5ab5.tar.gz enigma-ed3ad1ee8902e1fcf6828cbfe9d5814779fb5ab5.tar.xz enigma-ed3ad1ee8902e1fcf6828cbfe9d5814779fb5ab5.zip | |
Work around SourceIndexMethodVisitor tripping over missing
MEMBER_REFERENCE data for invokedynamic, print decompilation exceptions
| -rw-r--r-- | enigma/src/main/java/cuchaz/enigma/source/procyon/index/SourceIndexMethodVisitor.java | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/enigma/src/main/java/cuchaz/enigma/source/procyon/index/SourceIndexMethodVisitor.java b/enigma/src/main/java/cuchaz/enigma/source/procyon/index/SourceIndexMethodVisitor.java index 0e8bc51a..8fc8e82a 100644 --- a/enigma/src/main/java/cuchaz/enigma/source/procyon/index/SourceIndexMethodVisitor.java +++ b/enigma/src/main/java/cuchaz/enigma/source/procyon/index/SourceIndexMethodVisitor.java | |||
| @@ -41,24 +41,26 @@ public class SourceIndexMethodVisitor extends SourceIndexVisitor { | |||
| 41 | public Void visitInvocationExpression(InvocationExpression node, SourceIndex index) { | 41 | public Void visitInvocationExpression(InvocationExpression node, SourceIndex index) { |
| 42 | MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE); | 42 | MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE); |
| 43 | 43 | ||
| 44 | // get the behavior entry | 44 | if (ref != null) { |
| 45 | ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName()); | 45 | // get the behavior entry |
| 46 | MethodEntry methodEntry = null; | 46 | ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName()); |
| 47 | if (ref instanceof MethodReference) { | 47 | MethodEntry methodEntry = null; |
| 48 | methodEntry = new MethodEntry(classEntry, ref.getName(), new MethodDescriptor(ref.getErasedSignature())); | 48 | if (ref instanceof MethodReference) { |
| 49 | } | 49 | methodEntry = new MethodEntry(classEntry, ref.getName(), new MethodDescriptor(ref.getErasedSignature())); |
| 50 | if (methodEntry != null) { | ||
| 51 | // get the node for the token | ||
| 52 | AstNode tokenNode = null; | ||
| 53 | if (node.getTarget() instanceof MemberReferenceExpression) { | ||
| 54 | tokenNode = ((MemberReferenceExpression) node.getTarget()).getMemberNameToken(); | ||
| 55 | } else if (node.getTarget() instanceof SuperReferenceExpression) { | ||
| 56 | tokenNode = node.getTarget(); | ||
| 57 | } else if (node.getTarget() instanceof ThisReferenceExpression) { | ||
| 58 | tokenNode = node.getTarget(); | ||
| 59 | } | 50 | } |
| 60 | if (tokenNode != null) { | 51 | if (methodEntry != null) { |
| 61 | index.addReference(TokenFactory.createToken(index, tokenNode), methodEntry, this.methodEntry); | 52 | // get the node for the token |
| 53 | AstNode tokenNode = null; | ||
| 54 | if (node.getTarget() instanceof MemberReferenceExpression) { | ||
| 55 | tokenNode = ((MemberReferenceExpression) node.getTarget()).getMemberNameToken(); | ||
| 56 | } else if (node.getTarget() instanceof SuperReferenceExpression) { | ||
| 57 | tokenNode = node.getTarget(); | ||
| 58 | } else if (node.getTarget() instanceof ThisReferenceExpression) { | ||
| 59 | tokenNode = node.getTarget(); | ||
| 60 | } | ||
| 61 | if (tokenNode != null) { | ||
| 62 | index.addReference(TokenFactory.createToken(index, tokenNode), methodEntry, this.methodEntry); | ||
| 63 | } | ||
| 62 | } | 64 | } |
| 63 | } | 65 | } |
| 64 | 66 | ||