Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8239536

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

XMLWordPrintable

    • b12
    • generic
    • generic

        This bug was reported in kulla-dev list by Naoki Kishida

        See also: https://mail.openjdk.java.net/pipermail/kulla-dev/2020-February/002482.html

        $ 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");
        | ^----------^

              jlahoda Jan Lahoda
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: