Skip to content

Commit

Permalink
Print a better error message when attempting to bridge from void to v…
Browse files Browse the repository at this point in the history
…oid (#35)
  • Loading branch information
basil authored Nov 17, 2022
1 parent 95cee5b commit 9040c38
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ public void inject(ClassVisitor cv) {
if (returnType.equals(Type.VOID_TYPE) || returnType.getClassName().equals("java.lang.Void")) {
// bridge to void, which means disregard the return value from the original method
switch (originalReturnType.getSize()) {
case 0:
throw new IllegalArgumentException("Cannot bridge " + name + " from void to void; did you mean to use a different type?");
case 1:
mv.visitInsn(POP);
break;
Expand Down

0 comments on commit 9040c38

Please sign in to comment.