Skip to content

Frozen string literal warning with JRuby 10 #177

@ankane

Description

@ankane

Hi, Fiddle currently produces a frozen string literal warning with JRuby 10 when passing a string argument to an FFI function.

/Users/user/.rbenv/versions/jruby-10.0.0.0/lib/ruby/gems/shared/gems/fiddle-1.1.6/lib/fiddle/ffi_backend.rb:174: warning: literal string will be frozen in the future, the string was created here: repro.rb:10

Repro script

require "fiddle/import"

module Hello
  extend Fiddle::Importer

  dlload "/usr/lib/libSystem.B.dylib" # for Mac, replace on Linux/Windows
  extern "int puts(const char* str)"
end

Hello.puts("world")  # warning
Hello.puts(+"world") # no warning

And run with:

RUBYOPT="--debug-frozen-string-literal" ruby repro.rb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions