jRuby compatibility issue

53 views
Skip to first unread message

t...@impac.ch

unread,
Mar 5, 2014, 10:42:31 AM3/5/14
to yar...@googlegroups.com
jRuby throws following error (on rails server, rake --tasks, rake --prereqs)

/_path/.rvm/gems/jruby-1.7.11@_project_name/gems/yard-0.8.7.3/lib/yard/parser/ruby/ast_node.rb:95 warning: already initialized constant KEYWORDS

This is true for jRuby 1.7.4, 1.7.8 and 1.7.11 (on both OS X and Windows)

My first guess is, without looking deeper into this issue: this happens because internally jRuby already provides an AstNode Class (org.jruby.ast.node: http://jruby.org/apidocs/org/jruby/ast/Node.html) and yard tries to override it.

Loren Segal

unread,
Mar 5, 2014, 1:07:10 PM3/5/14
to yar...@googlegroups.com
Note that a warning is not an error; it's a warning. YARD should work just fine.

I'm not sure that there's an AstNode class override problem, since ours is namespaced inside the YARD module (and others too). If there was actually a collision there, that would be a bug in JRuby, since that should never happen.

I think YARD is probably just being loaded twice-- or maybe that specific file is. Without knowing more about your project it's difficult to say why that would happen, but you could figure it out if you put a `raise "DIE!" if defined? KEYWORDS` statement right after line 95. That should give you a stack trace detailing when/where that file is being loaded.

Loren
Message has been deleted

t...@impac.ch

unread,
Mar 10, 2014, 4:43:38 AM3/10/14
to yar...@googlegroups.com, t...@impac.ch
Thanks for your answer Loren, i found the problem somewhere else. I thought yard-rails was necessary for yard to work on a rails app, but it's already abandoned, and it seems this gem was causing the ast_node to initialize twice (put "KEYWORD constant" on line 94 fired twice).

Thomas

Reply all
Reply to author
Forward
0 new messages