From 2207f7f2e2dc3057d77abdb6afa354c5e0023524 Mon Sep 17 00:00:00 2001 From: Fabrice Ducos Date: Sun, 23 Apr 2023 12:58:56 +0200 Subject: [PATCH] src/core/org/luaj/vm2/compiler/FuncState.java: Replaced the deprecated, non generic Hashtable with generic Map (interface) and HashMap (implementation) Hashtable h -> Map h this.h = new Hashtable() -> this.h = new HashMap<>() --- src/core/org/luaj/vm2/compiler/FuncState.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/org/luaj/vm2/compiler/FuncState.java b/src/core/org/luaj/vm2/compiler/FuncState.java index 98534d50..049c60c2 100644 --- a/src/core/org/luaj/vm2/compiler/FuncState.java +++ b/src/core/org/luaj/vm2/compiler/FuncState.java @@ -21,7 +21,8 @@ ******************************************************************************/ 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.Lua; @@ -47,7 +48,7 @@ public class FuncState extends Constants { }; Prototype f; /* current function header */ - Hashtable h; /* table to find (and reuse) elements in `k' */ + Map h; /* table to find (and reuse) elements in `k' */ FuncState prev; /* enclosing function */ LexState ls; /* lexical state */ BlockCnt bl; /* chain of current blocks */ @@ -474,7 +475,7 @@ public class FuncState extends Constants { } int addk(LuaValue v) { if (this.h == null) { - this.h = new Hashtable(); + this.h = new HashMap<>(); } else if (this.h.containsKey(v)) { return ((Integer) h.get(v)).intValue(); }