[hibernate-dev] Covariant returns

Demetz, Guenther Guenther.Demetz at wuerth-phoenix.com
Thu Mar 15 03:37:47 EDT 2012


>>Was the initial problem you just using SessionImpl directly?  

Yes, that was the problem, 
so probably there are no JDK's handling it differently.

regards
Günther 

-----Original Message-----
From: hibernate-dev-bounces at lists.jboss.org [mailto:hibernate-dev-bounces at lists.jboss.org] On Behalf Of Steve Ebersole
Sent: Wednesday, March 14, 2012 4:46 PM
To: Guillaume Smet
Cc: hibernate-dev at lists.jboss.org
Subject: Re: [hibernate-dev] Covariant returns

Hi Guillaume,

Was the initial problem you just using SessionImpl directly?  Or is it a problem of particular JDK handling the covariant return differently?  In the latter case we'd need to change the code.  In the former, its a discussion.

As for why byId is that way, TBH being new to being able to design APIs with Java 5+ features I tend to try things to see how they work.

On 03/13/2012 06:55 PM, Guillaume Smet wrote:
> Hi Steve,
>
> On Tue, Mar 13, 2012 at 10:39 PM, Steve Ebersole<steve at hibernate.org>  wrote:
>> As I understood it, when accessed through the Session interface what 
>> return type is defined by SessionImpl is irrelevant.  And indeed I am 
>> not able to reproduce this when access those methods via Session.  My 
>> IDE gives me errors if I try to cast that reference to SessionImpl 
>> instead.
>
> I tested it quickly in the test case I was working on and I confirm it 
> works (with the Eclipse compiler and directly with Maven and the 
> Oracle JDK 1.6.30 compiler).
>
> That said, I don't understand why you return the Impl instead of the
> interface: it's not consistent with byNaturalId() and
> bySimpleNaturalId() which are just below. Is there any reason why you 
> treated them differently?
>

--
steve at hibernate.org
http://hibernate.org
_______________________________________________
hibernate-dev mailing list
hibernate-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev




More information about the hibernate-dev mailing list