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

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

    Details

    • Subcomponent:
    • Resolved In Build:
      b161
    • Verification:
      Verified

      Backports

        Description

        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; }
        }

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: