Skip to content

Commit 596f7c5

Browse files
committed
fix: correct use of return opcodes
1 parent e71eab3 commit 596f7c5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationUtil.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,16 @@ private void generateMethodOverride(ClassWriter cw, Method method, String intern
326326
// Return result or void
327327
if (method.getReturnType() == Void.TYPE) {
328328
mv.visitInsn(Opcodes.RETURN);
329+
} else if (method.getReturnType().isPrimitive()) {
330+
if (method.getReturnType() == Long.TYPE) {
331+
mv.visitInsn(Opcodes.LRETURN);
332+
} else if (method.getReturnType() == Float.TYPE) {
333+
mv.visitInsn(Opcodes.FRETURN);
334+
} else if (method.getReturnType() == Double.TYPE) {
335+
mv.visitInsn(Opcodes.DRETURN);
336+
} else {
337+
mv.visitInsn(Opcodes.IRETURN);
338+
}
329339
} else {
330340
mv.visitInsn(Opcodes.ARETURN);
331341
}

0 commit comments

Comments
 (0)