Wednesday, November 18, 2015

Re: What is j2cl?

Marko, even is the closure libs were extended to look like java Map/Set, that does not replace the need to emulate Map/Set.

Gwt already has its own versions of HashMap and ilk, and even if they could compile them directly to closure types,
we would STILL need to use the java.util.* apis, because the whole point of a java transpiler is that you can use all the core types across all your environments.

Consider the typical cross platform project... web, android, ios (via j2objc, etc).
If you want to share code between them, you use types they all have (Map, Set, List, etc).
If you have platform specific code, you can use a js map or whatever you have.

On Saturday, October 24, 2015 at 9:48:06 AM UTC-7, Marko wrote:
Thank you Thomas for this answer! This is great!

Replacing JRE emulation with Closure Library (java.util.HashMap => goog.structs.Map, java.util.Set => goog.structs.Set, etc.) would eliminate the need for JRE emulation and protect us in case Oracle wins in court. I guess that in this case Closure Library will need to be extended with some methods and classes in order to provide functionality which is present today in JRE emulation library. But this can also be done later (j2cl v2.0).


On Saturday, October 24, 2015 at 12:31:40 AM UTC+2, Thomas Broyer wrote:

On Saturday, October 24, 2015 at 12:14:17 AM UTC+2, Marko wrote:
I see the term "j2cl" comming up in several threads connected with GWT 3.0. What does it mean?

I speculate that this is a "Java-to-Closure-Library" transpiler, which would be GREAT, because you wouldn't depend on JRE emulation library anymore and GWT 3.0 would be safe from "Oracle copyright lawsuit nonsense". Additionally you could integrate JavaScript Closure Library code with Java code transpiled to Closure Library and it would use the exactly same class library... I guess also that Google would profit from such a transpiler in Google Inbox and other similar projects...

I hope I am not speculating too much into the Google's trade secrets and that this post will not be deleted because of this... :-)

You're almost right (Googlers will correct me if I'm wrong).

j2cl stands for Java-to-CLosure. It's not much about the Closure Library but rather the Closure Compiler. It's a transpiler from Java to Closure-annotated ES6 (there are a couple videos about this from the GWT Meetup earlier this year: ), type annotations will help the Closure Compiler prune unused code to further optimize the produced JS.

But it won't free us from the JRE emulation library.

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment