TrigerSoft/jaque

Assignability in the TypeConverter

CollinAlpert opened this issue · 8 comments

There seems to be an issue with the assignability between int and Integer in the class InvocationExpression. When parsing a lambda with Integer parameters, the constructor in the InvocationExpression throws an IllegalArgumentException. It seems to be because int is not assignable from Integer, or the other way around. Here is my stacktrace:

java.lang.IllegalArgumentException: 0

	at com.trigersoft.jaque.expression.InvocationExpression.<init>(InvocationExpression.java:42)
	at com.trigersoft.jaque.expression.Expression.invoke(Expression.java:1126)
	at com.trigersoft.jaque.expression.ExpressionClassCracker.lambda(ExpressionClassCracker.java:114)
	at com.trigersoft.jaque.expression.LambdaExpression.parse(LambdaExpression.java:91)

This is the code I was running:

int age = 80;
int height = 200;
SqlPredicate<Person> predicate = person -> person.getAge() == age && person.getHeight() > height;
LambdaExpression<SqlPredicate<Person>> lambda = LambdaExpression.parse(predicate);

EDIT:
It seems that this problem only appears when using parameters in lambdas. If I use constants, the exception is not thrown.

Thanks for the fix! Will there be a new Maven artifact available for it?

Maven artifact: absolutely. I prefer to wait for couple of days - to see if the fix is OK and there is no more issues found. Is this OK from your side?

Of course, that's OK. I am just not able to test the new functionality to see if the fix is okay. But I can wait a few days.

No worries, I am not in a hurry. But maybe you should wait until the this issue is fixed?

All right, no problem.