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

Gradle worker should not open any packages during tests #19771

Closed
martin-sladecek opened this issue Jan 31, 2022 · 2 comments · Fixed by #20999
Closed

Gradle worker should not open any packages during tests #19771

martin-sladecek opened this issue Jan 31, 2022 · 2 comments · Fixed by #20999
Assignees
Milestone

Comments

@martin-sladecek
Copy link

Expected Behavior

On JDK 17, when unit tests pass, there should be no module access errors when running the distribution package.

Current Behavior

If the application is manipulating with java.util or java.lang classes using some reflection (e.g. by using some lib), this will fail at runtime, even though the unit tests passed, because java.base/java.lang and java.base/java.util are automatically opened for gradle workers.

Context

We are using jersey declarative linking, which is automatically traversing all classes using reflection. This can be controlled by an annotation, however a missing annotation cannot be caught by a test because it will work on the gradle worker.

Steps to Reproduce

Field.setAccessible(true) on some field from the packages above will work in tests, but not in standalone app.

Your Environment

Gradle 7.3.3

@rpalcolea
Copy link
Contributor

somehow related to #18647 but important bit: Gradle's Vanilla test executor opens the modules java/util and java/lang for internal reasons (see here).

@OriSchmitz
Copy link

This is pretty important for us, it made us miss this bug in Gson until we deployed and found it

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

Successfully merging a pull request may close this issue.

8 participants