From d39797deed277f07f94c52407afa7ba7d7e87d4a Mon Sep 17 00:00:00 2001 From: hyee Date: Wed, 25 Jan 2017 00:32:16 +0800 Subject: [PATCH] auto-convert Java-Array to Lua-Table;fix the incorrection of java Number to lua issue --- src/main/java/META-INF/MANIFEST.MF | 3 + src/main/java/com/naef/jnlua/Converter.java | 1 - .../java/com/naef/jnlua/DefaultConverter.java | 74 +++++++++++---- .../com/naef/jnlua/DefaultJavaReflector.java | 3 - .../java/com/naef/jnlua/JavaFunction.java | 1 - src/main/java/com/naef/jnlua/JavaModule.java | 3 - .../java/com/naef/jnlua/JavaReflector.java | 73 ++++---------- src/main/java/com/naef/jnlua/LuaError.java | 1 - .../java/com/naef/jnlua/LuaException.java | 1 - .../naef/jnlua/LuaGcMetamethodException.java | 1 - .../jnlua/LuaMemoryAllocationException.java | 1 - .../jnlua/LuaMessageHandlerException.java | 1 - .../com/naef/jnlua/LuaRuntimeException.java | 2 - .../com/naef/jnlua/LuaStackTraceElement.java | 1 - src/main/java/com/naef/jnlua/LuaState.java | 95 ++++--------------- .../com/naef/jnlua/LuaSyntaxException.java | 1 - src/main/java/com/naef/jnlua/LuaType.java | 33 ++----- .../java/com/naef/jnlua/LuaValueProxy.java | 1 - .../com/naef/jnlua/NamedJavaFunction.java | 1 - .../java/com/naef/jnlua/NativeSupport.java | 2 - .../java/com/naef/jnlua/TypedJavaObject.java | 1 - .../com/naef/jnlua/console/LuaConsole.java | 1 - .../naef/jnlua/script/CompiledLuaScript.java | 1 - .../com/naef/jnlua/script/LuaBindings.java | 1 - .../naef/jnlua/script/LuaScriptEngine.java | 4 - .../jnlua/script/LuaScriptEngineFactory.java | 1 - .../naef/jnlua/util/AbstractTableList.java | 1 - .../com/naef/jnlua/util/AbstractTableMap.java | 1 - 28 files changed, 105 insertions(+), 205 deletions(-) create mode 100644 src/main/java/META-INF/MANIFEST.MF diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fdf3553 --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: com.naef.jnlua.console.LuaConsole + diff --git a/src/main/java/com/naef/jnlua/Converter.java b/src/main/java/com/naef/jnlua/Converter.java index be5f441..4a5e299 100644 --- a/src/main/java/com/naef/jnlua/Converter.java +++ b/src/main/java/com/naef/jnlua/Converter.java @@ -2,7 +2,6 @@ * $Id: Converter.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/DefaultConverter.java b/src/main/java/com/naef/jnlua/DefaultConverter.java index 09106f2..379eed4 100644 --- a/src/main/java/com/naef/jnlua/DefaultConverter.java +++ b/src/main/java/com/naef/jnlua/DefaultConverter.java @@ -2,11 +2,11 @@ * $Id: DefaultConverter.java 161 2012-10-06 13:53:02Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import com.naef.jnlua.util.AbstractTableList; import com.naef.jnlua.util.AbstractTableMap; +import sun.misc.FloatingDecimal; import java.lang.reflect.Array; import java.math.BigDecimal; @@ -24,12 +24,10 @@ public class DefaultConverter implements Converter { * Raw byte array. */ private static final boolean RAW_BYTE_ARRAY = Boolean.parseBoolean(System.getProperty(DefaultConverter.class.getPackage().getName() + ".rawByteArray")); - /** * Static instance. */ private static final DefaultConverter INSTANCE = new DefaultConverter(); - /** * Boolean distance map. */ @@ -221,26 +219,44 @@ public void convert(LuaState luaState, Boolean booleanValue) { }; JAVA_OBJECT_CONVERTERS.put(Boolean.class, booleanConverter); JAVA_OBJECT_CONVERTERS.put(Boolean.TYPE, booleanConverter); - JavaObjectConverter numberConverter = new JavaObjectConverter() { + JavaObjectConverter doubleConverter = new JavaObjectConverter() { @Override public void convert(LuaState luaState, Number number) { - luaState.pushNumber(number.doubleValue()); + Double d=number.doubleValue(); + switch (number.getClass().getSimpleName()) { + case "Double": + luaState.pushNumber((Double)number); + break; + case "Float": + luaState.pushNumber(new FloatingDecimal((Float)number).doubleValue()); + break; + case "BigInteger": + if(number.toString().equals(new BigInteger(d.toString()))) luaState.pushNumber(d); + else luaState.pushString(number.toString()); + break; + case "BigDecimal": + if(number.toString().equals(new BigDecimal(d).toString())) luaState.pushNumber(d); + else luaState.pushString(number.toString()); + break; + default: + luaState.pushNumber(d);; + } } }; - JAVA_OBJECT_CONVERTERS.put(Byte.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Byte.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Short.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Short.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Integer.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Integer.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Long.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Long.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Float.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Float.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Double.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(Double.TYPE, numberConverter); - JAVA_OBJECT_CONVERTERS.put(BigInteger.class, numberConverter); - JAVA_OBJECT_CONVERTERS.put(BigDecimal.class, numberConverter); + JAVA_OBJECT_CONVERTERS.put(Byte.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Byte.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Short.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Short.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Integer.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Integer.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Long.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Long.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Double.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Double.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Float.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(Float.TYPE, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(BigInteger.class, doubleConverter); + JAVA_OBJECT_CONVERTERS.put(BigDecimal.class, doubleConverter); JavaObjectConverter characterConverter = new JavaObjectConverter() { @Override public void convert(LuaState luaState, Character character) { @@ -256,6 +272,19 @@ public void convert(LuaState luaState, String string) { } }; JAVA_OBJECT_CONVERTERS.put(String.class, stringConverter); + final JavaObjectConverter arrayConverter = new JavaObjectConverter() { + @Override + public void convert(LuaState luaState, Object[] obj) { + luaState.newTable(obj.length, 0); + for (int i = 0; i < obj.length; i++) { + luaState.getConverter().convertJavaObject(luaState, obj[i]); + luaState.rawSet(-2, i + 1); + } + } + }; + + JAVA_OBJECT_CONVERTERS.put(Object[].class, arrayConverter); + if (!RAW_BYTE_ARRAY) { JavaObjectConverter byteArrayConverter = new JavaObjectConverter() { @Override @@ -523,6 +552,13 @@ public void convertJavaObject(LuaState luaState, Object object) { javaObjectConverter.convert(luaState, object); return; } + + if (object instanceof Object[]) { + JavaObjectConverter converter = (JavaObjectConverter) JAVA_OBJECT_CONVERTERS.get(Object[].class); + converter.convert(luaState, (Object[]) object); + return; + } + if (object instanceof JavaFunction) { luaState.pushJavaFunction((JavaFunction) object); return; diff --git a/src/main/java/com/naef/jnlua/DefaultJavaReflector.java b/src/main/java/com/naef/jnlua/DefaultJavaReflector.java index abddf92..ba35e98 100644 --- a/src/main/java/com/naef/jnlua/DefaultJavaReflector.java +++ b/src/main/java/com/naef/jnlua/DefaultJavaReflector.java @@ -2,7 +2,6 @@ * $Id: DefaultJavaReflector.java 174 2013-07-28 20:46:22Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import java.beans.BeanInfo; @@ -23,7 +22,6 @@ public class DefaultJavaReflector implements JavaReflector { private static final DefaultJavaReflector INSTANCE = new DefaultJavaReflector(); private static final Object JAVA_FUNCTION_TYPE = new Object(); private static final Object[] EMPTY_ARGUMENTS = new Object[0]; - // -- State private Map, Map> accessors = new HashMap, Map>(); private ReadWriteLock accessorLock = new ReentrantReadWriteLock(); @@ -572,7 +570,6 @@ public String toString() { private static class InvocableProxy implements Invocable { // -- Static private static final Class[] PARAMETER_TYPES = new Class[]{LuaValueProxy.class}; - // -- State private Class interfaze; diff --git a/src/main/java/com/naef/jnlua/JavaFunction.java b/src/main/java/com/naef/jnlua/JavaFunction.java index fa86a90..40409be 100644 --- a/src/main/java/com/naef/jnlua/JavaFunction.java +++ b/src/main/java/com/naef/jnlua/JavaFunction.java @@ -2,7 +2,6 @@ * $Id: JavaFunction.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/JavaModule.java b/src/main/java/com/naef/jnlua/JavaModule.java index 867386e..b08269f 100644 --- a/src/main/java/com/naef/jnlua/JavaModule.java +++ b/src/main/java/com/naef/jnlua/JavaModule.java @@ -2,7 +2,6 @@ * $Id: JavaModule.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import com.naef.jnlua.JavaReflector.Metamethod; @@ -538,7 +537,6 @@ private static class LuaMap implements JavaReflector, TypedJavaObject { // -- Static private static final JavaFunction INDEX = new Index(); private static final JavaFunction NEW_INDEX = new NewIndex(); - // -- State private Map map; @@ -639,7 +637,6 @@ private static class LuaList implements JavaReflector, TypedJavaObject { private static final JavaFunction INDEX = new Index(); private static final JavaFunction NEW_INDEX = new NewIndex(); private static final JavaFunction LENGTH = new Length(); - // -- State private List list; diff --git a/src/main/java/com/naef/jnlua/JavaReflector.java b/src/main/java/com/naef/jnlua/JavaReflector.java index 712f251..cd26b5f 100644 --- a/src/main/java/com/naef/jnlua/JavaReflector.java +++ b/src/main/java/com/naef/jnlua/JavaReflector.java @@ -2,7 +2,6 @@ * $Id: JavaReflector.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** @@ -38,94 +37,58 @@ public enum Metamethod { /** * __index metamethod. */ - INDEX, - - /** + INDEX, /** * __newindex metamethod. */ - NEWINDEX, - - /** + NEWINDEX, /** * __len metamethod. */ - LEN, - - /** + LEN, /** * __eq metamethod. */ - EQ, - - /** + EQ, /** * __lt metamethod. */ - LT, - - /** + LT, /** * __le metamethod. */ - LE, - - /** + LE, /** * __unm metamethod. */ - UNM, - - /** + UNM, /** * __add metamethod. */ - ADD, - - /** + ADD, /** * __sub metamethod. */ - SUB, - - /** + SUB, /** * __mul metamethod. */ - MUL, - - /** + MUL, /** * __div metamethod. */ - DIV, - - /** + DIV, /** * __mod metamethod. */ - MOD, - - /** + MOD, /** * __pow metamethod. */ - POW, - - /** + POW, /** * __concat metamethod. */ - CONCAT, - - /** + CONCAT, /** * __call metamethod. */ - CALL, - - /** + CALL, /** * __tostring metamethod. */ - TOSTRING, - - /** + TOSTRING, /** * __javafields metamethod. */ - JAVAFIELDS, - - /** + JAVAFIELDS, /** * __javamethods metamethod. */ - JAVAMETHODS, - - /** + JAVAMETHODS, /** * __javaproperties metamethod. */ JAVAPROPERTIES; diff --git a/src/main/java/com/naef/jnlua/LuaError.java b/src/main/java/com/naef/jnlua/LuaError.java index 019fa74..13adecb 100644 --- a/src/main/java/com/naef/jnlua/LuaError.java +++ b/src/main/java/com/naef/jnlua/LuaError.java @@ -2,7 +2,6 @@ * $Id: LuaError.java 154 2012-02-01 20:40:01Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import java.io.PrintWriter; diff --git a/src/main/java/com/naef/jnlua/LuaException.java b/src/main/java/com/naef/jnlua/LuaException.java index dd1eff4..2770843 100644 --- a/src/main/java/com/naef/jnlua/LuaException.java +++ b/src/main/java/com/naef/jnlua/LuaException.java @@ -2,7 +2,6 @@ * $Id: LuaException.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaGcMetamethodException.java b/src/main/java/com/naef/jnlua/LuaGcMetamethodException.java index 8b849de..0b000f4 100644 --- a/src/main/java/com/naef/jnlua/LuaGcMetamethodException.java +++ b/src/main/java/com/naef/jnlua/LuaGcMetamethodException.java @@ -2,7 +2,6 @@ * $Id$ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaMemoryAllocationException.java b/src/main/java/com/naef/jnlua/LuaMemoryAllocationException.java index 88993b0..f2a6dcc 100644 --- a/src/main/java/com/naef/jnlua/LuaMemoryAllocationException.java +++ b/src/main/java/com/naef/jnlua/LuaMemoryAllocationException.java @@ -2,7 +2,6 @@ * $Id: LuaMemoryAllocationException.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaMessageHandlerException.java b/src/main/java/com/naef/jnlua/LuaMessageHandlerException.java index ba52e4a..26c3ddb 100644 --- a/src/main/java/com/naef/jnlua/LuaMessageHandlerException.java +++ b/src/main/java/com/naef/jnlua/LuaMessageHandlerException.java @@ -2,7 +2,6 @@ * $Id: LuaMessageHandlerException.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaRuntimeException.java b/src/main/java/com/naef/jnlua/LuaRuntimeException.java index 0eea710..a449e12 100644 --- a/src/main/java/com/naef/jnlua/LuaRuntimeException.java +++ b/src/main/java/com/naef/jnlua/LuaRuntimeException.java @@ -2,7 +2,6 @@ * $Id: LuaRuntimeException.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import java.io.PrintStream; @@ -21,7 +20,6 @@ public class LuaRuntimeException extends LuaException { // -- Static private static final long serialVersionUID = 1L; private static final LuaStackTraceElement[] EMPTY_LUA_STACK_TRACE = new LuaStackTraceElement[0]; - // -- State private LuaStackTraceElement[] luaStackTrace; diff --git a/src/main/java/com/naef/jnlua/LuaStackTraceElement.java b/src/main/java/com/naef/jnlua/LuaStackTraceElement.java index 679100f..aebe4bf 100644 --- a/src/main/java/com/naef/jnlua/LuaStackTraceElement.java +++ b/src/main/java/com/naef/jnlua/LuaStackTraceElement.java @@ -2,7 +2,6 @@ * $Id: LuaStackTraceElement.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaState.java b/src/main/java/com/naef/jnlua/LuaState.java index e6995b3..52334ed 100644 --- a/src/main/java/com/naef/jnlua/LuaState.java +++ b/src/main/java/com/naef/jnlua/LuaState.java @@ -2,7 +2,6 @@ * $Id: LuaState.java 156 2012-10-05 22:57:25Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; import com.naef.jnlua.JavaReflector.Metamethod; @@ -80,32 +79,26 @@ public class LuaState { * Registry pseudo-index. */ public static final int REGISTRYINDEX = -10000; - /** * Environment pseudo-index. */ public static final int ENVIRONINDEX = -10001; - /** * Globals pseudo-index. */ public static final int GLOBALSINDEX = -10002; - /** * Multiple returns pseudo return value count. */ public static final int MULTRET = -1; - /** * Status indicating that a thread is suspended. */ public static final int YIELD = 1; - /** * The JNLua version. The format is <major>.<minor>. */ public static final String VERSION = "0.9"; - /** * The Lua version. The format is <major>.<minor>. */ @@ -121,27 +114,23 @@ public class LuaState { } // -- State - /** * Whether the lua_State on the JNI side is owned by the Java * state and must be closed when the Java state closes. */ private boolean ownState; - /** * The lua_State pointer on the JNI side. 0 * implies that this Lua state is closed. The field is modified exclusively * on the JNI side and must not be touched on the Java side. */ private long luaState; - /** * The lua_State pointer on the JNI side for the running * coroutine. This field is modified exclusively on the JNI side and must * not be touched on the Java side. */ private long luaThread; - /** * The maximum amount of memory the may be used by the Lua state, in bytes. * This can be adjusted to limit the amount of memory a state may use. If @@ -149,38 +138,31 @@ public class LuaState { * memory errors. */ private int luaMemoryTotal; - /** * The amount of memory currently used by the Lua state, in bytes. This is * set from the JNI side and must not be modified from the Java side. */ private int luaMemoryUsed; - /** * Ensures proper finalization of this Lua state. */ private Object finalizeGuardian; - /** * The class loader for dynamically loading classes. */ private ClassLoader classLoader; - /** * Reflects Java objects. */ private JavaReflector javaReflector; - /** * Converts between Lua types and Java types. */ private Converter converter; - /** * Set of Lua proxy phantom references for pre-mortem cleanup. */ private Set proxySet = new HashSet(); - /** * Reference queue for pre-mortem cleanup. */ @@ -544,7 +526,7 @@ public synchronized void register(NamedJavaFunction namedJavaFunction) { public synchronized void register(String moduleName, NamedJavaFunction[] namedJavaFunctions) { check(); /* - * The following code corresponds to luaL_openlib() and must be kept in + * The following code corresponds to luaL_openlib() and must be kept in * sync. The original code cannot be called due to the necessity of * pushing each C function with an individual closure. */ @@ -1587,7 +1569,6 @@ public synchronized int yield(int returnCount) { public synchronized int ref(int index) { check(); return lua_ref(index); - } /** @@ -2229,56 +2210,36 @@ public enum Library { /** * The base library, including the coroutine functions. */ - BASE, - - /** + BASE, /** * The table library. */ - TABLE, - - /** + TABLE, /** * The IO library. */ - IO, - - /** + IO, /** * The OS library. */ - OS, - - /** + OS, /** * The string library. */ - STRING, - - /** + STRING, /** * The math library. */ - MATH, - - /** + MATH, /** * The debug library. */ - DEBUG, - - /** + DEBUG, /** * The package library. */ - PACKAGE, - BIT, - JIT, - FFI, - - - /** + PACKAGE, BIT, JIT, FFI, /** * The Java library. */ JAVA { - @Override - void open(LuaState luaState) { - JavaModule.getInstance().open(luaState); - } - }; + @Override + void open(LuaState luaState) { + JavaModule.getInstance().open(luaState); + } + }; // -- Methods @@ -2298,39 +2259,25 @@ public enum GcAction { /** * Stop. */ - STOP, - - /** + STOP, /** * Restart. */ - RESTART, - - /** + RESTART, /** * Collect. */ - COLLECT, - - /** + COLLECT, /** * Count memory in kilobytes. */ - COUNT, - - /** + COUNT, /** * Count reminder in bytes. */ - COUNTB, - - /** + COUNTB, /** * Step. */ - STEP, - - /** + STEP, /** * Set pause. */ - SETPAUSE, - - /** + SETPAUSE, /** * Set step multiplier. */ SETSTEPMUL diff --git a/src/main/java/com/naef/jnlua/LuaSyntaxException.java b/src/main/java/com/naef/jnlua/LuaSyntaxException.java index 8f8cbb1..c6c7009 100644 --- a/src/main/java/com/naef/jnlua/LuaSyntaxException.java +++ b/src/main/java/com/naef/jnlua/LuaSyntaxException.java @@ -2,7 +2,6 @@ * $Id: LuaSyntaxException.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/LuaType.java b/src/main/java/com/naef/jnlua/LuaType.java index 0306e43..6f08e3c 100644 --- a/src/main/java/com/naef/jnlua/LuaType.java +++ b/src/main/java/com/naef/jnlua/LuaType.java @@ -2,7 +2,6 @@ * $Id: LuaType.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** @@ -13,44 +12,28 @@ public enum LuaType { /** * Nil. */ - NIL, - - /** + NIL, /** * Boolean. */ - BOOLEAN, - - /** + BOOLEAN, /** * Light user data (pointer). */ - LIGHTUSERDATA, - - /** + LIGHTUSERDATA, /** * Number. */ - NUMBER, - - /** + NUMBER, /** * String. */ - STRING, - - /** + STRING, /** * Table. */ - TABLE, - - /** + TABLE, /** * Function. */ - FUNCTION, - - /** + FUNCTION, /** * User data. */ - USERDATA, - - /** + USERDATA, /** * Thread. */ THREAD; diff --git a/src/main/java/com/naef/jnlua/LuaValueProxy.java b/src/main/java/com/naef/jnlua/LuaValueProxy.java index 7b85811..bdf8d8a 100644 --- a/src/main/java/com/naef/jnlua/LuaValueProxy.java +++ b/src/main/java/com/naef/jnlua/LuaValueProxy.java @@ -2,7 +2,6 @@ * $Id: LuaValueProxy.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/NamedJavaFunction.java b/src/main/java/com/naef/jnlua/NamedJavaFunction.java index c372a08..e5957c0 100644 --- a/src/main/java/com/naef/jnlua/NamedJavaFunction.java +++ b/src/main/java/com/naef/jnlua/NamedJavaFunction.java @@ -2,7 +2,6 @@ * $Id: NamedJavaFunction.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/NativeSupport.java b/src/main/java/com/naef/jnlua/NativeSupport.java index 938bdf0..3f62993 100644 --- a/src/main/java/com/naef/jnlua/NativeSupport.java +++ b/src/main/java/com/naef/jnlua/NativeSupport.java @@ -2,7 +2,6 @@ * $Id: NativeSupport.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** @@ -19,7 +18,6 @@ public final class NativeSupport { // -- Static private static final NativeSupport INSTANCE = new NativeSupport(); - // -- State private Loader loader = new DefaultLoader(); diff --git a/src/main/java/com/naef/jnlua/TypedJavaObject.java b/src/main/java/com/naef/jnlua/TypedJavaObject.java index f3d0012..ca177eb 100644 --- a/src/main/java/com/naef/jnlua/TypedJavaObject.java +++ b/src/main/java/com/naef/jnlua/TypedJavaObject.java @@ -2,7 +2,6 @@ * $Id: TypedJavaObject.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua; /** diff --git a/src/main/java/com/naef/jnlua/console/LuaConsole.java b/src/main/java/com/naef/jnlua/console/LuaConsole.java index 720ef05..4262945 100644 --- a/src/main/java/com/naef/jnlua/console/LuaConsole.java +++ b/src/main/java/com/naef/jnlua/console/LuaConsole.java @@ -2,7 +2,6 @@ * $Id: LuaConsole.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.console; import com.naef.jnlua.LuaException; diff --git a/src/main/java/com/naef/jnlua/script/CompiledLuaScript.java b/src/main/java/com/naef/jnlua/script/CompiledLuaScript.java index 43c782f..108c5c0 100644 --- a/src/main/java/com/naef/jnlua/script/CompiledLuaScript.java +++ b/src/main/java/com/naef/jnlua/script/CompiledLuaScript.java @@ -2,7 +2,6 @@ * $Id: CompiledLuaScript.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.script; import javax.script.CompiledScript; diff --git a/src/main/java/com/naef/jnlua/script/LuaBindings.java b/src/main/java/com/naef/jnlua/script/LuaBindings.java index 698c039..e59236e 100644 --- a/src/main/java/com/naef/jnlua/script/LuaBindings.java +++ b/src/main/java/com/naef/jnlua/script/LuaBindings.java @@ -2,7 +2,6 @@ * $Id: LuaBindings.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.script; import com.naef.jnlua.LuaState; diff --git a/src/main/java/com/naef/jnlua/script/LuaScriptEngine.java b/src/main/java/com/naef/jnlua/script/LuaScriptEngine.java index dfb5b46..647ccc2 100644 --- a/src/main/java/com/naef/jnlua/script/LuaScriptEngine.java +++ b/src/main/java/com/naef/jnlua/script/LuaScriptEngine.java @@ -2,7 +2,6 @@ * $Id: LuaScriptEngine.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.script; import com.naef.jnlua.LuaException; @@ -28,7 +27,6 @@ class LuaScriptEngine extends AbstractScriptEngine implements Compilable, Invoca private static final String WRITER = "writer"; private static final String ERROR_WRITER = "errorWriter"; private static final Pattern LUA_ERROR_MESSAGE = Pattern.compile("^(.+):(\\d+):"); - // -- State private LuaScriptEngineFactory factory; private LuaState luaState; @@ -293,7 +291,6 @@ void dumpChunk(OutputStream out) throws ScriptException { } catch (IOException e) { throw new ScriptException(e); } - } // -- Private methods @@ -348,7 +345,6 @@ private ScriptException getScriptException(LuaException e) { private static class ReaderInputStream extends InputStream { // -- Static private static final Charset UTF8 = Charset.forName("UTF-8"); - // -- State private Reader reader; private CharsetEncoder encoder; diff --git a/src/main/java/com/naef/jnlua/script/LuaScriptEngineFactory.java b/src/main/java/com/naef/jnlua/script/LuaScriptEngineFactory.java index a0a7f01..b5749a7 100644 --- a/src/main/java/com/naef/jnlua/script/LuaScriptEngineFactory.java +++ b/src/main/java/com/naef/jnlua/script/LuaScriptEngineFactory.java @@ -2,7 +2,6 @@ * $Id: LuaScriptEngineFactory.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.script; import com.naef.jnlua.LuaState; diff --git a/src/main/java/com/naef/jnlua/util/AbstractTableList.java b/src/main/java/com/naef/jnlua/util/AbstractTableList.java index d07545a..23a8d83 100644 --- a/src/main/java/com/naef/jnlua/util/AbstractTableList.java +++ b/src/main/java/com/naef/jnlua/util/AbstractTableList.java @@ -2,7 +2,6 @@ * $Id: AbstractTableList.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.util; import com.naef.jnlua.LuaState; diff --git a/src/main/java/com/naef/jnlua/util/AbstractTableMap.java b/src/main/java/com/naef/jnlua/util/AbstractTableMap.java index f40d2f0..76c7857 100644 --- a/src/main/java/com/naef/jnlua/util/AbstractTableMap.java +++ b/src/main/java/com/naef/jnlua/util/AbstractTableMap.java @@ -2,7 +2,6 @@ * $Id: AbstractTableMap.java 121 2012-01-22 01:40:14Z andre@naef.com $ * See LICENSE.txt for license terms. */ - package com.naef.jnlua.util; import com.naef.jnlua.LuaState;