public static boolean isInvocationInitConstructor(InvocationExprent inv, MethodWrapper method, ClassWrapper wrapper, boolean withThis) { if (inv.getFunctype() == InvocationExprent.TYP_INIT && inv.getInstance().type == Exprent.EXPRENT_VAR) { VarExprent instVar = (VarExprent)inv.getInstance(); VarVersionPair varPair = new VarVersionPair(instVar); String className = method.varproc.getThisVars().get(varPair); if (className != null) { // any this instance. TODO: Restrict to current class? return withThis || !wrapper.getClassStruct().qualifiedName.equals(inv.getClassname()); } } return false; } }
private static String getQualifiedNewInstance(String classname, List<Exprent> lstParams, int indent, BytecodeMappingTracer tracer) { ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(classname); if (node != null && node.type != ClassNode.CLASS_ROOT && node.type != ClassNode.CLASS_LOCAL && (node.access & CodeConstants.ACC_STATIC) == 0) { if (!lstParams.isEmpty()) { Exprent enclosing = lstParams.get(0); boolean isQualifiedNew = false; if (enclosing.type == Exprent.EXPRENT_VAR) { VarExprent varEnclosing = (VarExprent)enclosing; StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE)).classStruct; String this_classname = varEnclosing.getProcessor().getThisVars().get(new VarVersionPair(varEnclosing)); if (!current_class.qualifiedName.equals(this_classname)) { isQualifiedNew = true; } } else { isQualifiedNew = true; } if (isQualifiedNew) { return enclosing.toJava(indent, tracer).toString(); } } } return null; }
varName = parent.simpleName + ".this"; method.varproc.getThisVars().put(newVar, parent.classStruct.qualifiedName); varName = classNode.parent.simpleName + ".this"; method.varproc.getThisVars().put(newVar, classNode.parent.classStruct.qualifiedName);
StructClass current_class = (StructClass)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS); varproc.getThisVars().put(new VarVersionPair(0, 0), current_class.qualifiedName); varproc.setVarName(new VarVersionPair(0, 0), "this"); vc.addName("this");
method.varproc.getThisVars().put(new VarVersionPair(0, 0), parent_class_name); method.varproc.setVarName(new VarVersionPair(0, 0), parent.simpleName + ".this");
String this_classname = currentMethod.varproc.getThisVars().get(pair);
this_classname = varProc.getThisVars().get(varPair);
varProc.getThisVars().put(new VarVersionPair(0, 0), classStruct.qualifiedName); paramCount = 1;
public static boolean isInvocationInitConstructor(InvocationExprent inv, MethodWrapper method, ClassWrapper wrapper, boolean withThis) { if (inv.getFunctype() == InvocationExprent.TYP_INIT && inv.getInstance().type == Exprent.EXPRENT_VAR) { VarExprent instVar = (VarExprent)inv.getInstance(); VarVersionPair varPair = new VarVersionPair(instVar); String classname = method.varproc.getThisVars().get(varPair); if (classname != null) { // any this instance. TODO: Restrict to current class? if (withThis || !wrapper.getClassStruct().qualifiedName.equals(inv.getClassname())) { return true; } } } return false; } }
private static String getQualifiedNewInstance(String classname, List<Exprent> lstParams, int indent, BytecodeMappingTracer tracer) { ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(classname); if (node != null && node.type != ClassNode.CLASS_ROOT && node.type != ClassNode.CLASS_LOCAL && (node.access & CodeConstants.ACC_STATIC) == 0) { if (!lstParams.isEmpty()) { Exprent enclosing = lstParams.get(0); boolean isQualifiedNew = false; if (enclosing.type == Exprent.EXPRENT_VAR) { VarExprent varEnclosing = (VarExprent)enclosing; StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE)).classStruct; String this_classname = varEnclosing.getProcessor().getThisVars().get(new VarVersionPair(varEnclosing)); if (!current_class.qualifiedName.equals(this_classname)) { isQualifiedNew = true; } } else { isQualifiedNew = true; } if (isQualifiedNew) { return enclosing.toJava(indent, tracer).toString(); } } } return null; }
varName = parent.simpleName + ".this"; method.varproc.getThisVars().put(newVar, parent.classStruct.qualifiedName); varName = classNode.parent.simpleName + ".this"; method.varproc.getThisVars().put(newVar, classNode.parent.classStruct.qualifiedName);
StructClass current_class = (StructClass)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS); varproc.getThisVars().put(new VarVersionPair(0, 0), current_class.qualifiedName); varproc.setVarName(new VarVersionPair(0, 0), "this"); vc.addName("this");
method.varproc.getThisVars().put(new VarVersionPair(0, 0), parent_class_name); method.varproc.setVarName(new VarVersionPair(0, 0), parent.simpleName + ".this");
String this_classname = currentMethod.varproc.getThisVars().get(pair);
this_classname = varProc.getThisVars().get(varPair);
varProc.getThisVars().put(new VarVersionPair(0, 0), classStruct.qualifiedName); paramCount = 1;