Hi
How can I use the java_send method where the arguments are Java
interfaces ?
In the example in
Home · jruby/jruby Wiki · GitHub only use
classes.
When I specify an interface in the argument list like this:
traversal_description.java_send(:expand,
[org.neo4j.graphdb.PathExpander], pe)
I get the following stack trace:
TypeError: cannot convert instance of class org.jruby.RubyModule to
class
java.lang.Class
org/jruby/java/proxies/JavaProxy.java:332:in `java_send’
I found that you should use Class.for_name for interfaces since the java
interfaces become Ruby Modules by default, see (
http://jr.runcode.us/q/jruby-calls-the-wrong-method). But that does not
work either.
The reason why I’m doing this is because I wan’t to avoid a warning
about
“ambiguous Java methods found”
I’m trying to call the evaluator method in the Neo4j API
TraversalDescription,
http://api.neo4j.org/1.8.1/org/neo4j/graphdb/traversal/TraversalDescription.html
The first evaluator method takes an Evaluator Interface as argument.
The second evaluator method takes a PathEvaluator interface which
extends
the Evaluator interface and uses generics.
I’m using JRuby 1.7.1 on Java version “1.7.0_10”
Cheers
Andreas