From ccc203e92b334a8448c21674352a8a5423917580 Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Tue, 18 Dec 2018 17:32:57 +0300 Subject: [PATCH] IDEA-197665 Decompiler decompiles references to static fields inside class incorrectly --- .../attr/StructLocalVariableTableAttribute.java | 9 +++------ testData/classes/pkg/TestStaticNameClash.class | Bin 351 -> 443 bytes testData/results/TestStaticNameClash.dec | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java index 1c80ef0..15fb317 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java @@ -1,14 +1,11 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.struct.attr; import org.jetbrains.java.decompiler.struct.consts.ConstantPool; import org.jetbrains.java.decompiler.util.DataInputFullStream; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -67,7 +64,7 @@ public class StructLocalVariableTableAttribute extends StructGeneralAttribute { } public boolean containsName(String name) { - return localVariables.stream().anyMatch(v -> v.name == name); + return localVariables.stream().anyMatch(v -> Objects.equals(v.name, name)); } public Map getMapParamNames() { diff --git a/testData/classes/pkg/TestStaticNameClash.class b/testData/classes/pkg/TestStaticNameClash.class index 1573836f0fc84d5481c052752a2de61e3671342b..7ae890ef6e32e8ec6d51d80c0b8361f6b4375d7d 100644 GIT binary patch delta 197 zcmcc5w3}J#)W2Q(7#J8#7{s_3SQvyj8JHP_*%?IG8AK;adC3X+TQge4YbCMM;i zhJXl029}bH%wk3cNuP;(#Tl(9CM~PhXJ7