Skip to content

common_converters.rb gets loaded twice causing errors #106

@korzry

Description

@korzry

Depending on where the jrubyfx gem is installed, common_converters.rb gets loaded twice. When the gem is installed in GEM_HOME along side the ruby installation, no warnings are issues. When installed in the the user's home directory, the following warning are issue:

/net/sunshine/vol/homes/ryan_/.gem/jruby/2.3.0/gems/jrubyfx-1.1.1-java/lib/jrubyfx/utils/common_converters.rb:28: warning: already initialized constant ARG_CONVERTER_SUFFIX                                                                                     
/net/sunshine/vol/homes/ryan/.gem/jruby/2.3.0/gems/jrubyfx-1.1.1-java/lib/jrubyfx/utils/common_converters.rb:31: warning: already initialized constant NAME_TO_COLORS                                                                                           
/net/sunshine/vol/homes/ryan/.gem/jruby/2.3.0/gems/jrubyfx-1.1.1-java/lib/jrubyfx/utils/common_converters.rb:137: warning: already initialized constant CONVERTERS                                                                                              
/net/sunshine/vol/homes/ryan/.gem/jruby/2.3.0/gems/jrubyfx-1.1.1-java/lib/jrubyfx/utils/common_converters.rb:172: warning: already initialized constant ENUM_CACHE                                                                                              
/net/sunshine/vol/homes/ryan/.gem/jruby/2.3.0/gems/jrubyfx-1.1.1-java/lib/jrubyfx/utils/common_converters.rb:175: warning: already initialized constant ENUM_OVERRIDES  

This seems to be related to using require vs require_relative.

>> grep common_converters */*
core_ext/drag_event.rb:require 'jrubyfx/utils/common_converters'
core_ext/radial_gradient.rb:require 'jrubyfx/utils/common_converters'
utils/common_utils.rb:require_relative 'common_converters'

Notice that common_utils.rb uses require_relative. With jruby_9.1.2.0, the require and require_relative are not resolving to the same file causing common_converters to be loaded twice. Changing the require_relative to require solves this issue.

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