0

Here are some code.

static synchronized void q(ua paramua, int paramInt) {
try {
 if (d) { if (paramInt > -16711936);
   return; }
 if (q * 514194583 > 0) { if (paramInt > -16711936);
   abf localabf = new abf(paramua);
   n.d(localabf, -984409319);
 }
 else {
   paramua.ma(false);
 }
 return; } catch (RuntimeException localRuntimeException) { throw aht.d(localRuntimeException, "ck.q(" + 41);
}
}

static synchronized void b(ua paramua)
{
  if (d) return;
  if (q * 514194583 > 0) {
    abf localabf = new abf(paramua);
    n.d(localabf, -836239689);
  }
  else {
    paramua.ma(false);
  }
}

These two methods performs equal actions. The second parameter of the first method is psudo-argument, so I want to clear original code and make this method like this...

static synchronized void q(ua paramua, int paramInt)
{
  if (d) return;
  if (q * 514194583 > 0) {
    abf localabf = new abf(paramua);
    n.d(localabf, -836239689);
  }
  else {
    paramua.ma(false);
  }
}

How can I do this action? I tried like this.

destMethodNode.instructions.clear();
destMethodNode.instructions.add(srcMethodNode.instructions);

But throws null pointer exception. What is the reason?

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67
SkyDragon
  • 11
  • 1

1 Answers1

0

See "Merging Two Classes into One" section of paper from AOSD'07 linked from the ASM's project page. It provides example how to properly use MethodNode to copy method's bytecode into another method.

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67