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

Can't invoke vararg @FunctionalInterface methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • b81
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: