jshell> Object o = 1L
o ==> 1
jshell> o instanceof Long
$2 ==> true
jshell> o instanceof long
| Exception java.lang.NoSuchFieldError: Class REPL.$JShell$13 does not have member field 'java.lang.Object o'
| at (#3:1)
jshell> long l = 1L
l ==> 1
jshell> l instanceof Long
$5 ==> true
jshell> l instanceof long
$6 ==> true
o ==> 1
jshell> o instanceof Long
$2 ==> true
jshell> o instanceof long
| Exception java.lang.NoSuchFieldError: Class REPL.$JShell$13 does not have member field 'java.lang.Object o'
| at (#3:1)
jshell> long l = 1L
l ==> 1
jshell> l instanceof Long
$5 ==> true
jshell> l instanceof long
$6 ==> true
- relates to
-
JDK-8303374 Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview)
- Resolved