IDEA-197665 Decompiler decompiles references to static fields inside class incorrectly

master
Egor Ushakov 5 years ago
parent 8f2a97adc3
commit ccc203e92b
  1. 9
      src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java
  2. BIN
      testData/classes/pkg/TestStaticNameClash.class
  3. 4
      testData/results/TestStaticNameClash.dec

@ -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<Integer, String> getMapParamNames() {

@ -3,8 +3,8 @@ package pkg;
public class TestStaticNameClash {
public static String property;
public static void setProperty(String var0) {
property = var0;// 8
public static void setProperty(String property) {
TestStaticNameClash.property = property;// 8
}// 9
}

Loading…
Cancel
Save