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

javac fail to compile casts to raw type

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      no compile-time error should be reported in the example below:

      interface Super<P> {}
      class Y implements Super<Integer>{}
      interface X extends Super<Double>{}
      class S<L> extends Y {}
      interface T<L> extends X{}

      public class Test{
         public static void main(String argv[]) {
             S s = null; // same if I use S<Byte>
             T t = null; // same if I use T<Byte>
             t = (T) s; // casting to raw - should be no compile-time error
         }
      }

      there are many other similar situations. (f.e. when S T X Y are all interfaces).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                duke J. Duke (Inactive)
                Reporter:
                vrudomet Victor Rudometov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: