Skip to content

Commit

Permalink
fix pushing of constant classes on the stack with ASM when using prim…
Browse files Browse the repository at this point in the history
…itive types
  • Loading branch information
mariofusco committed May 4, 2012
1 parent dd573ce commit 55a8977
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ private void _finishJIT() {

mv = cw.visitMethod(ACC_PUBLIC, "getKnownEgressType", "()Ljava/lang/Class;", null, null);
mv.visitCode();
mv.visitLdcInsn(org.mvel2.asm.Type.getType(returnType != null ? returnType : Object.class));
visitConstantClass(returnType);
mv.visitInsn(ARETURN);

mv.visitMaxs(1, 1);
Expand Down Expand Up @@ -697,6 +697,15 @@ private void _finishJIT() {

}

private void visitConstantClass(Class<?> clazz) {
if (clazz == null) clazz = Object.class;
if (clazz.isPrimitive()) {
mv.visitFieldInsn(GETSTATIC, toNonPrimitiveType(clazz).getName().replace(".", "/"), "TYPE", "Ljava/lang/Class;");
} else {
mv.visitLdcInsn(org.mvel2.asm.Type.getType(clazz));
}
}

private Accessor _initializeAccessor() throws Exception {
if (deferFinish) {
return null;
Expand Down

0 comments on commit 55a8977

Please sign in to comment.