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

javac does not issue unchecked warnings when checking method reference return types

XMLWordPrintable

    • b161
    • Verified

        Initially seen here:
        http://stackoverflow.com/questions/42346895/constructor-reference-no-warning-when-generics-array-is-created

        Javac does not generate unchecked warnings when checking method reference return types. The issue is not limited to arrays.

        import java.util.function.*;
        import java.util.*;

        class Test {
           void m() {
                    IntFunction<List<String>[]> sls = List[]::new; //no warning
              Supplier<List<String>> sls = this::l; //no warning
           }

           List l() { return null; }
        }

              mcimadamore Maurizio Cimadamore
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: