Skip to content

Commit 5aee339

Browse files
committed
Use local file variable rather than updating field
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
1 parent 846f601 commit 5aee339

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/jruby/RubyProc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public IRubyObject to_s(ThreadContext context) {
242242
boolean isSymbolProc = block.getBody() instanceof RubySymbol.SymbolProcBody;
243243
if (isSymbolProc) {
244244
string.catStringUnsafe("(&:" + ((RubySymbol.SymbolProcBody) block.getBody()).getId() + ")");
245-
} else if ((file = block.getBody().getFile()) != null) {
245+
} else if (block.getBody().getFile() instanceof String file) {
246246
string.catStringUnsafe(" " + file + ":" + (block.getBody().getLine() + 1));
247247
}
248248

0 commit comments

Comments
 (0)