private static int getTypeSize(char type) { switch (type) { case 'J': case 'D': return 8; case '[': case 'L': case 'I': case 'F': return 4; case 'C': case 'S': return 2; case 'B': case 'Z': return 1; } throw new ExceptionWithContext("Invalid type: %s", type); }
public ClassProto(@Nonnull ClassPath classPath, @Nonnull String type) { if (type.charAt(0) != 'L') { throw new ExceptionWithContext("Cannot construct ClassProto for non reference type: %s", type); } this.classPath = classPath; this.type = type; }
return 8; throw new ExceptionWithContext("Invalid field type: %s", field.getType());
@Nonnull public static RegisterType getWideRegisterType(@Nonnull CharSequence type, boolean firstRegister) { switch (type.charAt(0)) { case 'J': if (firstRegister) { return getRegisterType(LONG_LO, null); } else { return getRegisterType(LONG_HI, null); } case 'D': if (firstRegister) { return getRegisterType(DOUBLE_LO, null); } else { return getRegisterType(DOUBLE_HI, null); } default: throw new ExceptionWithContext("Cannot use this method for narrow register type: %s", type); } }
int handlerAddress = handler.getHandlerCodeAddress(); if (handlerAddress >= codeSize) { throw new ExceptionWithContext( "Exception handler offset %d is past the end of the code block.", handlerAddress);
break; default: throw new ExceptionWithContext("Unrecognized reference type: %d", instruction.getOpcode().referenceType); throw new ExceptionWithContext("Method %s has no instructions, but has try blocks.", ReferenceUtil.getMethodDescriptor(method));
throw new ExceptionWithContext("Class %s has already been interned", poolClassDef.getType()); String fieldDescriptor = ReferenceUtil.getShortFieldDescriptor(field); if (!fields.add(fieldDescriptor)) { throw new ExceptionWithContext("Multiple definitions for field %s->%s", poolClassDef.getType(), fieldDescriptor); String methodDescriptor = ReferenceUtil.getMethodDescriptor(method, true); if (!methods.add(methodDescriptor)) { throw new ExceptionWithContext("Multiple definitions for method %s->%s", poolClassDef.getType(), methodDescriptor);
break; default: throw new ExceptionWithContext("Invalid method handle type: %d", methodHandleReference.getMethodHandleType());
throw new ExceptionWithContext("Invalid debug item type: " + debugItem.getDebugItemType());
codeWriter, ehBuf, methodKey, tryBlocks, instructions, debugItemOffset); } catch (RuntimeException ex) { throw new ExceptionWithContext(ex, "Exception occurred while writing code_item for method %s", methodSection.getMethodReference(methodKey));
break; default: throw new ExceptionWithContext("Unsupported instruction format: %s", instruction.getOpcode().format); throw new ExceptionWithContext(ex, "Error while writing instruction at code offset 0x%x", codeOffset); throw new ExceptionWithContext("No exception handlers for the try block!");
String superclass = fieldClass.getSuperclass(); if (superclass == null) { throw new ExceptionWithContext("Couldn't find accessible class while resolving field %s", ReferenceUtil.getShortFieldDescriptor(resolvedField)); throw new ExceptionWithContext("Couldn't find accessible class while resolving field %s", ReferenceUtil.getShortFieldDescriptor(resolvedField));
throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
String superclass = methodClass.getSuperclass(); if (superclass == null) { throw new ExceptionWithContext("Couldn't find accessible class while resolving method %s", ReferenceUtil.getMethodDescriptor(resolvedMethod, true)); classPath.getClass(methodClass.getType()).getMethodByVtableIndex(methodIndex); if (newResolvedMethod == null) { throw new ExceptionWithContext("Couldn't find accessible class while resolving method %s", ReferenceUtil.getMethodDescriptor(resolvedMethod, true));
return; default: throw new ExceptionWithContext("Instruction format %s not supported", instruction.getOpcode().format);
public static int getMethodHandleType(String methodHandleType) { Integer ret = methodHandleTypeNames.inverse().get(methodHandleType); if (ret == null) { throw new ExceptionWithContext("Invalid method handle type: %s", methodHandleType); } return ret; }
@Override public int getItemIndex(@Nonnull CharSequence key) { Integer index = internedItems.get(key.toString()); if (index == null) { throw new ExceptionWithContext("Item not found.: %s", key.toString()); } return index; }
@Override public int getItemOffset(@Nonnull Key key) { Integer offset = internedItems.get(key); if (offset == null) { throw new ExceptionWithContext("Item not found.: %s", getItemString(key)); } return offset; }
@Override public int getItemIndex(@Nonnull Key key) { Integer index = internedItems.get(key); if (index == null) { throw new ExceptionWithContext("Item not found.: %s", getItemString(key)); } return index; }
throw new ExceptionWithContext("Invalid 31t opcode: %s", instruction.getOpcode());