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

Can't invoke vararg @FunctionalInterface methods

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 9
    • 9
    • core-libs
    • b81
    • generic
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved: