[resteasy-dev] Lambda question

Ron Sigal rsigal at redhat.com
Wed Apr 5 13:15:32 EDT 2017


Hi Steven,

That's really interesting. It works for both Oracle JDK 1.8.0_91 and JDK 
9 build 163 from java.net. !!

One problem I see is that Jonathan Halterman's TypeResolver class has 
the line

> String constantPoolName = JAVA_VERSION < 9 ? 
> "sun.reflect.ConstantPool" : "jdk.internal.reflect.ConstantPool";

so I don't think we could use it for any JDK < 9. Once JDK 9 stabilizes 
and Resteasy is releasing JDK 9 code, maybe it would be OK.

Even better would be if Class.getGenericInterfaces() were to work in JDK 
9, but, as of build 163, it doesn't.

In any case, you've helped to verify that the solution requires external 
tricks. Let's hope that your "right approach" is followed.

Thank you very much,

Ron

On 04/03/2017 01:49 PM, Steven Schlansker wrote:
>> On Apr 3, 2017, at 10:11 AM, Ron Sigal <rsigal at redhat.com> wrote:
>> ...
>>
>> So, it seems that, for lambdas, Java doesn't keep the implementation type and value of the type variable at run time. Does anyone have any ideas or tricks?
> I did not have time to play with it myself, but I did run across this:
> https://stackoverflow.com/questions/23863716/java-how-to-resolve-generic-type-of-lambda-parameter
> maybe that helps?
>
> It sounds like the "right approach" would be to request Java stash the type information better for lambdas...
>

-- 
My company's smarter than your company (unless you work for Red Hat)



More information about the resteasy-dev mailing list