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

JShell API: Failed to detect override when snippet to be overridden has been changed before

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 9
    • tools
    • 9
    • b07
    • generic
    • generic

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

      jshell> void m(Object o) {}
      | created method m(Object)

      jshell> <T> void m(T o) {}
      | replaced method m(T)

      jshell> /l

         2 : <T> void m(T o) {}

      jshell> m("")

      jshell>

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

      jshell> void m(Object o) {}
      | created method m(Object)

      jshell> void m(Object o1) {}
      | modified method m(Object)

      jshell> <T> void m(T o1) {}
      | created method m(T)

      jshell> /l

         2 : void m(Object o1) {}
         3 : <T> void m(T o1) {}

      jshell> m("")
      | Error:
      | reference to m is ambiguous
      | both method <T>m(T) in and method m(java.lang.Object) in match
      | m("")
      | ^

      jshell>

            shinyafox Shinya Yoshida
            shinyafox Shinya Yoshida
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: