update for support of modern JDKs #113

Closed
fabrice-ducos wants to merge 26 commits from fabrice-ducos/master into master
Showing only changes of commit 2207f7f2e2 - Show all commits

View File

@@ -21,7 +21,8 @@
******************************************************************************/ ******************************************************************************/
package org.luaj.vm2.compiler; package org.luaj.vm2.compiler;
import java.util.Hashtable; import java.util.Map;
import java.util.HashMap;
import org.luaj.vm2.LocVars; import org.luaj.vm2.LocVars;
import org.luaj.vm2.Lua; import org.luaj.vm2.Lua;
@@ -47,7 +48,7 @@ public class FuncState extends Constants {
}; };
Prototype f; /* current function header */ Prototype f; /* current function header */
Hashtable h; /* table to find (and reuse) elements in `k' */ Map<LuaValue, Integer> h; /* table to find (and reuse) elements in `k' */
FuncState prev; /* enclosing function */ FuncState prev; /* enclosing function */
LexState ls; /* lexical state */ LexState ls; /* lexical state */
BlockCnt bl; /* chain of current blocks */ BlockCnt bl; /* chain of current blocks */
@@ -474,7 +475,7 @@ public class FuncState extends Constants {
} }
int addk(LuaValue v) { int addk(LuaValue v) {
if (this.h == null) { if (this.h == null) {
this.h = new Hashtable(); this.h = new HashMap<>();
} else if (this.h.containsKey(v)) { } else if (this.h.containsKey(v)) {
return ((Integer) h.get(v)).intValue(); return ((Integer) h.get(v)).intValue();
} }