JNLua 1.0.3 and 0.9.5

20 views
Skip to first unread message

Andre Naef

unread,
Oct 9, 2012, 7:01:19 PM10/9/12
to jnlua-...@googlegroups.com
I am happy to announce the release of JNLua 1.0.3 and 0.9.5 for Lua 5.2 and
5.1 respectively.

From the release notes:

---
* Release 1.0.3 (2012-10-09)

- Added transparent conversion between Lua strings and Java byte arrays.
This may break existing code that passes byte arrays between Java and Lua.
A compatibility property, com.naef.jnlua.rawByteArray=true, has been
provided.

- Fixed an issue where method dispatch would incorrectly fail on public
methods found on non-public classes with public superclasses. Thanks
Ignazio Di Napoli for the analysis.
---

(An identical release note is provided for JNLua 0.9.5.)


While these are minor releases that maintain binary compatibility at the
Java API level, please note that these releases do affect functionality.
They address a significant oversight in JNLua, which is the dual nature of
Lua strings. Lua strings are used for both textual and binary data, and
therefore having them bind to both String and byte[] on the Java side is the
right thing to do. The documentation in the JNLua wiki has been updated to
provide the following additional information on dealing with this change:

---
As of JNLua 0.9.5 and 1.0.3, Java byte arrays are transparently converted to
and from Lua strings. While Java has a strong distinction between binary
information (byte, byte[]) and textual information (char, String), Lua uses
strings to hold both binary and textual information. In case the transparent
conversion causes issues with existing code, the following options are
available to address such situations:

* Set the system property com.naef.jnlua.rawByteArray to true. This
disables the transparent conversion in the default converter and restores
the behavior of previous versions where Java byte arrays are passed raw. You
can still pass a byte array as a string by explicitly invoking the
pushByteArray and toByteArray methods on the Lua state.

* (If the system property is not set; default.) Use the Lua state
methods pushJavaObjectRaw and toJavaObjectRaw to explicitly pass a Java byte
array in raw form, bypassing the converter. Use the java.cast function to
resolve ambivalence when invoking same-name methods with both a String and
byte[] signature.

* Adapt your own converter, as explained in the next section.
---


Cheers, André


Reply all
Reply to author
Forward
0 new messages