8bitme / lambdaj

Automatically exported from code.google.com/p/lambdaj
Apache License 2.0
0 stars 0 forks source link

ArgumentConversionException when using extract() on an empty Iterable #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. extract(new ArrayList(), on(SomeClass.class).someMethod());

What is the expected output? What do you see instead?
I'd expect to receive an empty collection instead of an 
ArgumentConversionException

What version of the product are you using? On what operating system?
2.3.3

Stacktrace:
Caused by: ch.lambdaj.function.argument.ArgumentConversionException: Unable to 
convert the placeholder 0 in a valid argument
    at ch.lambdaj.function.argument.ArgumentsFactory.actualArgument(ArgumentsFactory.java:76)
    at ch.lambdaj.function.convert.ArgumentConverter.<init>(ArgumentConverter.java:29)
    at ch.lambdaj.Lambda.extract(Lambda.java:1035)
...

Original issue reported on code.google.com by sr.sa...@gmail.com on 23 Nov 2011 at 6:35

GoogleCodeExporter commented 8 years ago
Having looked at the source code a little bit, I think it may be relevant that, 
in the line

    extract(new ArrayList(), on(SomeClass.class).someMethod())

someMethod() returns an int in my case.

Original comment by sr.sa...@gmail.com on 23 Nov 2011 at 7:04

GoogleCodeExporter commented 8 years ago
Another look (and a bit of debugging) at the source code revealed that it's 
important to stress that SomeClass is an enum in my case.

Original comment by sr.sa...@gmail.com on 23 Nov 2011 at 7:43

GoogleCodeExporter commented 8 years ago
Well, I'll try to send a patch soon. I have an idea that might fix this problem 
without breaking everything else.

Original comment by sr.sa...@gmail.com on 23 Nov 2011 at 8:29

GoogleCodeExporter commented 8 years ago
Since SomeClass is an enum it is a final class and then is not proxable. It is 
well stated that lambdaj cannot deal with this type of classes. Unfortunately a 
fix for that is not doable.

Original comment by mario.fu...@gmail.com on 29 Jan 2012 at 11:05