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

sundararajan.athijegannathan at oracle.com sundararajan.athijegannathan at oracle.com
Thu Feb 20 09:02:21 UTC 2020


Hi,

Thanks for reporting this issue. I filed a bug -> 
https://bugs.openjdk.java.net/browse/JDK-8239536

PS. Reproduced with the latest jdk repo as well.

-Sundar

On 20/02/20 2:07 pm, kishida naoki wrote:
> 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");
> |  ^----------^
> ```
>


More information about the kulla-dev mailing list