zhiqinghuang / lambdaj

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

Use Objenesis in Instance creation #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
consider

filter(having(on(X.class).getId(), equalTo(uuid)), ... );

where uuid is of type java.util.UUID which is the type returned by X.getId()

now what version 2.4 throws is:

ch.lambdaj.function.argument.ArgumentConversionException: It is not possible to 
create a placeholder for class: java.util.UUID

due to appropriate constructors missing.

A patch is appended that uses objenesis in ArgumentsFactory, that helps us 
solve the problem.
Please consider for verification/inclusion.

Original issue reported on code.google.com by google-a...@codesmell.de on 7 Mar 2012 at 1:25

Attachments:

GoogleCodeExporter commented 8 years ago
um... forgot to say: now ch.lambdaj.function.argument.ArgumentsFactoryTest 
fails obviously, because of this capability. It has of course to be adjusted 
accordingly.

Original comment by google-a...@codesmell.de on 7 Mar 2012 at 1:38

GoogleCodeExporter commented 8 years ago
any progress/feedback on this?

Original comment by google-a...@codesmell.de on 4 May 2012 at 7:32

GoogleCodeExporter commented 8 years ago
From lambdaj 2.4 it is already possible to overcome this problem by providing a 
custom strategy for placeholder creation as described here: 
http://code.google.com/p/lambdaj/wiki/Lambdaj24ReleaseNotes

In general I want to limit the use of objenesis when possible because it is not 
compatible with many environments like Android and Google App Engine.

I also just added allowed the ArgumentFactory to automatically create 
placeholder even for final classes with a 2-args constructor like java.util.UUID

Original comment by mario.fu...@gmail.com on 8 Jul 2012 at 10:52