private void initConstant() { if (type == CONSTANT_Class) { String className = getString(); isArray = (className.length() > 0 && className.charAt(0) == '['); // empty string for a class name seems to be possible in some android files } }
public String getExcClassname(int index, ConstantPool pool) { return pool.getPrimitiveConstant(throwsExceptions.get(index)).getString(); }
@Override public void resolveConstant(ConstantPool pool) { if (type == CONSTANT_Class || type == CONSTANT_String || type == CONSTANT_MethodType) { value = pool.getPrimitiveConstant(index).getString(); initConstant(); } }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int index = data.readUnsignedShort(); signature = pool.getPrimitiveConstant(index).getString(); }
public static AnnotationExprent parseAnnotation(DataInputStream data, ConstantPool pool) throws IOException { String className = pool.getPrimitiveConstant(data.readUnsignedShort()).getString(); List<String> names; List<Exprent> values; int len = data.readUnsignedShort(); if (len > 0) { names = new ArrayList<>(len); values = new ArrayList<>(len); for (int i = 0; i < len; i++) { names.add(pool.getPrimitiveConstant(data.readUnsignedShort()).getString()); values.add(parseAnnotationElement(data, pool)); } } else { names = Collections.emptyList(); values = Collections.emptyList(); } return new AnnotationExprent(new VarType(className).value, names, values); }
PooledConstant constant = bootstrapArguments.get(0); if (constant.type == CodeConstants.CONSTANT_String) { String recipe = ((PrimitiveConstant)constant).getString();
@Override public void resolveConstant(ConstantPool pool) { if (type == CONSTANT_NameAndType) { elementname = pool.getPrimitiveConstant(index1).getString(); descriptor = pool.getPrimitiveConstant(index2).getString(); } else if (type == CONSTANT_MethodHandle) { LinkConstant ref_info = pool.getLinkConstant(index2); classname = ref_info.classname; elementname = ref_info.elementname; descriptor = ref_info.descriptor; } else { if (type != CONSTANT_InvokeDynamic) { classname = pool.getPrimitiveConstant(index1).getString(); } LinkConstant nametype = pool.getLinkConstant(index2); elementname = nametype.elementname; descriptor = nametype.descriptor; } initConstant(); }
public String[] getClassElement(int elementType, String className, int nameIndex, int descriptorIndex) { String elementName = ((PrimitiveConstant)getConstant(nameIndex)).getString(); String descriptor = ((PrimitiveConstant)getConstant(descriptorIndex)).getString(); if (interceptor != null) { String oldClassName = interceptor.getOldName(className); if (oldClassName != null) { className = oldClassName; } String newElement = interceptor.getName(className + ' ' + elementName + ' ' + descriptor); if (newElement != null) { elementName = newElement.split(" ")[1]; } String newDescriptor = buildNewDescriptor(elementType == FIELD, descriptor); if (newDescriptor != null) { descriptor = newDescriptor; } } return new String[]{elementName, descriptor}; }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedByte(); List<Entry> entries; if (len > 0) { entries = new ArrayList<>(len); for (int i = 0; i < len; i++) { int nameIndex = data.readUnsignedShort(); String name = nameIndex != 0 ? pool.getPrimitiveConstant(nameIndex).getString() : null; int access_flags = data.readUnsignedShort(); entries.add(new Entry(name, access_flags)); } } else { entries = Collections.emptyList(); } myEntries = Collections.unmodifiableList(entries); }
public PrimitiveConstant getPrimitiveConstant(int index) { PrimitiveConstant cn = (PrimitiveConstant)getConstant(index); if (cn != null && interceptor != null) { if (cn.type == CodeConstants.CONSTANT_Class) { String newName = buildNewClassname(cn.getString()); if (newName != null) { cn = new PrimitiveConstant(CodeConstants.CONSTANT_Class, newName); } } } return cn; }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { entries = new ArrayList<>(len); for (int i = 0; i < len; i++) { int innerNameIdx = data.readUnsignedShort(); int outerNameIdx = data.readUnsignedShort(); int simpleNameIdx = data.readUnsignedShort(); int accessFlags = data.readUnsignedShort(); String innerName = pool.getPrimitiveConstant(innerNameIdx).getString(); String outerName = outerNameIdx != 0 ? pool.getPrimitiveConstant(outerNameIdx).getString() : null; String simpleName = simpleNameIdx != 0 ? pool.getPrimitiveConstant(simpleNameIdx).getString() : null; entries.add(new Entry(outerNameIdx, simpleNameIdx, accessFlags, innerName, outerName, simpleName)); } } else { entries = Collections.emptyList(); } }
while (currentClass != null) { if (currentClass.superClass != null) { queue.add(currentClass.superClass.getString());
StructClass clParent = classes.get(clStr.superClass.getString()); if (clParent != null) { stack.add(clParent);
Map<String, String> mapClass = classNameMaps.get(cl.superClass.getString()); if (mapClass != null) { names.putAll(mapClass);
protected Map<String, StructGeneralAttribute> readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException { int length = in.readUnsignedShort(); Map<String, StructGeneralAttribute> attributes = new HashMap<>(length); for (int i = 0; i < length; i++) { int nameIndex = in.readUnsignedShort(); String name = pool.getPrimitiveConstant(nameIndex).getString(); StructGeneralAttribute attribute = readAttribute(in, pool, name); if (attribute != null) { if (StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TABLE.getName().equals(name) && attributes.containsKey(name)) { // merge all variable tables StructLocalVariableTableAttribute table = (StructLocalVariableTableAttribute)attributes.get(name); table.add((StructLocalVariableTableAttribute)attribute); } else if (StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE.getName().equals(name) && attributes.containsKey(name)) { // merge all variable tables StructLocalVariableTypeTableAttribute table = (StructLocalVariableTypeTableAttribute)attributes.get(name); table.add((StructLocalVariableTypeTableAttribute)attribute); } else { attributes.put(attribute.getName(), attribute); } } } return attributes; }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { localVariables = new ArrayList<>(len); for (int i = 0; i < len; i++) { int start_pc = data.readUnsignedShort(); int length = data.readUnsignedShort(); int nameIndex = data.readUnsignedShort(); int descriptorIndex = data.readUnsignedShort(); int varIndex = data.readUnsignedShort(); localVariables.add(new LocalVariable(start_pc, length, pool.getPrimitiveConstant(nameIndex).getString(), pool.getPrimitiveConstant(descriptorIndex).getString(), varIndex)); } } else { localVariables = Collections.emptyList(); } }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int classIndex = data.readUnsignedShort(); int methodIndex = data.readUnsignedShort(); className = pool.getPrimitiveConstant(classIndex).getString(); if (methodIndex != 0) { LinkConstant lk = pool.getLinkConstant(methodIndex); methodName = lk.elementname; methodDescriptor = lk.descriptor; } }
boolean hasNonTrivialSuperClass = cl.superClass != null && !VarType.VARTYPE_OBJECT.equals(new VarType(cl.superClass.getString(), true)); if (hasNonTrivialSuperClass || interfaces.length > 1) { // can't have multiple 'sources' String message = "Inconsistent anonymous class definition: '" + cl.qualifiedName + "'. Multiple interfaces and/or super class defined."; case opc_checkcast: case opc_instanceof: if (cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) { refCounter++; refNotNew = true; case opc_anewarray: case opc_multianewarray: if (cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) { refCounter++;
for (int j = 0; j < attrSize; j++) { int attrNameIndex = in.readUnsignedShort(); String attrName = pool.getPrimitiveConstant(attrNameIndex).getString(); if (!StructGeneralAttribute.ATTRIBUTE_CODE.getName().equals(attrName)) { in.discard(in.readInt());
int thisClassIdx = in.readUnsignedShort(); int superClassIdx = in.readUnsignedShort(); qualifiedName = pool.getPrimitiveConstant(thisClassIdx).getString(); superClass = pool.getPrimitiveConstant(superClassIdx); for (int i = 0; i < length; i++) { interfaces[i] = in.readUnsignedShort(); interfaceNames[i] = pool.getPrimitiveConstant(interfaces[i]).getString();