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

Cast: compile reject sensible cast from final class to interface

XMLWordPrintable

    • b123
    • unknown
    • generic
    • Verified

      After fix of 6932671 the compiler rejects the following code:

      class JavaApplication6 {

          public static <T extends CharSequence> Foo<T> createDeclarationUID(T declaration) {
              return (Foo<T>) new FooImpl();
          }

          public interface Foo<T> {
              
          }
          
          public static final class FooImpl implements Foo<String> {
              
          }
      }

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: