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

fix: bring back Java 8 compatibility #267

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

mateuszkwiecinski
Copy link
Contributor

Thank you for opening a Pull Request!


Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #266 🦕

Copy link

google-cla bot commented Jul 4, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

}
namespace 'com.google.maps.android.ktx.demo'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wasn't used and AFAIK is considered a bad practice because makes the build less deterministic

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that should rather not be on the Gradle file.

uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As a bonus, you should be able to use latest version to compile the project, there is no reason to stick to an old java for the build 🤷

app/build.gradle Outdated
@@ -43,18 +43,17 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested that you could even do 1.8, but it is deprecated to compile for java 8 with latest java versions 🤷

Java compiler version 21 has deprecated support for compiling with source/target version 8.
Try one of the following options:
    1. [Recommended] Use Java toolchain with a lower language version
    2. Set a higher source/target version
    3. Use a lower version of the JDK running the build (if you're not using Java toolchain)
For more details on how to configure these settings, see https://developer.android.com/build/jdks.
To suppress this warning, set android.javaCompile.suppressSourceTargetDeprecationWarning=true in gradle.properties.
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.

Targeting java 11 is still a behavior change but will work for my project since, but from what I've seen a lot of projects still target java 1.8 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we try with Java 1.8 instead? A deprecation is the code is fine, we can keep it in mind for upcoming version bumps.

Copy link
Contributor Author

@mateuszkwiecinski mateuszkwiecinski Jul 4, 2024

Choose a reason for hiding this comment

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

Done ✅
Tested it compiles fine on both Java 21 and 17. javap -v confirms published classes target Java 8:
image

I updated PR title to reflect recent changes

@kikoso kikoso changed the title Bring back Java 11 compatibility fix: bring back Java 11 compatibility Jul 4, 2024
@mateuszkwiecinski mateuszkwiecinski changed the title fix: bring back Java 11 compatibility fix: bring back Java 8 compatibility Jul 4, 2024
@mateuszkwiecinski mateuszkwiecinski marked this pull request as ready for review July 4, 2024 12:51
@mateuszkwiecinski mateuszkwiecinski requested a review from a team as a code owner July 4, 2024 12:51
@mateuszkwiecinski mateuszkwiecinski requested a review from kikoso July 8, 2024 12:56
Copy link
Collaborator

@kikoso kikoso left a comment

Choose a reason for hiding this comment

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

LGTM, I will take a look at this with @dkhawk tomorrow.

@dkhawk dkhawk merged commit fded4c0 into googlemaps:main Jul 9, 2024
8 checks passed
googlemaps-bot pushed a commit that referenced this pull request Jul 9, 2024
## [5.1.1](v5.1.0...v5.1.1) (2024-07-09)

### Bug Fixes

* bring back Java 8 compatibility ([#267](#267)) ([fded4c0](fded4c0))
@googlemaps-bot
Copy link
Contributor

🎉 This PR is included in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mateuszkwiecinski mateuszkwiecinski deleted the java_11_compatibility branch July 10, 2024 12:54
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.

com.google.maps.android:maps-ktx:5.1.0 requires Java 17 runtime
5 participants