FFI currently produces a frozen string literal warning with JRuby 10 when passing a string to an FFI function when the argument type is :pointer. This affects Fiddle with the char * type (ruby/fiddle#177).
require "ffi"
module Hello
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :puts, [:pointer], :int # no warning if [:string]
end
Hello.puts("world") # warning
Hello.puts(+"world") # no warning
And run with:
RUBYOPT="--debug-frozen-string-literal" ruby repro.rb
Environment Information
- jruby 10.0.0.0 (3.4.2) 2025-04-13 6ed59bc OpenJDK 64-Bit Server VM 21.0.6 on 21.0.6 +indy +jit [arm64-darwin]
- macOS 15.4.1 arm64
Expected Behavior
No warning
Actual Behavior
repro.rb:9: warning: literal string will be frozen in the future, the string was created here: repro.rb:9
FFI currently produces a frozen string literal warning with JRuby 10 when passing a string to an FFI function when the argument type is
:pointer. This affects Fiddle with thechar *type (ruby/fiddle#177).And run with:
RUBYOPT="--debug-frozen-string-literal" ruby repro.rbEnvironment Information
Expected Behavior
No warning
Actual Behavior