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

unexpected compilation error with generic sealed interface

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b32

      Backports

        Description

        This code is being rejected by javac but should be accepted:

        class SealedExample
        {
          // Compiles if you remove `sealed` or if `I` is not generic.
          sealed interface I<T> {
            final class C implements I<Object> { }
          }

          static void f(final I<Object> x) {
            if (x instanceof I.C) {

            }
          }
        }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                vromero Vicente Arturo Romero Zaldivar
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: