@Override public String toString() { return methodStruct.getName(); } }
public void addLibrary(File library) { structContext.addSpace(library, false); }
public StructLocalVariableTableAttribute getLocalVariableAttr() { return getAttribute(StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TABLE); }
public void expandData() throws IOException { if (containsCode && !expanded) { byte[] code = classStruct.getLoader().loadBytecode(this, codeFullLength); seq = parseBytecode(new DataInputFullStream(code), codeLength, classStruct.getPool()); expanded = true; } }
public String getDebugName(StructMethod method) { StructLocalVariableTableAttribute attr = method.getLocalVariableAttr(); if (attr != null && processor != null) { Integer origIndex = processor.getVarOriginalIndex(index); if (origIndex != null) { String name = attr.getName(origIndex, visibleOffset); if (name != null && TextUtil.isValidIdentifier(name, method.getClassStruct().getBytecodeVersion())) { return name; } } } return null; }
private void removeJsr(StructMethod mt) { removeJsrInstructions(mt.getClassStruct().getPool(), first, DataPoint.getInitialDataPoint(mt)); }
public StructField(DataInputFullStream in, StructClass clStruct) throws IOException { accessFlags = in.readUnsignedShort(); int nameIndex = in.readUnsignedShort(); int descriptorIndex = in.readUnsignedShort(); ConstantPool pool = clStruct.getPool(); String[] values = pool.getClassElement(ConstantPool.FIELD, clStruct.qualifiedName, nameIndex, descriptorIndex); name = values[0]; descriptor = values[1]; attributes = readAttributes(in, pool); }
private boolean isVarArgCall() { StructClass cl = DecompilerContext.getStructContext().getClass(classname); if (cl != null) { StructMethod mt = cl.getMethod(InterpreterUtil.makeUniqueKey(name, stringDescriptor)); if (mt != null) { return mt.hasModifier(CodeConstants.ACC_VARARGS); } } else { // TODO: tap into IDEA indices to access libraries methods details // try to check the class on the classpath Method mtd = ClasspathHelper.findMethod(classname, name, descriptor); return mtd != null && mtd.isVarArgs(); } return false; }
public StructMethod(DataInputFullStream in, StructClass clStruct) throws IOException { classStruct = clStruct; accessFlags = in.readUnsignedShort(); int nameIndex = in.readUnsignedShort(); int descriptorIndex = in.readUnsignedShort(); ConstantPool pool = clStruct.getPool(); String[] values = pool.getClassElement(ConstantPool.METHOD, clStruct.qualifiedName, nameIndex, descriptorIndex); name = values[0]; descriptor = values[1]; attributes = readAttributes(in, pool); if (codeAttributes != null) { attributes.putAll(codeAttributes); codeAttributes = null; } }
public boolean isSynthetic() { return hasModifier(CodeConstants.ACC_SYNTHETIC) || hasAttribute(StructGeneralAttribute.ATTRIBUTE_SYNTHETIC); }
private static boolean possiblySyntheticField(StructField fd) { return fd.getName().contains("$") && fd.hasModifier(CodeConstants.ACC_FINAL) && fd.hasModifier(CodeConstants.ACC_PRIVATE); }
public void reloadContext() throws IOException { for (ContextUnit unit : units.values()) { for (StructClass cl : unit.getClasses()) { classes.remove(cl.qualifiedName); } unit.reload(loader); // adjust global class collection for (StructClass cl : unit.getClasses()) { classes.put(cl.qualifiedName, cl); } } }
public static String buildJavaClassName(String name) { String res = name.replace('/', '.'); if (res.contains("$")) { // attempt to invoke foreign member // classes correctly StructClass cl = DecompilerContext.getStructContext().getClass(name); if (cl == null || !cl.isOwn()) { res = res.replace('$', '.'); } } return res; }
public boolean hasField(String name, String descriptor) { return getField(name, descriptor) != null; }
public StructContext(IResultSaver saver, IDecompiledData decompiledData, LazyLoader loader) { this.saver = saver; this.decompiledData = decompiledData; this.loader = loader; ContextUnit defaultUnit = new ContextUnit(ContextUnit.TYPE_FOLDER, null, "", true, saver, decompiledData); units.put("", defaultUnit); }
private static void destroyWrappers(ClassNode node) { node.wrapper = null; node.classStruct.releaseResources(); for (ClassNode nd : node.nested) { destroyWrappers(nd); } }
public void rename() { try { buildInheritanceTree(); renameAllClasses(); renameInterfaces(); renameClasses(); context.reloadContext(); } catch (IOException ex) { throw new RuntimeException("Renaming failed!"); } }
public void addSpace(File file, boolean isOwn) { addSpace("", file, isOwn, 0); }
public void addSource(File source) { structContext.addSpace(source, true); }