Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit d30cbec

Browse files
committed
support for java 8
1 parent b24c5c5 commit d30cbec

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
</properties>
1616

1717
<dependencies>
18-
<dependency>
19-
<groupId>javassist</groupId>
20-
<artifactId>javassist</artifactId>
21-
<version>3.12.1.GA</version>
22-
</dependency>
18+
<!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
19+
<dependency>
20+
<groupId>org.javassist</groupId>
21+
<artifactId>javassist</artifactId>
22+
<version>3.23.0-GA</version>
23+
</dependency>
24+
2325
<dependency>
2426
<groupId>log4j</groupId>
2527
<artifactId>log4j</artifactId>

src/bytecodeparser/CodeParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public void parse(OpHandler opHandler) throws BadBytecode {
5050
if(stop)
5151
break;
5252
int index = context.iterator.next();
53-
Op op = Opcodes.OPCODES.get(context.iterator.byteAt(index)).init(context, index);
53+
Op opcode = Opcodes.OPCODES.get(context.iterator.byteAt(index));
54+
if(opcode == null) continue;
55+
Op op = opcode.init(context, index);
5456
opHandler.handle(op, index);
5557
}
5658
}
@@ -86,4 +88,4 @@ public void begin() {
8688
public void stop() {
8789
stop = true;
8890
}
89-
}
91+
}

src/bytecodeparser/analysis/decoders/DecodedMethodInvocationOp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void simulate(Stack stack) {
106106
se = stack.pop2();
107107
else se = stack.pop();
108108
}
109-
if(op.as(MethodInvocationOpcode.class).isInstanceMethod())
109+
if (op.as(MethodInvocationOpcode.class).isInstanceMethod() && !stack.isEmpty())
110110
stack.pop();
111111
if(returnTypeLength != null) {
112112
if(returnTypeLength == DOUBLE)
@@ -326,4 +326,4 @@ public MethodParam[] merge() {
326326
return result;
327327
}
328328
}
329-
}
329+
}

src/bytecodeparser/analysis/stack/StackAnalyzer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ void analyze(int from, Stack stack) throws BadBytecode {
113113
Stack currentStack = stack.copy();
114114
while(iterator.hasNext()) {
115115
int index = iterator.next();
116-
Op op = Opcodes.OPCODES.get(iterator.byteAt(index)).init(context, index);
116+
Op opcode = Opcodes.OPCODES.get(iterator.byteAt(index));
117+
if(opcode == null) continue;
118+
Op op = opcode.init(context, index);
117119
trace.append("\n").append(index).append(":").append(op.getName()).append(" --> ");
118120
Frame frame = frames[index];
119121
frame.isAccessible = true;
@@ -332,4 +334,4 @@ protected void updateCursors(int pos, int length) {
332334
}
333335
}
334336
}
335-
}
337+
}

0 commit comments

Comments
 (0)