function func(arg) { (function() { print(eval('this')); }).call(arg); } func(this); func({}); func({ toString: function() "foo" }); func(new java.lang.Vector()); Expected: [object global] [object Object] foo [] Last one is toString value on empty Vector instance Actual output: [object global] [object Object] foo [object global]