You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "tisonkun (via GitHub)" <gi...@apache.org> on 2023/10/27 01:08:25 UTC

[PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

tisonkun opened a new pull request, #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400

   1. More precise than `Date`.
   2. Can convert to `DateTime`s with `atZone` or `atOffset`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#issuecomment-1782233369

   > By the way, is this a breaking change since v0.41?
   
   @Xuanwo 
   
   No. The field is introduced by https://github.com/apache/incubator-opendal/commit/3108bd3d6cc18fde8089df8bfaf624c5242a0e88 which is unreleased yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#issuecomment-1782234370

   I'm going to make some convert functions for DateTime and Duration, which I plan to do after make some utilities for construct signatures.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun merged PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#discussion_r1373997431


##########
bindings/java/src/lib.rs:
##########
@@ -212,11 +212,14 @@ fn make_metadata<'a>(env: &mut JNIEnv<'a>, metadata: Metadata) -> Result<JObject
         metadata.last_modified().map_or_else(
             || Ok::<JObject<'_>, error::Error>(JObject::null()),
             |v| {
-                Ok(env.new_object(
-                    "java/util/Date",
-                    "(J)V",
-                    &[JValue::Long(v.timestamp_millis())],
-                )?)
+                Ok(env
+                    .call_static_method(
+                        "java/time/Instant",
+                        "ofEpochMilli",

Review Comment:
   Can we store up to `ns` level which align with core's `DateTime`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on code in PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#discussion_r1374034062


##########
bindings/java/src/lib.rs:
##########
@@ -212,11 +212,14 @@ fn make_metadata<'a>(env: &mut JNIEnv<'a>, metadata: Metadata) -> Result<JObject
         metadata.last_modified().map_or_else(
             || Ok::<JObject<'_>, error::Error>(JObject::null()),
             |v| {
-                Ok(env.new_object(
-                    "java/util/Date",
-                    "(J)V",
-                    &[JValue::Long(v.timestamp_millis())],
-                )?)
+                Ok(env
+                    .call_static_method(
+                        "java/time/Instant",
+                        "ofEpochMilli",

Review Comment:
   Updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#discussion_r1373997431


##########
bindings/java/src/lib.rs:
##########
@@ -212,11 +212,14 @@ fn make_metadata<'a>(env: &mut JNIEnv<'a>, metadata: Metadata) -> Result<JObject
         metadata.last_modified().map_or_else(
             || Ok::<JObject<'_>, error::Error>(JObject::null()),
             |v| {
-                Ok(env.new_object(
-                    "java/util/Date",
-                    "(J)V",
-                    &[JValue::Long(v.timestamp_millis())],
-                )?)
+                Ok(env
+                    .call_static_method(
+                        "java/time/Instant",
+                        "ofEpochMilli",

Review Comment:
   Can we store up to `ns` level?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#issuecomment-1782176968

   By the way, is this a breaking change since v0.41?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore(bindings/java): use JDK 8 time APIs [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #3400:
URL: https://github.com/apache/incubator-opendal/pull/3400#discussion_r1373997431


##########
bindings/java/src/lib.rs:
##########
@@ -212,11 +212,14 @@ fn make_metadata<'a>(env: &mut JNIEnv<'a>, metadata: Metadata) -> Result<JObject
         metadata.last_modified().map_or_else(
             || Ok::<JObject<'_>, error::Error>(JObject::null()),
             |v| {
-                Ok(env.new_object(
-                    "java/util/Date",
-                    "(J)V",
-                    &[JValue::Long(v.timestamp_millis())],
-                )?)
+                Ok(env
+                    .call_static_method(
+                        "java/time/Instant",
+                        "ofEpochMilli",

Review Comment:
   Can we store to `ns` level?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org