java.time

512 views
Skip to first unread message

Adrian Smith

unread,
Jul 24, 2019, 5:32:33 AM7/24/19
to GWT Users
Please excuse me if this topic has been discussed before. I did look but I didn't find anything recent.

I was looking to use java.time with GWT. I saw it was not supported "out of the box" in 2.8.2. I looked around for libraries and found https://github.com/m-m-m/gwt-time. It was not complete, but I fixed a few things and it worked well enough for me.

What do you use for java.time? Do you use that library, or something else?

The original maintainer of the m-m-m project was helpful, but not interested in continuing maintenance. I have offered to take offer this project, so now it lives in my GitHub repository.

This is my understanding of the situation:
  • The code originated from another project, but is used with permission.
  • The code is copyright some other people, therefore, I imagine it cannot be merged with GWT core.
  • There is a lot missing:
    • I'm not convinced all classes are implemented? The ones I was looking for are implemented, but there might be others that are not.
    • It was never designed for GWT so it uses concurrent maps in some place (easy enough to replace with normal maps), java.util.Locale in some places.
    • It doesn't have converters to allow seriazliation of the types from client to the server.
    • There are no tests
  • The code is not currently on Maven Central. The procedure is checking out from Git, doing "mvn install", then using it. I would be happy to publish it to Maven Central if there was interest.
  • The current version numbering mirrors GWT, so it's currently "2.8.2-SNAPSHOT". I'm not sure this is really helpful.
So I am going to slowly improve the code for my usage (i.e. where my project needs a class or encounters a bug, I will make the change and publish it). I have added the facility for LocalDate to be sent between the client and the server (that is the only class I need at the moment) so adding client-server communication for other classes should be easy too.

I welcome your thoughts. You are welcome to use it, and of course pull requests are welcome too. If there is another implementation that is better, I am happy to abandon this repository and use (and submit pull requests to) the better one.

Jens

unread,
Jul 24, 2019, 5:50:10 AM7/24/19
to GWT Users
The only other library I am aware of is gwt-joda-java-time which uses js-joda which itself is a JavaScript port of ThreeTen (which is also the base implementation used for the gwt-time project you took ownership of).

gwt-joda-java-time project also only emulates a minimal set of classes.



-- J.
Reply all
Reply to author
Forward
0 new messages