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

Avoid robolectric added add-opens on JDK 1.8 #8644

Merged
merged 3 commits into from
Dec 31, 2024

Conversation

yschimke
Copy link
Collaborator

Add add-opens and also fails to run.

Add add-opens and also fails to run.
@yschimke yschimke added android Relates to usage specifically on Android jdkversions JDK 8, 17, 19 etc. labels Dec 31, 2024
@yschimke
Copy link
Collaborator Author

See https://github.com/square/okhttp/actions/runs/12560902710/job/35018955029

> Task :okhttp:testDebugUnitTest FAILED
Unrecognized option: --add-opens=java.base/java.io=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.

@yschimke yschimke requested a review from swankjesse December 31, 2024 15:55
@yschimke
Copy link
Collaborator Author

Still 1/3 of JDK usage https://newrelic.com/sites/default/files/2023-04/new-relic-2023-state-of-the-java-ecosystem-2023-04-20.pdf

And

The end date for Oracle's Java 8 LTS (Long Term Support) is December 2030:
Premier support: Ended on March 31, 2022
Extended support: Available until December 2030 with an additional fee

@yschimke
Copy link
Collaborator Author

yschimke commented Dec 31, 2024

Fixed in later AGP.

https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/factory/AndroidUnitTest.java;l=339?q=robolectric%20add-opens&start=11

            // Robolectric specific: add JVM flag to allow unit tests to run when using Java 17+.
            // Ref b/248929512.
            if (task.getJavaLauncher()
                            .get()
                            .getMetadata()
                            .getLanguageVersion()
                            .compareTo(JavaLanguageVersion.of(17))
                    >= 0) {
                task.jvmArgs((ImmutableList.of("--add-opens=java.base/java.io=ALL-UNNAMED")));
            }

@yschimke yschimke changed the title Avoid robolectric on JDK 1.8 Avoid robolectric added add-opens on JDK 1.8 Dec 31, 2024
@yschimke yschimke merged commit fed29a2 into square:master Dec 31, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Relates to usage specifically on Android jdkversions JDK 8, 17, 19 etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant