gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.5k stars 371 forks source link

Java 11 JRE emulation #9831

Open rjeeb opened 1 year ago

rjeeb commented 1 year ago

Methods to support:

String:

Predicate:

OptionalDouble:

OptionalDouble:

OptionalLong:

niloc132 commented 5 months ago

Predicate and Optional* are all merged.

String.format() is likely not feasible - it requires parsing the format string at runtime, and handling the various possible patterns. That sort of code can't be optimized by the compiler without knowing ahead of time what all format strings will be. https://github.com/gwtproject/gwt/blob/e981e97325e0bbf8b16b407143ac297d7f07be01/user/super/com/google/gwt/emul/java/lang/String.java#L71-L73

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html#syntax

In theory we could require that the format param will be a string literal and pre-compile the formats so that unused formatting code can be pruned. In practice, that sort of change likely wouldn't be accepted to j2cl, so we should consider carefully if we want to introduce that incompatibility.