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

improve diagnostic for "instanceof T" for type parameter T

XMLWordPrintable

    • b110
    • generic
    • solaris_8
    • Verified

      If T is an identifier for a parameterized type, then using
      "instanceof T" obviously shouldn't be legal. The compiler does enforce
      this but the error message "unexpected type ... found T, required class
      or array" doesn't make it obvious that this is a deliberate restriction.

      --------------------------------

      An example:

      class T4881267 {
          <T> void m(Object o) {
      boolean b = o instanceof T;
          }
      }

      ###@###.### 2004-09-17

            kizune Alexander Zuev
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: