Class BlockInterfaceGenerator

java.lang.Object
org.jruby.java.codegen.BlockInterfaceGenerator

public final class BlockInterfaceGenerator extends Object
Generates a concrete subclass of BlockInterfaceTemplate for a Java interface, where every abstract method delegates straight into one of the inherited __ruby_call helpers. Default methods on the interface are intentionally not overridden, matching the pre-existing convertProcToInterface behavior where only abstract methods were backed by the proc.

For an interface such as:


   public interface MyIface {
       int compute(int a, String b);
       default int compute2(int a, String b) { return compute(a, b) * 2; }
   }
 
the generated class is equivalent to:

   public final class BlockInterfaceImpl$<hash> extends BlockInterfaceTemplate implements MyIface {
       public BlockInterfaceImpl$<hash>(RubyProc proc) { super(proc); }

       public int compute(int a, String b) {
           Object result = __ruby_call(Integer.TYPE, coerce(a), coerce(b));
           return ((Number) result).intValue();
       }
       // compute2 is not overridden — the interface default is used
   }