Merge pull request #221 from liuzhengyang/fixIsDoubleSlot

Fix Utils.isDoubleSlot, 'L' should be 'D'.
This commit is contained in:
Andy Clement
2020-08-27 15:05:09 -07:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -1016,7 +1016,7 @@ public class Utils implements Opcodes, Constants {
public boolean isDoubleSlot() {
if (kind == Kind.PRIMITIVE) {
char ch = descriptor.charAt(0);
return ch == 'J' || ch == 'L';
return ch == 'J' || ch == 'D';
}
return false;
}

View File

@@ -564,6 +564,13 @@ public class ReloadableTypeTests extends SpringLoadedTests {
assertFalse(rt.isDoubleSlot());
assertFalse(rt.isVoid());
rt = ReturnType.getReturnType("D");
assertEquals(ReturnType.Kind.PRIMITIVE, rt.kind);
assertEquals("D", rt.descriptor);
assertTrue(rt.isPrimitive());
assertTrue(rt.isDoubleSlot());
assertFalse(rt.isVoid());
rt = ReturnType.getReturnType("[Ljava/lang/String;");
assertEquals(ReturnType.Kind.ARRAY, rt.kind);
assertEquals("[Ljava/lang/String;", rt.descriptor);