Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jrubyc does not find classes inside modules #4539

Closed
HeikoBornholdt opened this issue Mar 20, 2017 · 2 comments
Closed

jrubyc does not find classes inside modules #4539

HeikoBornholdt opened this issue Mar 20, 2017 · 2 comments

Comments

@HeikoBornholdt
Copy link

I've got this ruby file (foo/bar.rb) and want to create a corresponding .java file:

module Foo
  class Bar
    def run
      puts "hello world"
    end
  end
end

Expected Behavior

jrubyc creates a .java file:

Actual Behavior

jrubyc throws an error:

$ jrubyc --javac foo/bar.rb
RuntimeError: No classes found in target script: foo/bar.rb
  block in compile_files_with_options at /Users/heiko/.rbenv/versions/jruby-9.1.6.0/lib/ruby/stdlib/jruby/compiler.rb:142
  block in compile_files_with_options at /Users/heiko/.rbenv/versions/jruby-9.1.6.0/lib/ruby/stdlib/jruby/compiler.rb:297
           compile_files_with_options at /Users/heiko/.rbenv/versions/jruby-9.1.6.0/lib/ruby/stdlib/jruby/compiler.rb:281
                         compile_argv at /Users/heiko/.rbenv/versions/jruby-9.1.6.0/lib/ruby/stdlib/jruby/compiler.rb:94
                               <main> at /Users/heiko/.rbenv/versions/jruby-9.1.6.0/bin/jrubyc:5

Environment

$ ruby -v
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
$ echo $JRUBY_OPTS

$ uname -a
Darwin Heikos-MBPtina.XXXX 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
@olleolleolle
Copy link
Member

olleolleolle commented Mar 20, 2017

I tried the program with 9.1.8.0: same

$ jrubyc --javac foo/bar.rb
RuntimeError: No classes found in target script: foo/bar.rb
  block in compile_files_with_options at /Users/olle/.rvm/rubies/jruby-9.1.8.0/lib/ruby/stdlib/jruby/compiler.rb:142
  block in compile_files_with_options at /Users/olle/.rvm/rubies/jruby-9.1.8.0/lib/ruby/stdlib/jruby/compiler.rb:297
                                 each at org/jruby/RubyArray.java:1734
           compile_files_with_options at /Users/olle/.rvm/rubies/jruby-9.1.8.0/lib/ruby/stdlib/jruby/compiler.rb:281
                         compile_argv at /Users/olle/.rvm/rubies/jruby-9.1.8.0/lib/ruby/stdlib/jruby/compiler.rb:94
                               <main> at /Users/olle/.rvm/rubies/jruby-9.1.8.0/bin/jrubyc:5
$ ruby -v
jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [darwin-x86_64]
$ uname -a
Darwin Olles-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

@kares
Copy link
Member

kares commented Apr 21, 2017

this is a known (current) limitation ... you should not nest your classes (for now, use java_package 'foo')

@kares kares changed the title rubyc does not find classes inside modules jrubyc does not find classes inside modules Apr 21, 2017
@enebo enebo added this to the Invalid or Duplicate milestone Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants