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

jshell tool: /method /type failed declaration listed (without indication)

XMLWordPrintable

    • b157
    • Verified

        [unfortunately JBS isn't showing indenting]

        jshell> double m(int x) { return x; }
        | created method m(int)

        jshell> GARBAGE junk() { return TRASH; }
        | created method junk(), however, it cannot be referenced until class GARBAGE, and variable TRASH are declared

        jshell> int w = 5;
        w ==> 5

        jshell> int tyer() { return w; }
        | created method tyer()

        jshell> String w = "hi";
        w ==> "hi"

        jshell> /methods
        | m (int)double
        | junk ()GARBAGE
        | tyer ()int

        jshell> tyer()
        | attempted to call method tyer() which cannot be invoked until this error is corrected:
        | incompatible types: java.lang.String cannot be converted to int
        | int tyer() { return w; }
        | ^

        jshell> junk()
        | Error:
        | cannot find symbol
        | symbol: method junk()
        | junk()
        | ^--^

        ---------------------------------- Desired Output ------------------------

            jshell> /methods
            | double m(int)
            | GARBAGE junk()
            | which cannot be referenced until class GARBAGE, and variable TRASH are declared
            | int tyer()
            | which cannot be invoked until this error is corrected:
            | incompatible types: java.lang.String cannot be converted to int
            | int tyer() { return w; }
            | ^

              rfield Robert Field (Inactive)
              rfield Robert Field (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: