new java.... #24

Closed
opened 2018-12-01 19:35:08 +00:00 by shift-reality · 3 comments
shift-reality commented 2018-12-01 19:35:08 +00:00 (Migrated from github.com)

in java 11 sometimes (if class loader = bootstrap) method Class.getClassLoader returns NULL!
So library LuajavaLib should be patched to new behaviour (line number is 146): Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), ifaces, handler); Also Returns Null object...

Try tricks above:
System.out.print(LuaValue.class.getClassLoader());System.out.print(Runnable.class.getClassLoader());
Second call returns null.

Please fix it... thx

in java 11 sometimes (if class loader = bootstrap) method Class.getClassLoader returns NULL! So library LuajavaLib should be patched to new behaviour (line number is 146): `Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), ifaces, handler);` Also Returns Null object... Try tricks above: `System.out.print(LuaValue.class.getClassLoader());System.out.print(Runnable.class.getClassLoader());` Second call returns null. Please fix it... thx
Enyby commented 2018-12-02 00:49:02 +00:00 (Migrated from github.com)

Read here: https://stackoverflow.com/questions/1921238/getclass-getclassloader-is-null-why
We can use ClassLoader.getSystemClassLoader() if previous call return null, but this not guaranteed you get not null value here. All depends on how you load classes. Usually LuaValue is custom class and do not loaded via bootstrap loader.
If you get null, then LuaValue loaded by bootstrap. You need check value of ClassLoader.getSystemClassLoader() for this case and report here about results.

Read here: https://stackoverflow.com/questions/1921238/getclass-getclassloader-is-null-why We can use `ClassLoader.getSystemClassLoader()` if previous call return null, but this not guaranteed you get not null value here. All depends on how you load classes. Usually LuaValue is custom class and do not loaded via bootstrap loader. If you get null, then LuaValue loaded by bootstrap. You need check value of `ClassLoader.getSystemClassLoader()` for this case and report here about results.
shift-reality commented 2018-12-03 08:23:38 +00:00 (Migrated from github.com)

Sorry, this issue not associated with class loading...
I got null when tried to print(luajava.createProxy(...)), so i think problem in Proxy class... But not.

Now i believe is in toString implementation of created proxy-object (this method returns null string, because is absent)..

Need add some checks, if method present in Object.class and absent in passed LuaValue ( second arg to createProxy) - call to super-method

Because equals?hashCode is to not working..

Sorry, this issue not associated with class loading... I got null when tried to `print(luajava.createProxy(...))`, so i think problem in `Proxy` class... But not. Now i believe is in `toString` implementation of created proxy-object (this method returns null string, because is absent).. Need add some checks, if method present in `Object.class` and absent in passed `LuaValue` ( second arg to `createProxy`) - call to super-method Because `equals?hashCode` is to not working..
lozn00 commented 2018-12-23 07:48:51 +00:00 (Migrated from github.com)

android not found class,

android not found class,
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#24