Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to DateSerializer and new LocaleSerializer #164

Merged
merged 3 commits into from
Jan 5, 2014
Merged

Update to DateSerializer and new LocaleSerializer #164

merged 3 commits into from
Jan 5, 2014

Conversation

serverperformance
Copy link
Contributor

  • Updated DateSerializer to properly handle subclasses (java.sql.Date, Time, Timestamp, etc).
  • New LocaleSerializer default immuable serializer

NathanSweet added a commit that referenced this pull request Jan 5, 2014
Update to DateSerializer and new LocaleSerializer
@NathanSweet NathanSweet merged commit cc94daa into EsotericSoftware:master Jan 5, 2014
@NathanSweet
Copy link
Member

A little strange to sort of bundle multiple types in one serializer, but I see why you did it. Probably could use == for class comparison, but makes little difference. Thanks for contributing!

@magro
Copy link
Collaborator

magro commented Jan 5, 2014

No tests?

@serverperformance
Copy link
Contributor Author

Sorry, you are right. I need time to undertand the rounTrip structure in the current tests

-----Original Message-----
From: Martin Grotzke [email protected]
Date: Sun, 05 Jan 2014 14:42:08
To: EsotericSoftware/[email protected]
Reply-To: EsotericSoftware/kryo [email protected]
Cc: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

No tests?


Reply to this email directly or view it on GitHub:
#164 (comment)

@magro
Copy link
Collaborator

magro commented Jan 5, 2014

For j.u.Date subclasses they should be similar to the Date test, for LocaleSerializer you could adapt the test from my PR.

@serverperformance
Copy link
Contributor Author

Ok! Thank you...

But not tonight, here in Spain and other latin countries, this is the night in which the Three Kings ("Los Reyes Magos") bring the gifts to our children, so shhh I must go to sleep soon ;)

-----Original Message-----
From: Martin Grotzke [email protected]
Date: Sun, 05 Jan 2014 15:24:31
To: EsotericSoftware/[email protected]
Reply-To: EsotericSoftware/kryo [email protected]
Cc: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

For j.u.Date subclasses they should be similar to the Date test, for LocaleSerializer you could adapt the test from my PR #100.


Reply to this email directly or view it on GitHub:
#164 (comment)

@serverperformance
Copy link
Contributor Author

Looking at it deeper while creating the unit tests:

java.sql.Timestamp needs a separate default serializer as it handles nanos (from the javadoc: "Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance.")

The other subclasses, at least j.sql.Date and j.sql.Time, can actually be ahndled as I proposed.

What do you think? Two separate default serializers seems ok to you?

On the other hand I will update LocaleSerializer to remove the copy method, as it is immutable.

I will make tonight a pull request with these changes except if you propose a better alternative for Date subclasses...

Cheers,
Tumi

-----Original Message-----
From: "Tumi" [email protected]
Date: Sun, 5 Jan 2014 23:54:23
To: EsotericSoftware/[email protected]; EsotericSoftware/[email protected]
Reply-To: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

Ok! Thank you...

But not tonight, here in Spain and other latin countries, this is the night in which the Three Kings ("Los Reyes Magos") bring the gifts to our children, so shhh I must go to sleep soon ;)

-----Original Message-----
From: Martin Grotzke [email protected]
Date: Sun, 05 Jan 2014 15:24:31
To: EsotericSoftware/[email protected]
Reply-To: EsotericSoftware/kryo [email protected]
Cc: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

For j.u.Date subclasses they should be similar to the Date test, for LocaleSerializer you could adapt the test from my PR #100.


Reply to this email directly or view it on GitHub:
#164 (comment)

@serverperformance
Copy link
Contributor Author

By the way: DateSerializer optimizes writeLong assuming that the values are only positive... Which is the common case I supose but not mandatory in fact.

In the java.sql.Date and java.sql.Timestamp at least this optimization can't be done.

AND it it wouldn't be for backwards compatibility I would re-think that optimization in the base DateSerializar...

Umm

-----Original Message-----
From: "Tumi" [email protected]
Date: Mon, 6 Jan 2014 12:08:24
To: EsotericSoftware/[email protected]; EsotericSoftware/[email protected]
Reply-To: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

Looking at it deeper while creating the unit tests:

java.sql.Timestamp needs a separate default serializer as it handles nanos (from the javadoc: "Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance.")

The other subclasses, at least j.sql.Date and j.sql.Time, can actually be ahndled as I proposed.

What do you think? Two separate default serializers seems ok to you?

On the other hand I will update LocaleSerializer to remove the copy method, as it is immutable.

I will make tonight a pull request with these changes except if you propose a better alternative for Date subclasses...

Cheers,
Tumi

-----Original Message-----
From: "Tumi" [email protected]
Date: Sun, 5 Jan 2014 23:54:23
To: EsotericSoftware/[email protected]; EsotericSoftware/[email protected]
Reply-To: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

Ok! Thank you...

But not tonight, here in Spain and other latin countries, this is the night in which the Three Kings ("Los Reyes Magos") bring the gifts to our children, so shhh I must go to sleep soon ;)

-----Original Message-----
From: Martin Grotzke [email protected]
Date: Sun, 05 Jan 2014 15:24:31
To: EsotericSoftware/[email protected]
Reply-To: EsotericSoftware/kryo [email protected]
Cc: [email protected]
Subject: Re: [kryo] Update to DateSerializer and new LocaleSerializer (#164)

For j.u.Date subclasses they should be similar to the Date test, for LocaleSerializer you could adapt the test from my PR #100.


Reply to this email directly or view it on GitHub:
#164 (comment)

@serverperformance
Copy link
Contributor Author

I just made another pull request. Forget my previous messages with my doubts. Unit tests work ok, and a deep review of the j.sql.Timestamp, etc, source code cleared all my doubts.

Sorry.
Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants