defineClass doesn't exist on extended ClassLoader
natedogith1 at gmail.com
Fri Feb 23 21:49:23 UTC 2018
Ah, so that's the difference (javadocs don't included "final" in method
summaries so I didn't notice). Guess this means I get to make an
On Thu, Feb 22, 2018 at 9:53 PM, Sundararajan Athijegannathan <
sundararajan.athijegannathan at oracle.com> wrote:
> Two things:
> * Nashorn allows access only to public methods and fields (of exported)
> classes only.
> * With Java.extend, Nashorn adds public overrides of all non-final
> protected methods of the superclass.
> ClassLoader.definePackage is non-final protected method.
> ClassLoader.defineClass is final protected method.
> Hence no override of ClassLoader.defineClass added to generated subclass.
> On 23/02/18, 7:09 AM, Nathan Faulkner wrote:
>> When extending java.lang.ClassLoader, I can't seem to execute defineClass.
>> Here's my test case showing the issue.
>> var superLoader = Java.super(new (Java.extend(java.lang.ClassLo
>> // defineClass on the super object doesn't exist for some reason
>> print("defineClass: " + (superLoader.defineClass !== undefined));
>> // definePackage is protected, but isn't undefined, so that isn't the
>> print("definePackage: " + (superLoader.definePackage !== undefined));
>> and here's the output of "java -version":
>> java version "1.8.0_161"
>> Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
More information about the nashorn-dev