Add test case for #3802

This commit is contained in:
Juan Martín Sotuyo Dodero 2024-03-18 00:26:47 -03:00
parent e7ec34ee65
commit 6be72b2795

View File

@ -1222,6 +1222,37 @@ class LawOfDemeterFields {
return null;
}
}
]]></code>
</test-code>
<test-code>
<description>#3802 FN with lambdas</description>
<expected-problems>1</expected-problems>
<expected-linenumbers>7</expected-linenumbers>
<code><![CDATA[
import java.util.function.Function;
public class Example {
public void func() {
MyObject myObject = MyObjectProvider.get();
Function<Integer, Integer> f = (i) -> {
Object obj = myObject.getFunc(); //false-negative here
obj.hashCode();
};
}
}
class MyObject {
public Object getFunc(){
return new Object();
}
}
class MyObjectProvider {
public static MyObject get(){
return new MyObject();
}
}
]]></code>
</test-code>
</test-data>