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 resolveConstant(ConstantPool pool) { if (type == CONSTANT_Class || type == CONSTANT_String || type == CONSTANT_MethodType) { value = pool.getPrimitiveConstant(index).getString(); initConstant(); } }
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 void writeToStream(DataOutputStream out) throws IOException { out.writeByte(type); switch (type) { case CONSTANT_Integer: out.writeInt(getInt()); break; case CONSTANT_Float: out.writeFloat(getFloat()); break; case CONSTANT_Long: out.writeLong(getLong()); break; case CONSTANT_Double: out.writeDouble(getDouble()); break; case CONSTANT_Utf8: out.writeUTF(getString()); break; default: // CONSTANT_Class, CONSTANT_String, CONSTANT_MethodType out.writeShort(index); } }
public PrimitiveConstant(int type, Object value) { super(type); this.value = value; initConstant(); }
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Utf8, in.readUTF())); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Integer, Integer.valueOf(in.readInt()))); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Float, in.readFloat())); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Long, in.readLong())); pool.add(null); i++; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Double, in.readDouble())); pool.add(null); i++; case CodeConstants.CONSTANT_String: case CodeConstants.CONSTANT_MethodType: pool.add(new PrimitiveConstant(tag, in.readUnsignedShort())); nextPass[0].set(i); break;
public String getExcClassname(int index, ConstantPool pool) { return pool.getPrimitiveConstant(throwsExceptions.get(index)).getString(); }
public PrimitiveConstant(int type, Object value) { this.type = type; this.value = value; initConstant(); }
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Utf8, in.readUTF())); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Integer, Integer.valueOf(in.readInt()))); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Float, Float.valueOf(in.readFloat()))); break; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Long, Long.valueOf(in.readLong()))); pool.add(null); i++; pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Double, Double.valueOf(in.readDouble()))); pool.add(null); i++; case CodeConstants.CONSTANT_String: case CodeConstants.CONSTANT_MethodType: pool.add(new PrimitiveConstant(tag, in.readUnsignedShort())); nextPass[0].set(i); break;
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int index = data.readUnsignedShort(); signature = pool.getPrimitiveConstant(index).getString(); }
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; }
public void resolveConstant(ConstantPool pool) { if (type == CONSTANT_Class || type == CONSTANT_String || type == CONSTANT_MethodType) { value = pool.getPrimitiveConstant(index).getString(); initConstant(); } }
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); }
while (currentClass != null) { if (currentClass.superClass != null) { queue.add(currentClass.superClass.getString());
@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(); } }
StructClass clParent = classes.get(clStr.superClass.getString()); if (clParent != null) { stack.add(clParent);