[bindings] Fixing Lua and Java bindings for SWIG versions older than 2.0.7