Details
-
Enhancement
-
Resolution: Fixed
-
P3
-
None
-
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.
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.