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

Incorrect raw type warning for method reference

XMLWordPrintable

    • b26

      The following produces a rawtype warning, even though the type is used as a qualifier of a method reference. Generally, rawtype warnings do not occur in this context, but something strange about this case is triggering it. (Hint: removing the wildcard will make the warning go away.)

          void test(Box<? extends Box<Number>> b) {
              Number n = b.<Number>map(Box::get).get();
          }

          interface Func<S,T> { T apply(S arg); }

          interface Box<T> {
              T get();
              <R> Box<R> map(Func<T,R> f);
          }


      warning: [rawtypes] found raw type: Box
              Number n = b.<Number>map(Box::get).get();
                                       ^
        missing type arguments for generic class Box<T>
        where T is a type-variable:
          T extends Object declared in interface Box

            vromero Vicente Arturo Romero Zaldivar
            dlsmith Dan Smith
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: