Details
-
Enhancement
-
Resolution: Fixed
-
P2
-
None
-
None
-
b86
Description
Currently, the only way to subclass a Java class in Nashorn is to create an instance a la anonymous inner classes in Java:
var r = new java.lang.Runnable() {
run: function() { ... }
}
However, sometimes we need to create a subclass without creating instances. We'd need a functionality like:
var R = Java.extend(java.lang.Runnable, {
run: function() { ... }
})
Such a class can then be instantiated:
var r = new R
Or passed to some other API, i.e.:
launch(R.class)
var r = new java.lang.Runnable() {
run: function() { ... }
}
However, sometimes we need to create a subclass without creating instances. We'd need a functionality like:
var R = Java.extend(java.lang.Runnable, {
run: function() { ... }
})
Such a class can then be instantiated:
var r = new R
Or passed to some other API, i.e.:
launch(R.class)