You are on page 1of 78

GWTCon 2015 Keynote

11/11/2015

+JulienDramaix
@jDramaix
Confidential & Proprietary

Last Year at GWTCon...

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Progress since last year.

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

GSS: status
Stable and not experimental anymore.

GSS: status
Stable and not experimental anymore.
Used in production at Google.

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

Not turned on by default.

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

Not turned on by default.


Simpler and smoother transition to GWT 2.8!

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

Not turned on by default.


Simpler and smoother transition to GWT 2.8!

Improve CSS of your application

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

Not turned on by default.


Simpler and smoother transition to GWT 2.8!

Improve CSS of your application


Detect css errors sooner and reduce the size of your application CSS.

GSS: status
Stable and not experimental anymore.
Used in production at Google.
Old CssResource deprecated

Not turned on by default.


Simpler and smoother transition to GWT 2.8!

Improve CSS of your application


Detect css errors sooner and reduce the size of your application CSS.

You need to migrate now!

GSS: GWT 2.8 new features


For loop
@for $i from 1 to 12 {
.col-$i {
width: mult(100%, divide($i, 12));
}
@for $j from 1 to $i {
.col-$i .col-$j {
width: mult(100%, divide($j, $i));
}
}
}

.col-1 {
width: 8.333333%
}

GSS: GWT 2.8 new features

.col-1 .col-1 {
width: 100%
}

For loop

.col-2 {
width: 16.666667%
}

@for $i from 1 to 12 {
.col-$i {
width: mult(100%, divide($i, 12));
}
@for $j from 1 to $i {
.col-$i .col-$j {
width: mult(100%, divide($j, $i));
}
}
}

.col-2 .col-1 {
width: 50%
}

generates

.col-2 .col-2 {
width: 100%
}
.col-3 {
width: 25%
}
.col-3 .col-1 {
width: 33.333333%
}
...

GSS: GWT 2.8 new features


concat() function
@def HOST foo.bar.com
.img {
background-image: url(
concat('//', HOST, '/image.png')
);
}

GSS: GWT 2.8 new features


concat() function
@def HOST foo.bar.com
.img {
background-image: url(
concat('//', HOST, '/image.png')
);
}

.img {
background-image:url('//foo.bar.com/image.png');
}

GSS: GWT 2.8 new features


@gen-webkit-keyframes annotation
/* @gen-webkit-keyframes */
@keyframes myframe {
from {
top: 0px;
}
to {
top: 200px;
}
}

GSS: GWT 2.8 new features


@gen-webkit-keyframes annotation
/* @gen-webkit-keyframes */
@keyframes myframe {
from {
top: 0px;
}
to {
top: 200px;
}
}

@keyframes myframe {
0% {
top: 0
}
to {
top: 200px
}
}

generates
@-webkit-keyframes myframe {
0% {
top: 0
}
to {
top: 200px
}
}

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Faster super dev mode with Incremental compilation.


6-7x faster for average app.

Faster super dev mode.


Speedup of 6-7x for average app!
100% of GWT apps at Google use SDM with incremental
compilation!
If you have opted out, its time to use it.

Production compilation improved


Compilation speed improvement: 20% faster for big
application.

Production compilation improved


Compilation speed improvement: 20% faster for big
application.
More optimal and smaller code.

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Proprietary + Confidential

JsInterop: New simpler specification

Proprietary + Confidential

JsInterop: New simpler specification


Java
package foo;
@JsType
public class Bar {
public boolean bool = true;
public Bar() {}
public String foo() { return "Hello GWTCon!";}
}

Expose your Object to


JavaScript world.

Proprietary + Confidential

JsInterop: New simpler specification


Java
package foo;
@JsType
public class Bar {
public boolean bool = true;
public Bar() {}
public String foo() { return "Hello GWTCon!";}
}

Expose your Object to


JavaScript world.

JavaScript
var bar = new foo.Bar();
if (bar.bool) {
alert(bar.foo());
}

JavaScript can use your public


API of exposed Java objects.

Proprietary + Confidential

JsInterop: New simpler specification


Java
@JsType(isNative = true)
public abstract class JQuery {
@JsMethod(namespace=GLOBAL)
public native static JQuery $(String selector);
public native JQuery css(String prop, String val);
public native JQuery attr(String name, String val);
}

Use native JsType to use any


existing JavaScript library.

Proprietary + Confidential

JsInterop: New simpler specification


Java
@JsType(isNative = true)
public abstract class JQuery {
@JsMethod(namespace=GLOBAL)
public native static JQuery $(String selector);
public native JQuery css(String prop, String val);
public native JQuery attr(String name, String val);

Use native JsType to use any


existing JavaScript library.

Java
import static jquery.JQuery.$;
// ...
$("ul > li").css("color", "red").attr("data-level", "first");

Use it like JavaScript

Proprietary + Confidential

Want to know more ?

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Interop with JavaScript


Compile time
Java8 support
Web components
support

Google Closure Style Sheet

Source mapping
many more

IDE integration

Runtime performance improved


HashMap
Put operations are 2.8x faster.

Long
Division are 5x faster.

Double/Boolean are not boxed anymore.

Generic Accessor for GWT Properties


.gwt.xml
<define-property values="true,false" name="foo.bar" />
<set-property name="foo.bar" value="false" />

java
if ("true".equals(System.getProperty("foo.bar"))
&& "ie8".equals(System.getProperty("user.agent"))) {
// do something
}

Access any configuration or


binding property at compile
time.

GWT 2.8

Proprietary + Confidential

GWT 2.8 Beta released.

GWT 2.8 Beta released.


Please test and report bugs

GWT 2.8 Beta released.


Please test and report bugs
Especially for JsInterop!

Expect Official release in a


month if everything looks fine.

The future

GWT has a lot of burden.

GWT is...
10 years old

GWT is...
10 years old
Decisions made at that time are not longer ideal

GWT is...
10 years old
Decisions made at that time are not longer ideal

doing too much

GWT is...
10 years old
Decisions made at that time are not longer ideal

doing too much


Permutations, generators, optimisations, changed file tracking, servlet hosting, custom test
runner, dependency injection, huge library space

GWT is...
10 years old
Decisions made at that time are no longer ideal

doing too much


Permutations, generators, optimisations, changed file tracking, servlet hosting, custom test
runner, dependency injection, huge library space

Others actors of the development stack can now


manage these responsibilities.

GWT is loved for its


performance but hated for its
development slowness.

Google is developing a new


Java-to-JavaScript transpiler.

J2CL
pronounced Jackal

J2CL
pronounced Jackal

"Canis mesomelas" by Hans Hillewaert.


Licensed under CC BY-SA 4.0

J2CL is...
source to source transpiler,
Takes Java 8 code as input and outputs readable ECMAScript 6 with JsDoc Closure style annotations.

targeting Modern Js features,


blazing fast,
fully integrated with Closure compiler.
Optimizations will be made by Closure compiler.

J2CL is...
not an optimizer or linker,
Rely on Closure compiler.

not a dependency injector,


Rely on user land (Dagger2, )

not proprietary generators,


Rely on APT

not a web toolkit,


Rely on JsInterop and third-party libraries

No roadmap available yet.

Dont take it wrong:


GWT is not dead!

GWT is a mature framework.

GWT 2.8 will be a long


maintenance release.

GWT 3.0: What, When, How ?

GWT 3.0: What, When, How ?


We dont know yet.

GWT can still survive to the


next 10 years.

Proprietary + Confidential

How to prepare your app for


the future?

Use JsInterop instead of


JSNI/JSO

Use APT instead of GWT


generators.

Use Dagger instead Gin/Guice

Use modern framework instead


of classic gwt libs.

THANK YOU
+JulienDramaix
@jDramaix

QUESTIONS ?
+JulienDramaix
@jDramaix

You might also like