JDK-8225731 : incorrect rawtypes diagnostic on method reference
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2019-06-13
  • Updated: 2019-08-20
Related Reports
Relates :  
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