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

Merge typehandlers-jsr310 into the core. #974

Merged
merged 3 commits into from
May 24, 2017

Conversation

harawata
Copy link
Member

typehandlers-jsr310 are for standard Java types and they belong to the core in the first place.
We didn't know how to include them in the core without breaking Java 6 compatibility, but we do now.
So I propose to merge them into the core.
It might be a little bit confusing at first, but I cannot think of any serious issue caused by this change.

Any thoughts?

Cc-ing: @emacarron @hazendaz @kazuki43zoo @trohovsky @raupachz

Copy link
Member

@kazuki43zoo kazuki43zoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @harawata, There is no objection with your proposal(It's great proposal). But I do not understand a mechanism to resolve for code that depends on different JDK versions on compile time yet... Could you explain it ? (The mechanism for test code is understanding already!)

And I've added some trivial comments.

import org.apache.ibatis.lang.UsesJava8;

/**
* @author Tomas Rohovsky
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @since 3.4.5 is need. (The same applies to other classes)

@@ -0,0 +1,62 @@
/**
* Copyright 2016 the original author or authors.
Copy link
Member

@kazuki43zoo kazuki43zoo Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing a license header is need. (The same applies to other classes)

/**
* Type Handler for {@link JapaneseDate}.
*
* @since 1.0.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing version is need. (The same applies to other classes)


import org.apache.ibatis.lang.UsesJava8;

@UsesJava8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding javadoc(@since and @author etc..) is need.

public abstract class Java8TypeHandlersRegistrar {

public static void registerDateAndTimeHandlers(TypeHandlerRegistry registry) {
// since 1.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is not need.

@@ -40,29 +61,24 @@ public void setup() {

@Test
public void testFor_v1_0_0() throws ClassNotFoundException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing method name and merge to one method is need.

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.hamcrest.core.IsInstanceOf.*;

/**
* Tests for auto-detect type handlers of mybatis-typehandlers-jsr310.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing this comment is need.

@raupachz
Copy link
Contributor

Why don't you check System.getProperty("java.version");?

@harawata
Copy link
Member Author

harawata commented Apr 12, 2017

Thank you guys for the comments! =)

@kazuki43zoo ,
I'll update the files later.

@raupachz ,
The logic based on version string potentially causes an issue like this and should be avoided, IMHO.
As a related topic, the version string schema change in Java 9 might break some existing apps/libraries that rely on the old schema, I imagine.

@raupachz
Copy link
Contributor

@harawata Ah, I see. Was just a suggestion. Probably all a matter of personal preference. Like most things.

@harawata
Copy link
Member Author

@raupachz ;D Any suggestion is welcome!

# Conflicts:
#	src/test/java/org/apache/ibatis/type/usesjava8/Jsr310TypeHandlerRegistryTest.java
@hazendaz
Copy link
Member

+1

@harawata harawata merged commit a0308b1 into mybatis:master May 24, 2017
@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Jun 7, 2017
@kazuki43zoo kazuki43zoo added this to the 3.4.5 milestone Jun 7, 2017
kazuki43zoo added a commit that referenced this pull request Jun 13, 2017
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve a feature or add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants