Skip to content

Conversation

@amogilev
Copy link
Contributor

Adopts Gson for Java9 DateFormat changes, as described in issue #1210

/**
* @return {@code true} if the application is running on Java 9 or later; and {@code false} otherwise.
*/
public static boolean isJava9OrLater() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this logic work on Android?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! For Android, "java.version" is "0", so the method getMajorJavaVersion() returns "0", and isJava9OrLater() returns "false". Guess it is fine until Android is actually moved to Java 9 (if it will ever happen).

Choose a reason for hiding this comment

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

https://developer.android.com/about/versions/13/features#core-libraries

Android 13 starts the work of refreshing Android's core libraries to align with the OpenJDK 11 LTS release with both library updates and Java 11 language support for application and platform developers. The core library changes introduced in Android 13 will also be available to Android 12 devices through a Google Play system update to the ART Mainline Module.

Android is moving to newer Java implementations

Copy link
Contributor

@Marcono1234 Marcono1234 Apr 3, 2023

Choose a reason for hiding this comment

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

@seventhmoon, thanks for pointing that out. Would you mind creating a separate issue so that we can investigate there if / which effect this will have on Gson and its VersionUtils.isJava9OrLater() method?

Edit: Follow-up issue #2365

@inder123 inder123 merged commit 0aaf5ff into google:master Dec 29, 2017
@jansohn
Copy link

jansohn commented Feb 13, 2018

When do you plan to release a new version which includes this fix?

sebasjm pushed a commit to sebasjm/gson that referenced this pull request Mar 11, 2018
* fix Java9 DateFormat changes

* fix Codacy warnings
FredricMei pushed a commit to orientsec/gson that referenced this pull request Feb 11, 2019
* fix Java9 DateFormat changes

* fix Codacy warnings
@shahirshann
Copy link

Vh

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants