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

javac should not use lazy constant evaluation approach for method references

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 8
    • 8
    • tools
    • b99
    • b106
    • Verified

      Somehow javac is mixing up the method type argument with the class type argument when the method reference is like
      MyTest<Q>::<Object>new,
      where Q is a reference type.
      The correct behavior here must be to ignore the method type arguments and proceed cleanly -- see, for example, this comment from 15.12.2.1:

      "This clause implies that a non-generic method may be potentially applicable to an invocation that supplies explicit type arguments. Indeed, it may turn out to be applicable. In such a case, the type arguments will simply be ignored."

      For nested classes compilation succeeds. The problem happens for top level classes only.
      The following JCK tests fail:
      lang/LMBD/lmbd131/lmbd13101m0022/lmbd13101m0022.html
      lang/LMBD/lmbd131/lmbd13101m0055/lmbd13101m0055.html
      lang/LMBD/lmbd131/lmbd13101m1022/lmbd13101m1022.html
      lang/LMBD/lmbd131/lmbd13101m1055/lmbd13101m1055.html

        1. lmbd13101m0022.java
          1 kB
        2. lmbd13101m0055.java
          1 kB
        3. lmbd13101m1022.java
          0.9 kB
        4. lmbd13101m1055.java
          0.9 kB

            vromero Vicente Arturo Romero Zaldivar
            enekipel Ella Nekipelova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: