Sunday, March 20, 2016

Why can I not extend java.util.Date?

Working with Date is a nightmare.. so beforehand: Any advice regarding work with time and date in GWT are very welcome!

Why do my requests silently fail if I do this:

public class AwesomeDate extends java.util.Date {

  public final static int MONDAY = 1; 
  public final static int TUESDAY = 2; 
  public final static int WEDNESDAY = 3; 
  public final static int THURSDAY = 4; 
  public final static int FRIDAY = 5; 
  public final static int SATURDAY = 6; 
  public final static int SUNDAY = 7;

  public int getDay() { 
    switch(super.getDay()) { 
    case 1:
      return MONDAY;
    case 2:
      return TUESDAY;
    case 3:
      return WEDNESDAY;
    case 4:
      return THURSDAY;
    case 5:
      return FRIDAY;
    case 6:
    return SATURDAY;
      case 0:
      return SUNDAY;
    throw new RuntimeException();

and then

AwesomeDate fromDate = ..
AwesomeDate toDate = ..

myObjectEnter.request(fromDate, toDate, onSuccess, onFailure);


MyObject#request(Date from, Date to, OnSuccess<ResultDTO> success, OnFailure failure);

Because if I do that my request does simply nothing. It's not even getting sent off.. I have an object that takes care for parallel requests

 for (ParallelizableRequest<?> parallelizableRequest : this.childRequests) {

but that request that is using AwesomeDate is simply not being executed. In the JavaScript debugger I see that the list childRequests contains two elements but that's all I can tell.

Any ideas?

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment