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

can't use var with a class named Z

    XMLWordPrintable

Details

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

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: