This paper describes implementation strategies for structural conformance, wrapping, delegation, and mixins that do not rely on compile-time type information, do not impose the overhead of reflection on method calls, and do not require modifications to the Java runtime. Instead, the implementation strategies described in this paper rely on dynamic code generation facilities of Java to generate efficient "glue code" that can then be cached for later execution.
Came across a reference to this paper on a discussion on JavaLobby about Reflection API Performance.
Ok, so it's sort of a hack. But I suppose if you want to get truly dynamic behavior out of Java, it's the only path. Amounts to generating classes on the fly that do the delegation to the appropriate objects. If Sun ever really wants to help these kinds of efforts, the number one thing they could do is add a doesNotUnderstand: method to the method invocation that could be overidden by the classes.
Posted to OOP by Chris Rathman on 10/24/01; 12:39:45 PM
|
|