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

Unchecked warning *and* inconvertible types

    Details

    • Subcomponent:
    • Resolved In Build:
      b48
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The compiler generates both a warning and an error on this program:

      class Outer<T extends Number & Comparable<String>> {
          void foo(T t) {
              Comparable<Integer> ci = (Comparable<Integer>) t;
          }
      }

      Outer.java:3: warning: [unchecked] unchecked cast
      found : T
      required: java.lang.Comparable<java.lang.Integer>
              Comparable<Integer> ci = (Comparable<Integer>) t;
                                                             ^
      Outer.java:3: inconvertible types
      found : T
      required: java.lang.Comparable<java.lang.Integer>
              Comparable<Integer> ci = (Comparable<Integer>) t;
                                                             ^
      1 error
      1 warning

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                ahe Peter Ahe
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: