FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Invalidate prepended origin module as well as subclasses by headius · Pull Request #9598 · jruby/jruby · GitHub

/ jruby Public

Invalidate prepended origin module as well as subclasses - #9598

Merged
headius merged 2 commits into
jruby:masterfrom
headius:invalidate_prepend_origin_module
Aug 19, 2026
Merged

Invalidate prepended origin module as well as subclasses#9598
headius merged 2 commits into
jruby:masterfrom
headius:invalidate_prepend_origin_module

Conversation

headius commented Aug 18, 2026

Copy link
Copy Markdown
Member

When a module is prepended into another module, there's no subclass relationship for normal down-hierarchy invalidation. Instead, we actively invalidate the origin module's including hierarchies as well as classes down the hierarchy.

PrependedModule becomes the new location for the origin's method table, so when it is updated the origin must also be invalidated.

There's probably too much complexity here and this might be fixable by also moving the included hierarchies into the PrependedModule, but I did not validate that all places updating this hierarchy are aware of the methodLocation. An audit of this logic should probably happen at some point, and PrependedModule might be better renamed to RelocatedClassGuts but with a better name, to indicate that it is now the new location for the origin's state. That work is out of scope for this quick fix.

Fixes #9589

Draft until specs are added.

When a module is prepended into another module, there's no subclass
relationship for normal down-hierarchy invalidation. Instead, we
actively invalidate the origin module's including hierarchies as
well as classes down the hierarchy.

Fixes jruby#9589
For jruby#9589, we discovered that modules with prepends did
not properly invalidate class hierarchies they have been included
into, due to the method table being moved to the prepend shim and
only invalidating along that hierarchy. This spec tests that such
a module continues to invalidate included hierarchies when its
method table is modified.
headius marked this pull request as ready for review August 19, 2026 17:20
headius merged commit 1ed2709 into jruby:master Aug 19, 2026
264 of 268 checks passed
headius deleted the invalidate_prepend_origin_module branch August 19, 2026 19:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Kernel#require redefined inside a required file isn't seen by autoload dispatch after Kernel.prepend (CRuby 4.0 OK / JRuby 10 fails)

1 participant


Back | FazBrowse Home | New Git URL