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
Signature of org.postgresql.jdbc.TimestampUtils.toOffsetDateTime(java.lang.String)
changed
#2497
Comments
You are quite correct. I will fix this ASAP
…On Fri, Apr 22, 2022, 1:13 PM Vladimir Sitnikov ***@***.***> wrote:
Here's the change:
https://github.com/pgjdbc/pgjdbc/pull/2467/files#diff-21e3023c84d9d5fb4f5f04678a094fce6ab5af36a5e73fdfaf495646f3b720d5R523
—
Reply to this email directly, view it on GitHub
<#2497 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADDH5TAQELJ25FIDW4WF4LVGLM4VANCNFSM5UC3APZQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
So while this function is declared public. This is not part of the public API. We don't publish this API. I'm not sure we can be responsible for making sure this API doesn't change in minor versions. |
The sad thing is that TimestampUtils was not in "internal" package, and its javadoc does not suggest the class is not public. |
Here's the corresponding change in debezium: debezium/debezium#2339 |
Unfortunately, we have no clear way to declare the published API, so it looks like we should be careful of keeping all "looking as public" APIs in both minor and major releases. |
@vlsi agree with everything above. However we have to be free to change our internal code. I honestly doubt if documenting that it is not public will help. |
Moving classes to
I hope documenting BaseConnection helps: pgjdbc/pgjdbc/src/main/java/org/postgresql/core/BaseConnection.java Lines 25 to 27 in ffda18b
However, it looks like |
What you're discussing is solved by using Java modules. With that said you publish a Java doc for this method, seems pretty public to an outsider looking in. |
I'm not sure we are ready to drop Java 8 support yet, so |
Ya I think moving everything into .internal would be my vote. Documentation is more for us than anything. The fact that there are javadocs is really an artifact of the build process. |
So do I need to get debezium to change their usage and only allow, 42.3.4+ or can we restore the old method and deprecate it? |
Hey all, did a quik grep in the Debezium code base, and these are the Postgres driver classes we import:
Which one of those would you consider as implementation details of the driver? And what would be the public API alternatives to them? |
Off the top of my head the easy ones are:
But let me turn this question around and ask you the same? I think the solution to this is to create external classes for what you or others may need that implement what you are using and then have internal classes that we are free to modify as we see fit. Thought ? |
I don't fully understand why one would like to use TimestampUtils. This class is also on the list of classes to be removed once the rewrite to java.time is done. I have no problem to restore an old deprecated signature back, but please don't restore the buggy code from before. In Apache Lucene we have a javadocs annotation "@lucene.internal". If anybody complains we refer to it an close issue as won't fix. |
I just checked, the additional paramter "adoptToUTC" may default to Nevertheless, TimestampUtils is to be going away soon, so we should mark it as internal. See my comment above. |
I would add this deprecated change: @Deprecated
public @PolyNull OffsetDateTime toOffsetDateTime(@PolyNull String s) throws SQLException {
return toOffsetDateTime(s, true);
} |
And this would not help with classpath users. Most projects out there still use Java 17 with classpath compilation. So adding module info helps almost nothing. |
I would do this two-side: If the class is only used from one package, move it to that package and make it pkg-protected. Otherwise, yes ".internal." package is fine. We do the same in Lucene after we modularized all of lucene and ran into package name conflicts: https://lucene.apache.org/core/9_1_0/core/org/apache/lucene/internal/tests/package-summary.html (of course, it is not listed in |
closed with #2501 |
Thanks and sorry for the trouble! 😵💫 |
Sorry, just getting back to this, as I was travelling for Kafka Summit last week. So we use this class for converting temporal values we receive from PG in change events into the properly typed types. We could do this ourselves, but then we'd re-implement the logic of the driver, e.g. including infinity handling. So I'd argue there's reasonable cause for having those methods as a supported driver API? Taking a step back, I've lost track what exactly has changed now and what we need to do when upgrading to the new driver version. I suppose a number of compile errors will tell us? |
@gunnarmorling As for what you will have to do. 42.3.5 will revert these changes and your code will work as is. |
Ok, perfect thanks. Note I'm very sympathetic towards the concern of separating API and implementation parts of a library such as the driver; so if we currently are referencing things you actually consider internal, we'll happily try and make the required adjustments, assuming there's some deprecation period and ideally a public replacement for that functionality. |
Describe the issue
Upgrading from Postgres Driver 42.3.3 to 42.3.4 results in:
Driver Version?
42.3.4
Java Version?
17
OS Version?
Ubunutu Focal (20.04)
PostgreSQL Version?
11.3
To Reproduce
Use 'java.time.OffsetDateTime org.postgresql.jdbc.TimestampUtils.toOffsetDateTime(java.lang.String)' in your code or a library (in this case Debezium) with 42.3.3, upgrade to 42.3.4.
Expected behaviour
I would not expect the public API to change in a bug fix version and if it was, to be called out as a breaking change in the notes. The Java Doc still shows the old version: https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/jdbc/TimestampUtils.html#toLocalDateTime-java.lang.String-
This change was introduced here: #2467
The text was updated successfully, but these errors were encountered: