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

javac bug (JDK6): missing unchecked warning

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      JDK6

      ADDITIONAL OS VERSION INFORMATION :
      All platforms

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      All configurations

      A DESCRIPTION OF THE PROBLEM :
      javac 1.6 give no unchecked warning on this:

      interface I1<T> {}
      final class GC33<T> implements I1<Short> {}

      class Z<T, U extends T, V extends Number> {
              GC33<Short> x = null;
              I1<V> y = (I1<V>)x;
      }

      We can tell that a GC33<Short> can be cast safely to an I1<Short>, but if V is something other than Short the cast to I1<V> is not valid.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the program and observe the absence of the required warning.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      An unchecked warning is required by the JLS.
      ACTUAL -
      No warning is produced.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      The required warning message is not produced by the compiler.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      interface I1<T> {}
      final class GC33<T> implements I1<Short> {}

      class Z<T, U extends T, V extends Number> {
              GC33<Short> x = null;
              I1<V> y = (I1<V>)x;
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: