Skip to content

Prevent modifying state in RubyProc#9112

Merged
headius merged 4 commits intojruby:masterfrom
headius:final_proc_file_line
Dec 4, 2025
Merged

Prevent modifying state in RubyProc#9112
headius merged 4 commits intojruby:masterfrom
headius:final_proc_file_line

Conversation

@headius
Copy link
Member

@headius headius commented Dec 4, 2025

A change during 9.4.x accidentally modified this code to update the "file" field on RubyProc, rather than using a local variable. This restores that local variable and subsequent commits will make the fields final to avoid this happening in the future.

Fixes #9110

A change during 9.4.x accidentally modified this code to update the
"file" field on RubyProc, rather than using a local variable. This
restores that local variable and subsequent commits will make the
fields final to avoid this happening in the future.

Fixes jruby#9110
@headius headius added this to the JRuby 10.0.3.0 milestone Dec 4, 2025
@headius headius changed the title Use local file variable rather than updating field Prevent modifying final state in RubyProc Dec 4, 2025
@headius headius changed the title Prevent modifying final state in RubyProc Prevent modifying state in RubyProc Dec 4, 2025
No reason they wasn't final before; they're only initialized in the
constructor.
There was no reason this was not final other than having a lot of
noisy logic to set up the block before storing it. I reworked how
that setup happens and the field is now final.

This is not in any way endorsing that setup as being correct.
fromMethod was only assigned in two places that were easily
incorporated into construction.

Constructors have been modified to only assign finals in one place
and to elminate some paths that have been deprecated for over a
decade.
@headius headius marked this pull request as ready for review December 4, 2025 09:02
@headius headius merged commit 9944d19 into jruby:master Dec 4, 2025
77 checks passed
@headius headius deleted the final_proc_file_line branch December 4, 2025 09:03
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.

Calling inspect on proc resets line in source_location

1 participant