The trick seems to be that it is not going to be possible to add Java8 emul code without actually using Java8 - while lambdas can be avoided, defender methods cannot. If you need to provide a new interface like Consumer, the supersource *must* have the `default` method(s), or it won't actually be Consumer.
If it were just those types, it would be possible to move them into their own module so developers would need to inherit's the Java8 module to get access to them, but the Collection interface itself needs to be changed to add `default Stream<E> stream()`, plus the implementation, or else all implementors of Collection (and Set and List) need to have an implementation added. Even then, Stream would need to be emulated, which references Consumer, so we can't have it be a separate module... ...or am I over-complicating matters? On Wed, Mar 25, 2015 at 10:20 AM John A. Tamplin <[email protected]> wrote: > On Wed, Mar 25, 2015 at 11:16 AM, Jens <[email protected]> wrote: > >> whats the current situation of adding Java8 emulations to GWT? >> >> I would like to fix the current emulation of @FunctionalInterface (wrong >> package and missing imports), add java.util.Optional[Int|Long|Double] >> emulation and like to see java.util.function interfaces in trunk committed. >> That would allow us to further work on stream API emulation which would be >> nice to have in GWT 2.8, right? Just having Java8 syntax support seems a >> little weak to me for a new release. >> > > Adding new classes should be pretty straightforward. > > >> Currently my patch for java.util.function can not be verified by Jenkins >> because it runs the presubmit task with sourceLevel 1.7 (and Java7 I >> think). So I assume that the next GWT release should be compatible to >> Java7. >> >> Does this mean that any emulation of Java8 APIs should be done using >> Java7 syntax ( = no lambdas in emulation code) ? What about default methods >> in emulated code when people use JDK 7 with GWT? >> > > That would be my vote - we don't want to force people to use Java8 just > yet. > > -- > John A. Tamplin > > -- > You received this message because you are subscribed to the Google Groups > "GWT Contributors" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM5k6X-xtnTX_xXPPr4M9AsFP_qNQHZU_9k_VJP5o4ZjLYknWw%40mail.gmail.com > <https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM5k6X-xtnTX_xXPPr4M9AsFP_qNQHZU_9k_VJP5o4ZjLYknWw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CADcXZMxJV4ES0SiMeDsMSaw9zrPCZhYq2sTkJoZVgcpxF59%2BHA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
