flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aljoscha Krettek <aljos...@apache.org>
Subject Re: Java 8 and type erasure
Date Tue, 18 Aug 2015 09:46:53 GMT
Unfortunately, this also doesn't work for the same reasons. The generic
types of generic parameters of a lambda are not stored anywhere. Stephan
mentioned to me that the only possibility right now would be to look at the
code using something like ASM to find a cast in the code to the concrete
type of the generic parameter.

On Tue, 18 Aug 2015 at 11:35 Kristoffer Sjögren <stoffe@gmail.com> wrote:

> How about https://github.com/jhalterman/typetools?
>
> On Tue, Aug 18, 2015 at 11:16 AM, Aljoscha Krettek <aljoscha@apache.org>
> wrote:
> > Hi Kristoffer,
> > I'm afraid not, but maybe Timo has some further information. In this
> > extended example we can see the problem:
> > https://gist.github.com/aljoscha/84cc363d13cf1dfe9364. The output is:
> >
> > Type is: class org.apache.flink.examples.java8.wordcount.TypeTest$Thing
> > class org.apache.flink.examples.java8.wordcount.TypeTest$Thing
> > Type is: class org.apache.flink.examples.java8.wordcount.TypeTest$Thing
> > class org.apache.flink.examples.java8.wordcount.TypeTest$Thing
> > Type is :
> > org.apache.flink.examples.java8.wordcount.TypeTest.org
> .apache.flink.examples.java8.wordcount.TypeTest$Thing<java.lang.String>
> > class org.apache.flink.examples.java8.wordcount.TypeTest$Thing
> >
> > So with the two lambda calls it does not correctly determine the generic
> > parameter of Thing while it works with the anonymous class.
> >
> > I was exited when I saw the example because we've been trying for so
> long to
> > get this to work. Maybe we have to wait for java 19 to get this to work.
> ;-)
> >
> > Thanks a lot for helping, though. :D
> > Aljoscha
> >
> > On Tue, 18 Aug 2015 at 11:01 Kristoffer Sjögren <stoffe@gmail.com>
> wrote:
> >>
> >> Hi
> >>
> >> Potential fix for writing flink jobs using lamdas without Eclipse JDT?
> >>
> >> https://gist.github.com/aslakhellesoy/3678beba60c109eacbe5
> >>
> >> Cheers,
> >> -Kristoffer
>

Mime
View raw message