Änderung sodass OLFun2 nun den Rückgabetyp des Funktionstyps auch zurückgibt.
Anpassung entsprechend in den Tests.
This commit is contained in:
parent
a0367d5464
commit
1cf1c99e72
@ -592,7 +592,6 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
this.lamCounter++;
|
this.lamCounter++;
|
||||||
|
|
||||||
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
||||||
//ToDo Etienne: Double Check
|
|
||||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
|
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
|
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
|
||||||
.params
|
.params
|
||||||
@ -828,7 +827,6 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
} else if(!helper.isInCurrPkg(clazz)){
|
} else if(!helper.isInCurrPkg(clazz)){
|
||||||
if(clazz.contains(CONSTANTS.$$)) {
|
if(clazz.contains(CONSTANTS.$$)) {
|
||||||
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
||||||
//ToDo Etienne: Double Check
|
|
||||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
|
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
|
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
|
||||||
.arglist
|
.arglist
|
||||||
|
@ -153,7 +153,6 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ToDo Etienne: ändern
|
|
||||||
@Override
|
@Override
|
||||||
public String visit(Lambda lambdaExpression) {
|
public String visit(Lambda lambdaExpression) {
|
||||||
String desc = "(";
|
String desc = "(";
|
||||||
|
@ -47,24 +47,28 @@ public class OLFun2Test {
|
|||||||
@Test
|
@Test
|
||||||
public void mExistsWithIntegerInteger() throws Exception{
|
public void mExistsWithIntegerInteger() throws Exception{
|
||||||
Method m = classToTest.getDeclaredMethod("m", classFun1IntInt);
|
Method m = classToTest.getDeclaredMethod("m", classFun1IntInt);
|
||||||
|
assertEquals(Integer.class, m.getReturnType());
|
||||||
assertNotNull(m);
|
assertNotNull(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void mExistsWithIntegerDouble() throws Exception{
|
public void mExistsWithIntegerDouble() throws Exception{
|
||||||
Method m = classToTest.getDeclaredMethod("m", classFun1IntDouble);
|
Method m = classToTest.getDeclaredMethod("m", classFun1IntDouble);
|
||||||
|
assertEquals(Double.class, m.getReturnType());
|
||||||
assertNotNull(m);
|
assertNotNull(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void mExistsWithDoubleInteger() throws Exception{
|
public void mExistsWithDoubleInteger() throws Exception{
|
||||||
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleInt);
|
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleInt);
|
||||||
|
assertEquals(Integer.class, m.getReturnType());
|
||||||
assertNotNull(m);
|
assertNotNull(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void mExistsWithDoubleDouble() throws Exception{
|
public void mExistsWithDoubleDouble() throws Exception{
|
||||||
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleDouble);
|
Method m = classToTest.getDeclaredMethod("m", classFun1DoubleDouble);
|
||||||
|
assertEquals(Double.class, m.getReturnType());
|
||||||
assertNotNull(m);
|
assertNotNull(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,5 +9,6 @@ public class OLFun2 {
|
|||||||
m(f){
|
m(f){
|
||||||
var x = 1;
|
var x = 1;
|
||||||
var y = f.apply(x + x) + 1;
|
var y = f.apply(x + x) + 1;
|
||||||
|
return y;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user