[java] MethodReturnsInternalArray - add test case (#3630)

This commit is contained in:
Andreas Dangel
2021-11-15 19:16:26 +01:00
parent 9e5bfe9536
commit 48714f8161
2 changed files with 23 additions and 0 deletions

View File

@ -454,6 +454,28 @@ public interface Outer {
String [] arr;
String [] getArr() {return arr;}
}
}
]]></code>
</test-code>
<test-code>
<description>[java] MethodReturnsInternalArray doesn't consider anonymous classes #3630</description>
<expected-problems>1</expected-problems>
<expected-linenumbers>7</expected-linenumbers>
<code><![CDATA[
public class Outer {
private static final String[] names = new String[] {"a", "b"};
public static Provider getProvider() {
return new Provider() {
@Override
public String[] getNames() {
return names;
}
};
}
public interface Provider {
String[] getNames();
}
}
]]></code>
</test-code>