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

JShell: NoSuchFieldError occurred due to accessing variables of intersection type inferred by `var`

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 10
    • Fix Version/s: 15
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • Introduced In Version:
      10
    • CPU:
      generic
    • OS:
      generic

      Description

      bitter_fox@bitterfox-MacBookPro% ~/bin/jdk-10/bin/jshell -J-Duser.language=en
      | Welcome to JShell -- Version 10
      | For an introduction type: /help intro

      jshell> <Z extends Runnable & CharSequence> Z get1() { return null; }
      | created method get1()

      jshell> var z = get1()
      z ==> null

      jshell> z.run()
      | java.lang.NoSuchFieldError thrown: z
      | at (#3:1)

      jshell> void m() {z.run();}
      | created method m()

      jshell> m()
      | java.lang.NoSuchFieldError thrown: z
      | at m (#4:1)
      | at (#5:1)

      jshell>

      Examples above are based on VariablesTest#lvti, but the testing is not completeness.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jlahoda Jan Lahoda
                Reporter:
                shinyafox Shinya Yoshida
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: