Extending a Java class
axeld at pinc-software.de
Tue Oct 2 10:22:26 UTC 2018
Am 01/10/2018 um 05:00 schrieb Sundararajan Athijegannathan:
> In your example, it seems you're trying to add a new method to the
> subtype created in script. That is not supported. You can override
> existing methods of superclass - but not add a new method to the Java
Bummer! resourcetrysuggester.js added new fields to a Java type, so I
thought it should work.
> Note that all super methods (including protected ones) are
> available via Java.super. For example, you can invoke
> Java.super(filter).fireMatchNode(). So the workaround for this case
> would be add utility function outside for "setEnabled".
This does sound like an acceptable work-around, however, it doesn't seem
TypeError: Java.super(filter).fireMatchNone is not a function
Well, I guess reflection will work.
More information about the nashorn-dev