diff --git a/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index 11b4b9a33..9bc96e956 100644 --- a/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -111,7 +111,6 @@ public class BytecodeGenMethod implements StatementVisitor { public BytecodeGenMethod(LambdaExpression lambdaExpression, ResultSet resultSet, MethodVisitor mv, int indexOfFirstParamLam, boolean isInterface, HashMap classFiles, String path, int lamCounter,SourceFile sf) { - this.resultSet = resultSet; this.mv = mv; this.isInterface = isInterface; @@ -379,6 +378,12 @@ public class BytecodeGenMethod implements StatementVisitor { case BIGGEREQUAL: mv.visitJumpInsn(Opcodes.IF_ICMPLT, branchLabel); break; + case EQUAL: + mv.visitJumpInsn(Opcodes.IF_ICMPNE, branchLabel); + break; + case NOTEQUAL: + mv.visitJumpInsn(Opcodes.IFEQ, branchLabel); + break; default: break; } @@ -404,6 +409,12 @@ public class BytecodeGenMethod implements StatementVisitor { case BIGGEREQUAL: mv.visitJumpInsn(Opcodes.IFLT, branchLabel); break; + case EQUAL: + mv.visitJumpInsn(Opcodes.IFNE, branchLabel); + break; + case NOTEQUAL: + mv.visitJumpInsn(Opcodes.IFEQ, branchLabel); + break; default: break; } @@ -569,7 +580,6 @@ public class BytecodeGenMethod implements StatementVisitor { new BytecodeGenMethod(lambdaExpression, this.resultSet, mvLambdaBody, indexOfFirstParamLam, isInterface, classFiles,this.path, lamCounter,sf); - mvLambdaBody.visitMaxs(0, 0); mvLambdaBody.visitEnd(); cw.visitInnerClass("java/lang/invoke/MethodHandles$Lookup", "java/lang/invoke/MethodHandles", "Lookup", @@ -851,11 +861,13 @@ public class BytecodeGenMethod implements StatementVisitor { // methCallType = "L"+methCallType+";"; // } for(java.lang.reflect.Method m : methods) { - if(name.equals(m.getName()) && i == m.getParameterCount() && methCallType.equals(m.getReturnType().getName().replace(".", "/"))) { + if(name.equals(m.getName()) && i == m.getParameterCount() && + (methCallType.equals(m.getReturnType().getName().replace(".", "/")) || + m.getReturnType().getName().replace(".", "/").equals(Type.getInternalName(Object.class)))) { boolean typesEqual = true; Class[] pTypes = m.getParameterTypes(); for(int j = 0; j { - if(x<0) { - return 0; - }else if (x < 1) { - return x; - } - else { - return x * (fact.apply(x-1)); - } - }; + if (x == 1) { + return 1; + } + else { + return x * (fact.apply(x-1)); + } + }; } // m (x) {