Skip to content

Commit 9040c38

Browse files
authored
Print a better error message when attempting to bridge from void to void (#35)
1 parent 95cee5b commit 9040c38

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

injector/src/main/java/com/infradna/tool/bridge_method_injector/MethodInjector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ public void inject(ClassVisitor cv) {
231231
if (returnType.equals(Type.VOID_TYPE) || returnType.getClassName().equals("java.lang.Void")) {
232232
// bridge to void, which means disregard the return value from the original method
233233
switch (originalReturnType.getSize()) {
234+
case 0:
235+
throw new IllegalArgumentException("Cannot bridge " + name + " from void to void; did you mean to use a different type?");
234236
case 1:
235237
mv.visitInsn(POP);
236238
break;

0 commit comments

Comments
 (0)