From c5956b39303a231a92ec69048a0e614b3174d517 Mon Sep 17 00:00:00 2001 From: Alexander Milster Date: Tue, 28 Nov 2023 09:36:24 +0100 Subject: [PATCH] Readability for anonymous variables in java language module --- .../main/java/de/jplag/java/TokenGeneratingTreeScanner.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java b/languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java index f94eb2837..c8ab37c82 100644 --- a/languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java +++ b/languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java @@ -60,6 +60,8 @@ import com.sun.source.util.TreeScanner; final class TokenGeneratingTreeScanner extends TreeScanner { + private final static String ANONYMOUS_VARIABLE_NAME = ""; + private final File file; private final Parser parser; private final LineMap map; @@ -460,7 +462,7 @@ public Void visitAssert(AssertTree node, Void unused) { @Override public Void visitVariable(VariableTree node, Void unused) { - if (!node.getName().contentEquals("")) { + if (!node.getName().contentEquals(ANONYMOUS_VARIABLE_NAME)) { long start = positions.getStartPosition(ast, node); String name = node.getName().toString(); boolean inLocalScope = variableRegistry.inLocalScope();