Created
June 26, 2014 12:53
-
-
Save jkutner/7d0129dbf05cb3a4f26f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
class Example | |
java_annotation 'Deprecated' | |
java_field "public java.lang.String abc" | |
def test0 | |
to_java.abc = "quack" | |
end | |
def test1 | |
to_java.abc | |
end | |
def test2 | |
# for non-public | |
f = to_java.java_class.get_declared_field('abc') | |
f.accessible = true | |
f.get(to_java) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ jrubyc --java example.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment