DATACMNS-1121 - ProxyProjectionFactory now returns instance as is if it implements the target.
If you previously asked ProxyProjectionFactory for a proxy of an interface which the target instance already implements, it created a proxy although it could've returned the instance as is. It's now actually doing that avoiding superfluous proxy creation.
This commit is contained in:
@@ -206,7 +206,17 @@ public class ProxyProjectionFactoryUnitTests {
|
||||
assertThat(data.get("key")).isNull();
|
||||
}
|
||||
|
||||
static class Customer {
|
||||
@Test // DATACMNS-1121
|
||||
public void doesNotCreateWrappingProxyIfTargetImplementsProjectionInterface() {
|
||||
|
||||
Customer customer = new Customer();
|
||||
|
||||
assertThat(factory.createProjection(Contact.class, customer)).isSameAs(customer);
|
||||
}
|
||||
|
||||
interface Contact {}
|
||||
|
||||
static class Customer implements Contact {
|
||||
|
||||
public Long id;
|
||||
public String firstname, lastname;
|
||||
|
||||
Reference in New Issue
Block a user