Last active
December 21, 2015 06:18
-
-
Save cjmamo/6262775 to your computer and use it in GitHub Desktop.
JRuby Complex Classes in Java Method Signatures
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
NoMethodError: undefined method `start_with?' for #<Java::OrgJrubyAstJava_signature::ReferenceTypeNode:0x3b9fa8f7> | |
as_java_type at /opt/jruby-1.7.4/lib/ruby/shared/jruby/compiler/java_signature.rb:20 | |
parameters at /opt/jruby-1.7.4/lib/ruby/shared/jruby/compiler/java_signature.rb:48 | |
each at file:/opt/jruby-1.7.4/lib/jruby.jar!/jruby/java/java_ext/java.util.rb:7 | |
map at org/jruby/RubyEnumerable.java:713 | |
parameters at /opt/jruby-1.7.4/lib/ruby/shared/jruby/compiler/java_signature.rb:48 | |
types at /opt/jruby-1.7.4/lib/ruby/shared/jruby/compiler/java_signature.rb:54 | |
java_signature at /opt/jruby-1.7.4/lib/ruby/shared/jruby/core_ext/class.rb:44 | |
Foo at lib/example.rb:12 | |
(root) at lib/example.rb:11 |
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 'jruby/core_ext' | |
class Foo | |
java_signature 'void bar(int, int)' | |
def bar(a, b) | |
puts a + b | |
end | |
end | |
Foo.become_java!.declared_methods.each { |m| | |
puts m | |
} |
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 'jruby/core_ext' | |
class MyClass | |
attr_accessor :b | |
def initialize(b) | |
@b = b | |
end | |
end | |
class Foo | |
java_signature 'void bar(int, MyClass)' | |
def bar(a, my_class) | |
puts a + my_class.b | |
end | |
end | |
Foo.become_java!.declared_methods.each { |m| | |
puts m | |
} |
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 'jruby/core_ext' | |
class MyClass | |
attr_accessor :b | |
def initialize(b) | |
@b = b | |
end | |
end | |
class Foo | |
add_method_signature('bar', [java.lang.Void, Java::java.lang.Integer::TYPE, MyClass.become_java!(false)]) | |
def bar(a, my_class) | |
puts a + my_class.b | |
end | |
end | |
Foo.become_java!.declared_methods.each { |m| | |
puts m | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment