public ClassReference14Processor() { InvocationExprent invfor = new InvocationExprent(); invfor.setName("forName"); invfor.setClassname("java/lang/Class"); invfor.setStringDescriptor("(Ljava/lang/String;)Ljava/lang/Class;"); invfor.setDescriptor(MethodDescriptor.parseDescriptor("(Ljava/lang/String;)Ljava/lang/Class;")); invfor.setStatic(true); invfor.setLstParameters( Arrays.asList(new Exprent[] {new VarExprent(0, VarType.VARTYPE_STRING, null)})); bodyexprent = new ExitExprent(ExitExprent.EXIT_RETURN, invfor, VarType.VARTYPE_CLASS, null); InvocationExprent constr = new InvocationExprent(); constr.setName("<init>"); constr.setClassname("java/lang/NoClassDefFoundError"); constr.setStringDescriptor("()V"); constr.setFunctype(InvocationExprent.TYP_INIT); constr.setDescriptor(MethodDescriptor.parseDescriptor("()V")); NewExprent newexpr = new NewExprent( new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/NoClassDefFoundError"), new ArrayList<Exprent>(), null); newexpr.setConstructor(constr); InvocationExprent invcause = new InvocationExprent(); invcause.setName("initCause"); invcause.setClassname("java/lang/NoClassDefFoundError"); invcause.setStringDescriptor("(Ljava/lang/Throwable;)Ljava/lang/Throwable;"); invcause.setDescriptor( MethodDescriptor.parseDescriptor("(Ljava/lang/Throwable;)Ljava/lang/Throwable;")); invcause.setInstance(newexpr); invcause.setLstParameters( Arrays.asList( new Exprent[] { new VarExprent( 2, new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/ClassNotFoundException"), null) })); handlerexprent = new ExitExprent(ExitExprent.EXIT_THROW, invcause, null, null); }
private static String isClass14Invocation( Exprent exprent, ClassWrapper wrapper, MethodWrapper meth) { if (exprent.type == Exprent.EXPRENT_FUNCTION) { FunctionExprent fexpr = (FunctionExprent) exprent; if (fexpr.getFuncType() == FunctionExprent.FUNCTION_IIF) { if (fexpr.getLstOperands().get(0).type == Exprent.EXPRENT_FUNCTION) { FunctionExprent headexpr = (FunctionExprent) fexpr.getLstOperands().get(0); if (headexpr.getFuncType() == FunctionExprent.FUNCTION_EQ) { if (headexpr.getLstOperands().get(0).type == Exprent.EXPRENT_FIELD && headexpr.getLstOperands().get(1).type == Exprent.EXPRENT_CONST && ((ConstExprent) headexpr.getLstOperands().get(1)) .getConstType() .equals(VarType.VARTYPE_NULL)) { FieldExprent field = (FieldExprent) headexpr.getLstOperands().get(0); ClassNode fieldnode = DecompilerContext.getClassProcessor() .getMapRootClasses() .get(field.getClassname()); if (fieldnode != null && fieldnode.classStruct.qualifiedName.equals( wrapper.getClassStruct().qualifiedName)) { // source class StructField fd = wrapper .getClassStruct() .getField( field.getName(), field.getDescriptor().descriptorString); // FIXME: can be null! why?? if (fd != null && fd.hasModifier(CodeConstants.ACC_STATIC) && (fd.isSynthetic() || DecompilerContext.getOption(IFernflowerPreferences.SYNTHETIC_NOT_SET))) { if (fexpr.getLstOperands().get(1).type == Exprent.EXPRENT_ASSIGNMENT && fexpr.getLstOperands().get(2).equals(field)) { AssignmentExprent asexpr = (AssignmentExprent) fexpr.getLstOperands().get(1); if (asexpr.getLeft().equals(field) && asexpr.getRight().type == Exprent.EXPRENT_INVOCATION) { InvocationExprent invexpr = (InvocationExprent) asexpr.getRight(); if (invexpr.getClassname().equals(wrapper.getClassStruct().qualifiedName) && invexpr.getName().equals(meth.methodStruct.getName()) && invexpr .getStringDescriptor() .equals(meth.methodStruct.getDescriptor())) { if (invexpr.getLstParameters().get(0).type == Exprent.EXPRENT_CONST) { wrapper .getHiddenMembers() .add( InterpreterUtil.makeUniqueKey( fd.getName(), fd.getDescriptor())); // hide synthetic field return ((ConstExprent) invexpr.getLstParameters().get(0)) .getValue() .toString(); } } } } } } } } } } } return null; }