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

unexpected compilation error with generic sealed interface

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 16
    • None
    • tools
    • None
    • b32

        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) {

            }
          }
        }

              vromero Vicente Arturo Romero Zaldivar
              vromero Vicente Arturo Romero Zaldivar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: