mirror of
https://github.com/github/codeql.git
synced 2026-06-13 17:01:10 +02:00
23 lines
448 B
Java
23 lines
448 B
Java
public class Test {
|
|
private final int[] numbers = { 1, 2, 3 };
|
|
|
|
// NOT OK
|
|
public boolean areTheseMyNumbers(int[] numbers) {
|
|
return this.numbers.equals(numbers); // $ Alert
|
|
}
|
|
|
|
// OK
|
|
public boolean honestAreTheseMyNumbers(int[] numbers) {
|
|
return this.numbers == numbers;
|
|
}
|
|
|
|
// NOT OK, but shouldn't be flagged by this query
|
|
public boolean incomparable(String s) {
|
|
return numbers.equals(s);
|
|
}
|
|
|
|
{
|
|
numbers.hashCode(); // $ Alert
|
|
}
|
|
}
|