Hi, I’m new to JRuby and I have a question regarding passing ruby
variables to java.
Situation:
In java, I have an abstract class, called JClassA and another class
called JClassB.
In ruby, I implement the concreate class of JClassA, called RClass.
Here are the relations:
RCLass < JClassA.
JClassB(JClassA) (The constructor of JClassB takes JClassA as an
argument)
Problem:
From RClass, I need to call JClassB and give the current instance as an
argument.
If I do JClassB.new(self), then it will complain about not finding the
constructor.
On the other hand, if I do
JClassB.new(self.to_java(Java::SomePackage.JClassA)) then it complains
that it cannot find the method to_java in RClassB.
What am I doing wrong? Can I convert any ruby object to java object?
Thanks,
Pran.