Yup, wrong track.
they are NOT the same calls. One creates an empty javascript object,
and is functionally completely equivalent to:
var jso = {};
in javascript. GWT can NOT interact AT ALL with javascript stuff, save
some obscure low-level stuff in the DOM static utility class, and, of
course, JSNI. Therefore, JavaScriptObject.createObject(); is useless
from a GWT perspective; it might have a little use if you're
integrating with legacy javascript or you want to use deeply
interwoven non-GWT JS libraries.
new Object(); does something entirely different; it creates a java
object. GWT of course emulates this java object with a javascript
object; it has to compile down to the JS platform, after all. However,
this particular JSO is filled with a bunch of extra functions and
attributes (including a string that contains 'java.lang.Object', and
probably some stuff for a more java-esque hashCode, toString, and
equals). Because of obfuscation, you already can't use even 'new
Object' as a javascript entity with a publically mutable namespace.
Let's put this somewhat differently:
There *IS NO* GWT equivalent to 'myJavascriptO['prop'] = value' - 'all
objects are hashmaps' is a programming paradigm used by javascript,
ruby, python, and other languages, but NOT by java. And therefore,
not by GWT. If you need to do this thing, you'll need to either A)
dip into JSNI or B) use a simplistic wrapper method, which might even
exist in the GWT core libraries, but if it does, it will be in 'low
level glue' like e.g. DOM.*, and you're not supposed to use it in an
actual app unless you know what you're doing (read: know a LOT of
javascript, css, html, and the specifics of how GWT works internally),
or you'll cause obscure bugs, memory leakage, and other Bad Things.
Perhaps you should explain what you're trying to do on a lower level,
because if you think the solution is "I'll toss some undeclared
properties into a GWT object", you came up with the wrong solution.
That's the right answer in many languages, but not in java.