Friday, July 21, 2023

Re: Partial super source? Possible?

I don't use String.format() a lot, even in the normal JVM, but based on the Javadoc it looks like we could add the format method, and delegate to a java.util.Formatter, but then leave that unimplemented by default. Then, downstream applications could more easily add that, without having to worry about keeping the rest of String.java up to date?

Note also when trying to do anything beyond simple %s replacement, the java.util.Locale type exists in GWT emulation, but offers no instance methods outside of toString.

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#format(java.lang.String,java.lang.Object...)
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html


On Friday, July 21, 2023 at 4:38:24 AM UTC-5 Thomas Broyer wrote:
GWT standard emulation is "just" super-source itself. You cannot "augment" it, but you can "shadow" it by providing your own super-source version of java.lang.String (copy from GWT and patch; and make sure it appears before GWT's emulation in the source path – i.e. IIRC make sure the <super-source> comes before any <include> that would bring com.google.gwt.emul.Emulation). This means you'll have to update your version whenever GWT updates its own.
But only ever do this for an application, never for a library!

On Thursday, July 20, 2023 at 1:46:15 PM UTC+2 Bruno Salmon wrote:
hi,

If GWT emulates a Java class but not all methods, is it possible to provide a complement as a super source?

For example, can I provide a super source for String.format() while keeping other String methods emulated by GWT?

Thanks

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/86163e40-07e8-47de-9ce9-4abfd81df242n%40googlegroups.com.

No comments:

Post a Comment