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

incorrect rawtypes diagnostic on method reference


    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:


      The rawtypes diagnostic on `A::a` seems incorrect. Using that method reference in isolation doesn't result in a diagnostic. I think this is related to the enclosing expression, which uses the partially raw type `D.L` (`D`'s type hierarchy includes a raw type).

      import static java.util.stream.Collectors.toList;

      import java.io.Serializable;
      import java.util.List;

      abstract class A<T extends A<T, U>, U extends A.I<T, U>> {

        public Integer a() {
          throw new AssertionError();

        abstract static class I<T extends A<T, U>, U extends I<T, U>> {}

      abstract class B extends A {
        abstract static class J extends A.I {}

      abstract class C extends B implements Serializable {
        abstract static class K extends B.J {}

      class D extends C {

        public abstract static class L extends C.K {
          abstract L f(java.lang.Iterable<? extends Integer> values);

          abstract D g();

      class T {
        public D test(D.L d, List<D> xs) {
          return d.f(xs.stream().map(A::a).collect(toList())).g();

      javac -fullversion -Xlint:rawtypes T.java
      javac full version "13-ea+24"
      T.java:35: warning: [rawtypes] found raw type: A
          return d.f(xs.stream().map(A::a).collect(toList())).g();
        missing type arguments for generic class A<T,U>
        where T,U are type-variables:
          T extends A<T,U> declared in class A
          U extends I<T,U> declared in class A
      1 warning


          Issue Links



              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                cushon Liam Miller-Cushon
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: