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

can't use var with a class named Z

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 11
    • tools
    • None
    • b06

      jshell> class Z {}
      | created class Z

      jshell> var myVariable = new Z()
      | Error:
      | unexpected type
      | required: class
      | found: type parameter Z
      | var myVariable = new Z();
      | ^

      Apparently there's some internal construct that leaks the type variable Z into the user's namespace.

      https://stackoverflow.com/questions/62102369/jshell-error-unexpected-type-when-using-specific-class-name

            jlahoda Jan Lahoda
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: