Skip to content

Commit 459b812

Browse files
committedJun 12, 2018
Merge branch 'interface_returns_ruby_obj'
2 parents 13130e2 + ff90e42 commit 459b812

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎core/src/main/java/org/jruby/java/codegen/RealClassGenerator.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -822,12 +822,13 @@ public static void coerceResultAndReturn(SkinnyMethodAdapter mv, Class returnTyp
822822
}
823823
}
824824
} else {
825+
// if the return type is not an IRubyObject implementer, coerce to that type before casting
825826
if (!IRubyObject.class.isAssignableFrom(returnType)) {
826827
mv.ldc(Type.getType(returnType));
827828
mv.invokeinterface(
828829
p(IRubyObject.class), "toJava", sig(Object.class, Class.class));
829-
mv.checkcast(p(returnType));
830830
}
831+
mv.checkcast(p(returnType));
831832
mv.areturn();
832833
}
833834
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.