mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-21 20:54:49 +07:00
Fixes IDEA-286020 False-positive 'result is always false' when converting string to bytes and backwards GitOrigin-RevId: 274434e1f80a127645a71cf14d6218fa90aa76ca
26 lines
586 B
Java
26 lines
586 B
Java
import java.nio.charset.*;
|
|
|
|
class Main {
|
|
private static void test() {
|
|
Key key = new Key(getBytes());
|
|
String s = key.value();
|
|
String s1 = new String(getBytes(), StandardCharsets.US_ASCII);
|
|
|
|
System.out.println("info".equals(s1));
|
|
System.out.println("info".equals(s));
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
test();
|
|
}
|
|
|
|
private static byte[] getBytes() {
|
|
return "info".getBytes(StandardCharsets.US_ASCII);
|
|
}
|
|
|
|
private record Key(byte[] bytes) {
|
|
public String value () {
|
|
return new String(bytes, StandardCharsets.US_ASCII);
|
|
}
|
|
}
|
|
} |