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

generic method call passed as varargs argument regression

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 8u40
    • tools
    • x86_64
    • linux_ubuntu

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_40"
      Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
      Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      The following works with 1.8.0_11 and the Eclipse Java compiler:

      public class Bug {
      public static void main(String[] args) {
      foo(bar(true, b -> b ? 1 : 0));
      }

      public static void foo(int... baz) { }

      public static <R, A> R bar(A arg, java.util.function.Function<A, R> f) {
      return f.apply(arg);
      }
      }

      1.8.0_40 error message:

      Bug.java:3: error: incompatible types: inferred type does not conform to upper bound(s)
                      foo(bar(true, b -> b ? 1 : 0));
                             ^
          inferred: Integer
          upper bound(s): int[],Object
      Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
      1 error

      REGRESSION. Last worked in version 8u11


      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              aroy Abhijit Roy (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: