Parameterized Types

Mitia Alexandrov mitiaalexandrov at gmail.com
Wed Oct 28 00:59:14 UTC 2015


yep... and may be some how introduce annotations support...

2015-10-27 16:48 GMT-07:00 James Falkner <james.falkner at liferay.com>:

> Hey all,
>
> Currently @ JavaOne enjoying the Nashorn talks. But I have a question. Is
> it possible to create extended classes using parameterized types?
>
> What I want to do is create these:
>
> class SomeClass extends SomeBaseClass<SomeType> {
> ...
> }
>
> I know parameterized types are mostly a compile-time thing, but they are
> encoded into the class bytes and can be accessed in Java using:
>
> ParameterizedType t =  (ParameterizedType) clazz.getGenericSuperclass();
> Type[] types = parameterizedType.getActualTypeArguments();
>
> So I was wondering if it was possible to instantiate a concrete Java class
> from Javascript such that it would appear just as though I had created it
> as above?
>
> Using Java.type() and Java.extend() doesn't seem to create the class in
> the same way as the Java code with Parameterized types. Thanks!
>
> -James
>
>


More information about the nashorn-dev mailing list