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

Can't invoke vararg @FunctionalInterface methods

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b81
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Given this test interface:

        package jdk.nashorn.test.models;

        @FunctionalInterface
        public interface VarArgConsumer {
            public void apply(Object... o);
        }

        This won't work:

        var c = new (Java.type("jdk.nashorn.test.models.VarArgConsumer"))(
            function() { print(arguments.length) });
        c(1, 2, 3)

        A solution would be to rely on Dynalink's DynamicMethod instead of reflective Method.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sundar Sundararajan Athijegannathan
                Reporter:
                attila Attila Szegedi
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: