aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBaron Roberts <broberts@linkedin.com>2014-09-26 15:56:05 -0700
committerBaron Roberts <broberts@linkedin.com>2014-09-26 15:56:05 -0700
commit8741c8b33dd2be9d7ecea12c733c26adddaf00bd (patch)
treef32e79251024f3b41598a235ed615a96e73dbff7 /src
parent1663f10c67920394f6cc42d723d99326c0801b9d (diff)
downloadjavassist-8741c8b33dd2be9d7ecea12c733c26adddaf00bd.tar.gz
javassist-8741c8b33dd2be9d7ecea12c733c26adddaf00bd.zip
Support Javaflow NEW bytecode pattern for replacement.
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/expr/NewExpr.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/javassist/expr/NewExpr.java b/src/main/javassist/expr/NewExpr.java
index cda4b7c7..49c1ee49 100644
--- a/src/main/javassist/expr/NewExpr.java
+++ b/src/main/javassist/expr/NewExpr.java
@@ -140,8 +140,9 @@ public class NewExpr extends Expr {
private int canReplace() throws CannotCompileException {
int op = iterator.byteAt(newPos + 3);
- if (op == Opcode.DUP)
- return 4;
+ if (op == Opcode.DUP) // Typical single DUP or Javaflow DUP DUP2_X2 POP2
+ return ((iterator.byteAt(newPos + 4) == Opcode.DUP2_X2
+ && iterator.byteAt(newPos + 5) == Opcode.POP2)) ? 6 : 4;
else if (op == Opcode.DUP_X1
&& iterator.byteAt(newPos + 4) == Opcode.SWAP)
return 5;