I sincerely doubt that is even possible, because:
> On Nov 18, 2:27 pm, Jason Morris <lem...@gmail.com> wrote:
>> You can't use java.lang.ref on the client side, because JavaScript has no notion of weak, soft, or
>> phantom references. You can however use the java.lang.ref package on the server.
The java.lang.ref.* classes work intimately with the JVM to give the
user some insight into the memory management cycle. The Javascript
"VM" doesn't allow that insight because there's no API for it.
Someone with more theoretical background can correct me if I'm wrong,
but I'm pretty sure the only way to implement java.lang.ref.* in the
browser is to emulate a JVM in Javascript and run GWT on top of that.
That would be an enormous undertaking and it would require
rearchitecting and rewriting all of the client side infrastructure.
In other words, I feel pretty safe saying "it ain't gonna happen".
Ian
Yes, if you "implement a JS code that behaves like a java.lang.ref.*
reference", then you've implemented java.lang.ref.* and the rest of
your requests are trivial. Jason Morris and I have already tried to
highlight the impossibility of implementing any such thing. The
Javascript interpreter doesn't provide any hooks for doing what you're
asking.
If you want to get all technical, Javascript is a Turing-complete
language so you could, in principle, simulate an entire JVM and run
.class files on top of that. Do so would be largely ludicrous--if you
want to run Java in the browser, write an applet and run Java in the
browser, don't reinvent the wheel badly.
Restricting ourselves to things that have a chance of being
incorporated into GWT leaves us with the conclusion that
java.lang.ref.* can't and won't be done.
> JS code can be a mediator between objects and let them erase
> references when the letter are not needed anymore.
I don't understand what you mean here. Javascript code is nothing
except a mediator between objects because Javascript is an
object-oriented language. Every single Javascript program ever
written and ever to be written will do nothing _except_ mediate
objects. That doesn't give such programs some kind of magical ability
to peer into the Javascript interpreter and divine when a particular
reference is no longer needed.
> A change must be
> made in Java-to-JavaScript compiler.
No, a change must be made in your design such that you no longer need
or want java.lang.ref.* because the Java-to-Javascript compiler can't
create features in the Javascript interpreter.
Ian