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

Allow class-based overrides to be initialized with a ScriptFunction

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 8
    • None
    • core-libs
    • None
    • b93
    • Verified

    Description

      This is an enhancement to JDK-8011544, allowing SAM types with class-based overrides to be initialized with a script function, i.e. while we can do either of these two:

        var r1 = new java.lang.Runnable({ run: function() { print("Hello!") } })
        var r2 = new java.lang.Runnable(function() { print("Hello!") })

      We can only do:

        var R1 = Java.extend(java.lang.Runnable, { run: function() { print("Hello!") } })

      and not:

        var R1 = Java.extend(java.lang.Runnable, function() { print("Hello!") })

      This issue restores the symmetry of being able to use a function to initialize a SAM type both in instance and class-based overrides.

      Attachments

        Activity

          People

            attila Attila Szegedi
            attila Attila Szegedi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: