Skip to content

Rework visibility checks for Java integration#8093

Merged
headius merged 1 commit intojruby:masterfrom
headius:ji_visibility_tweaks
Feb 7, 2024
Merged

Rework visibility checks for Java integration#8093
headius merged 1 commit intojruby:masterfrom
headius:ji_visibility_tweaks

Conversation

@headius
Copy link
Member

@headius headius commented Feb 7, 2024

In #8061 we found that Gradle is opening several core JDK packages to support the needs of Groovy. Unfortunately this causes some normally-inaccessible methods to be accessible to JRuby's Java integration layer. In the case of HashSet, a package-private map method gets bound that conflicts with the Ruby version, leading to the bug reported in #8061.

Gradle's behavior is unsanitary, but ultimately the fix we have settled on here is to never try to set package-private methods accessible since they are truly not intended for consumption outside the package. That fixes this issue without addressing the larger problem of Gradle opening up core JDK packages.

Fixes #8061

@headius headius added this to the JRuby 9.4.6.0 milestone Feb 7, 2024
@headius headius force-pushed the ji_visibility_tweaks branch from 64ef2eb to bea8f7f Compare February 7, 2024 18:58
In jruby#8061 we found that Gradle is opening several core JDK packages
to support the needs of Groovy. Unfortunately this causes some
normally-inaccessible methods to be accessible to JRuby's Java
integration layer. In the case of HashSet, a package-private
`map` method gets bound that conflicts with the Ruby version,
leading to the bug reported in jruby#8061.

Gradle's behavior is unsanitary, but ultimately the fix we have
settled on here is to never try to set package-private methods
accessible since they are truly not intended for consumption
outside the package. That fixes this issue without addressing the
larger problem of Gradle opening up core JDK packages.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enumerable.map raise wrong number of arguments only when Ruby script is executed from Gradle using JDK 21

2 participants