News for hackers. Stuff that matters.
Re:JITs are un-ergonomic by The_Colonel on Sunday March 29, 2020 @08:56AM (#22718605)
You probably know this, but it's not obvious to the random reader.

Even generic types are available in the Java .class file and are accessible from the reflection API. Spring for example uses this quite heavily.

Re:JITs are un-ergonomic by cogman10 on Sunday March 29, 2020 @09:15AM (#22718720)
It depends on where you are at.

Type information is present in fields and class inheritance

For example, a class like this

`class Foo implements Bar<String>`

Retains the fact that the generic type is a String.

That information is completely lost at method invocation. So a method that takes a `Bar<String>` ultimately compiles to a method that takes a `Bar` and knows nothing of the String.

To get that generic information down you have to engage in some fun tricks using either the class or field method I mentioned earlier. (Usually you do this with a second type parameter where it matters).