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

Confusing error message checking instanceof non-class

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 8
    • 8
    • core-libs
    • None
    • b105
    • generic
    • generic

    Description

      var foo = {};
      foo instanceof bar;

      or

      var foo = {};
      foo instanceof 5;

      Both of these yield the following error message: "instanceof cannot be used on objects without [[HasInstance]]", which is confusing.

      Perhaps, instead, something along the lines of "instanceof may only be called with a type as the right-hand argument."

      Attachments

        Activity

          People

            mhorowit Michael Horowitz (Inactive)
            mhorowit Michael Horowitz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: