Änderung sodass OLFun2 nun den Rückgabetyp des Funktionstyps auch zurückgibt.

Anpassung entsprechend in den Tests.
This commit is contained in:
Etienne Zink 2022-04-20 15:20:01 +02:00
parent a0367d5464
commit 1cf1c99e72
4 changed files with 5 additions and 3 deletions

View File

@ -592,7 +592,6 @@ public class BytecodeGenMethod implements StatementVisitor {
this.lamCounter++;
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
//ToDo Etienne: Double Check
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
.params
@ -828,7 +827,6 @@ public class BytecodeGenMethod implements StatementVisitor {
} else if(!helper.isInCurrPkg(clazz)){
if(clazz.contains(CONSTANTS.$$)) {
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
//ToDo Etienne: Double Check
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
.arglist

View File

@ -153,7 +153,6 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
return desc;
}
//ToDo Etienne: ändern
@Override
public String visit(Lambda lambdaExpression) {
String desc = "(";

View File

@ -47,24 +47,28 @@ public class OLFun2Test {
@Test
public void mExistsWithIntegerInteger() throws Exception{
Method m = classToTest.getDeclaredMethod("m", classFun1IntInt);
assertEquals(Integer.class, m.getReturnType());
assertNotNull(m);
}
@Test
public void mExistsWithIntegerDouble() throws Exception{
Method m = classToTest.getDeclaredMethod("m", classFun1IntDouble);
assertEquals(Double.class, m.getReturnType());
assertNotNull(m);
}
@Test
public void mExistsWithDoubleInteger() throws Exception{
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleInt);
assertEquals(Integer.class, m.getReturnType());
assertNotNull(m);
}
@Test
public void mExistsWithDoubleDouble() throws Exception{
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleDouble);
assertEquals(Double.class, m.getReturnType());
assertNotNull(m);
}

View File

@ -9,5 +9,6 @@ public class OLFun2 {
m(f){
var x = 1;
var y = f.apply(x + x) + 1;
return y;
}
}