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

annotations does not working without generating java class #4541

Closed
HeikoBornholdt opened this issue Mar 21, 2017 · 1 comment
Closed

annotations does not working without generating java class #4541

HeikoBornholdt opened this issue Mar 21, 2017 · 1 comment

Comments

@HeikoBornholdt
Copy link

I've got this ruby class (hello_world.rb) and want to get the java annotations:

java_annotation 'Deprecated'
class HelloWorld
  java_signature 'void main(String[] args)'
  def self.main(args = [])
    puts "HelloWorld.become_java.annotations.empty? = #{HelloWorld.become_java!.annotations.empty?}"
  end
end

It look like, that annotations only work after generation to true java class.

Expected Behavior

$ ruby -e "require './hello_world.rb'; HelloWorld.main"
HelloWorld.become_java.annotations.empty? = false

$ jrubyc --javac hello_world.rb
$ java -cp jruby.jar:. HelloWorld
HelloWorld.become_java.annotations.empty? = false

(both times I get false)

Actual Behavior

$ ruby -e "require './hello_world.rb'; HelloWorld.main"
HelloWorld.become_java.annotations.empty? = true

$ jrubyc --javac hello_world.rb
$ java -cp jruby.jar:. HelloWorld
HelloWorld.become_java.annotations.empty? = false

(I get true and false)

Environment

$ ruby -v
jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab 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
@headius
Copy link
Member

headius commented Mar 22, 2017

It's possible we've never hooked up java_annotation to become_java.

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