Can't use `java.util.List` object after importing `java.awt.List`

kishida naokinaokikishida at gmail.com
Thu Feb 20 08:37:05 UTC 2020


We can' t use `java.util.List` object after importing `java.awt.List` I mean that JShell behaves strangely when we have two same named classes from different packages. The below is run on JDK 14 ea 36 ``` $ jshell | Welcome to JShell -- Version 14 | For an introduction type: /help intro  jshell> var a = List.of("aa") a ==> [aa] jshell> a a ==> [aa] jshell> import java.awt.List jshell> a | Error: | cannot find symbol | symbol: variable a | a | ^  jshell> var b = java.util.List.of("bb") | Error: | type java.awt.List does not take parameters | var b = java.util.List.of("bb"); | ^----------^ ``` -- Naoki Kishida 


More information about the kulla-dev mailing list
close