Hello folks!

I'm improving JRuby's support for instance variables-as-fields, which
involves generating a new JVM class with a field per instance variable in
the Ruby class.

The construction process for these classes involves an implementation of my
"ObjectAllocator" interface, which is stored with the Ruby class.

Previously, the generated classes also included a generated child class
that implenented ObjectAllocator appropriately. I was hoping to use
LambdaMetafactory to avoid generating that class, but I'm running into a

Say we have a Ruby class with three instance variables. JRuby will generate
a "RubyObject3" class that holds those variables in their own fields var0,
var1, and var2. The process leading up to the bug goes like this:

* Generate the RubyObject3 class, in its own classloader that's a child of
the current one.
* Acquire a constructor handle for that class.
* Use that constructor with LambdaMetafactory.metafactory to produce an
allocator-creating call site.
* Invoke that call site to get the one allocator instance we need.

Note that since the metafactory call requires a Lookup, I am providing it
one from the parent classloader.

I am able to get through this process without error. However, when I
finally invoke the allocator, I get a NoClassDefFoundError and a stack
trace that ends at the allocator call.

So...what am I doing wrong?

- Charlie
mlvm-dev mailing list

Reply via email to