mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-06 01:06:54 +07:00
Fixes IDEA-265089 ConstantCondition always false incorrectly reported on String.equals with String literal on left side GitOrigin-RevId: 4e128a8308a9813bba953e107400c51879a6e7f2
18 lines
463 B
Java
18 lines
463 B
Java
public class StringEqualityNewStringInMethod {
|
|
// IDEA-265089
|
|
public boolean bad() {
|
|
return "baah".equals(toString("baah".getBytes("UTF-8")));
|
|
}
|
|
|
|
public boolean good() {
|
|
return "baah".equals(new String("baah".getBytes("UTF-8"), 0, 4, "UTF-8"));
|
|
}
|
|
|
|
public boolean good2() {
|
|
return toString("baah".getBytes("UTF-8")).equals("baah");
|
|
}
|
|
|
|
private static String toString(final byte[] data) {
|
|
return new String(data, 0, 4, "UTF-8");
|
|
}
|
|
} |