Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-136

Using 'instanceof' on inconvertible types in codepad yields bad error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Done
    • Affects Version/s: 2.5.0
    • Fix Version/s: 3.0.2
    • Component/s: CodePad

      Description

      The error message the codepad gives if you use 'instanceof' on inconvertible types is "Error: not a statement", which is quite counterintuitive.

      Let's say I have a class hierarchy with FilledCircle extending Circle, and an unrelated class Point. If I have a Circle named unitCircle, I get:

      > unitCircle instanceof Object
      true (boolean)
      > unitCircle instanceof FilledCircle
      false (boolean)
      > unitCircle instanceof Point
      Error: not a statement
      

      Of course it's correct that it isn't a statement, but the real error here is actually that Circle and Point are inconvertible types.

        Attachments

          Activity

            People

            • Assignee:
              davmac Davin McCall
              Reporter:
              external External via trac
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: