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

wrong error message when explicit cast is possible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0
    • 0.9
    • tools
    • 1.0beta
    • sparc
    • solaris_2.4
    • Not verified


      The following program produces the wrong error message:

      interface A {
      }

      class Test {
          A foo() {
              return this;
          }
      }

      The error is:

      T.java:6: Incompatible type for return. Can't convert Test to A.
              return this;
              ^


      It should be:

      T.java:6: Incompatible type for return. Explicit cast needed to convert Test to A.
              return this;
              ^

            ahoffsunw Arthur Hoff (Inactive)
            ahoffsunw Arthur Hoff (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: