Add test for #1688

This commit is contained in:
Clément Fournier
2024-03-21 19:24:53 +01:00
parent 2d5000a6c3
commit e57d26b31a

View File

@ -901,4 +901,37 @@ interface Listener {
}
]]></code>
</test-code>
<test-code>
<description> [java] SingularField false positive with non static inner classes #1688 </description>
<expected-problems>0</expected-problems>
<code><![CDATA[
class A {
private String value;
private String derivedValue;
public A(String value) {
this.value = value;
this.derivedValue = this.value + "-more";
}
private void run() {
final B b = new B();
b.useA();
}
public static void main(String[] args) {
new A("").run();
}
public class B {
public void useA() {
final String field = A.this.value;
System.out.println(field);
}
}
}
]]></code>
</test-code>
</test-data>