From 05614554a89b084fa871c9be0cf88d8f2dfb96ea Mon Sep 17 00:00:00 2001 From: NebelNidas Date: Tue, 9 Apr 2024 00:04:51 +0200 Subject: [PATCH] Fix token offsets in the presence of Javadocs (2) --- .../main/java/cuchaz/enigma/source/jadx/JadxSource.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/enigma/src/main/java/cuchaz/enigma/source/jadx/JadxSource.java b/enigma/src/main/java/cuchaz/enigma/source/jadx/JadxSource.java index aaee391d..36e5c6dd 100644 --- a/enigma/src/main/java/cuchaz/enigma/source/jadx/JadxSource.java +++ b/enigma/src/main/java/cuchaz/enigma/source/jadx/JadxSource.java @@ -97,7 +97,7 @@ private void ensureDecompiled() { // Tokens codeInfo.getCodeMetadata().searchDown(0, (pos, ann) -> { - processAnnotatedElement(pos, ann, cls.getCodeInfo()); + processAnnotatedElement(pos, ann, codeInfo); return null; }); } @@ -139,8 +139,8 @@ private void processAnnotatedElement(int pos, ICodeAnnotation ann, ICodeInfo cod if (!var.getMth().collectArgsWithoutLoading().contains(var)) return; Token token = new Token(pos, pos + var.getName().length(), var.getName()); - if (pos == var.getDefPosition()) { - index.addDeclaration(token, paramEntryOf(var, codeInfo)); + if (pos == var.getDefPosition()) { + index.addDeclaration(token, paramEntryOf(var, codeInfo)); } else { index.addReference(token, paramEntryOf(var, codeInfo), methodEntryOf(var.getMth())); } @@ -161,7 +161,7 @@ private MethodEntry methodEntryOf(MethodNode mth) { return jadxHelper.methodEntryOf(mth); } - private LocalVariableEntry paramEntryOf(VarNode param, ICodeInfo codeInfo) { + private LocalVariableEntry paramEntryOf(VarNode param, ICodeInfo codeInfo) { return jadxHelper.paramEntryOf(param, codeInfo); } }