gudzpoz / luajava

Lua for Java on Windows, Mac OS X, Linux, Android. 5.1, 5.2, 5.3, 5.4, LuaJ or LuaJIT.
https://gudzpoz.github.io/luajava/
Other
154 stars 21 forks source link

NullPointerException throws when pass a jclass to java.proxy. #17

Closed leasses closed 2 years ago

leasses commented 2 years ago

This is the full log of the console:

>>> local ActionListener= java.import("java.awt.event.ActionListener")
>>> java.proxy(ActionListener, { windowClosing = function (this, ev) end } )
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.endsWith(String)" because "name" is null
        at party.iroiro.luajava.Console.startInteractive(Console.java:72)
        at party.iroiro.luajava.Console.main(Console.java:31)
Caused by: java.lang.NullPointerException: Cannot invoke "String.endsWith(String)" because "name" is null
        at party.iroiro.luajava.util.ClassUtils.forName(ClassUtils.java:188)
        at party.iroiro.luajava.JuaAPI.proxy(JuaAPI.java:35)
        at party.iroiro.luajava.LuaJitNatives.luaL_dostring(Native Method)
        at party.iroiro.luajava.AbstractLua.run(AbstractLua.java:477)
        at party.iroiro.luajava.Console.startInteractive(Console.java:64)
        ... 1 more

I see the document, it says the first parameter of java.proxy can pass any one of the jobj, string and jclass. But I tried all of them, only string can run successful.

gudzpoz commented 2 years ago

Fixed. Thanks!