Dynamic (i.e responding to methodNotFound) classes in Java
John Rose
john.r.rose at oracle.com
Fri Jun 14 02:05:48 UTC 2013
On Jun 13, 2013, at 6:26 PM, Behrang Saeedzadeh <behrangsa at gmail.com> wrote:
> Hi,
>
> A couple of years ago I downloaded an experimental build of JDK with
> invokedynamic support and it contained a class (DynamicObject?) that any
> method could be invoked on its subclasses without any compile time errors.
>
> Does this class still exist? I can't find it anymore in the API docs.
No. There were partial prototypes in this direction as part of JSR 292, but they were abandoned in 2009. Here is a proposal from that time frame:
https://wiki.openjdk.java.net/display/mlvm/DynamicJava
Nothing like this exists or was built in any usable way.
Untyped or "duck typed" invocation of objects can be done easily enough with third-party libraries, or with reflection, or using a dynamic language like JavaScript or JRuby or ${your_favorite_jvm_language}.
In my opinion, Java the language is unlikely to support such a thing in the near future, since there are many reasonable alternatives.
— John
More information about the discuss
mailing list