Skip to content

Commit

Permalink
Fix crash with void return type in TypeSignature code (#1468)
Browse files Browse the repository at this point in the history
I'm not sure why there was an assert fail before, but it's
straightforward enough to do the right thing.
  • Loading branch information
msridhar authored Nov 20, 2024
1 parent e925830 commit 35684ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public static TypeSignature make(String s) throws IllegalArgumentException {
assert !s.isEmpty();
switch (s.charAt(0)) {
case TypeReference.VoidTypeCode:
Assertions.UNREACHABLE();
return null;
return BaseType.VOID;
case TypeReference.BooleanTypeCode:
return BaseType.BOOLEAN;
case TypeReference.ByteTypeCode:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ void getArguments() {
MethodTypeSignature.make("(I)V").getArguments(),
arrayContaining(is(TypeSignature.make("I"))));
}

@Test
void getVoidReturn() {
assertThat(MethodTypeSignature.make("(I)V").getReturnType(), is(TypeSignature.make("V")));
}
}

0 comments on commit 35684ea

Please sign in to comment.