United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6804588 : non-Java languages need interface injection to retrofit pre-existing classes

Details
Type:
Enhancement
Submit Date:
2009-02-12
Status:
Open
Updated Date:
2014-01-16
Project Name:
JDK
Resolved Date:
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Unresolved
Affected Versions:
7
Targeted Versions:
9

Related Reports

Sub Tasks

Description
http://blogs.sun.com/jrose/entry/interface_injection_in_the_vm

When Java needs to add a new interface to existing objects, the injection of the new interface can be managed as part of the roll-out of the JDK which contains the new libraries and/or language features.  For example, when the collections API came out, the same JDK release introduced Comparable in various predefined types.

This approach not practical for languages not directly supported by the JDK (i.e., languages other than Java).  We propose a type-safe, secure, modular way for language runtimes to inject new utility interfaces (like Comparable) into pre-existing classes.

This feature also supports "traits", a common feature whereby implementation types can be retroactively assigned new structural interface types, and even be equipped with (generic) methods.

Finally, this feature supports efficient integration of classes into metaobject protocols, even when the classes were written (and their engineering frozen) long before any given metaobject protocol.

                                    

Comments



Hardware and Software, Engineered to Work Together