[java-highlighting] IDEA-324327 IJ-CR-110223 Constant associated with switch block must be used with primitives or String

GitOrigin-RevId: fab5d57dc37c1694607686e268072473ec60a4de
This commit is contained in:
Mikhail Pyltsin
2023-07-10 12:52:26 +02:00
committed by intellij-monorepo-bot
parent fef71943cd
commit 21d97bbbb0
3 changed files with 7 additions and 7 deletions

View File

@@ -1,14 +1,14 @@
public class ConstantAssignment {
void dd(Double i) {
switch (i) {
case <error descr="Unexpected type. Found: 'double', required: 'char, byte, short, int, Character, Byte, Short, Integer, String'">1.0</error> -> System.out.println(1);
case <error descr="Incompatible types. Type of constant label: 'double', switch selector type: 'java.lang.Double'">1.0</error> -> System.out.println(1);
default -> throw new IllegalStateException("Unexpected value: " + i);
}
}
void dd2(Long i) {
switch (i) {
case <error descr="Unexpected type. Found: 'long', required: 'char, byte, short, int, Character, Byte, Short, Integer, String'">1L</error>:
case <error descr="Incompatible types. Type of constant label: 'long', switch selector type: 'java.lang.Long'">1L</error>:
System.out.println(1);
default:
throw new IllegalStateException("Unexpected value: " + i);