On Mar 11, 2009, at 7:10 AM, Tobias Ivarsson wrote:

> John: On the InterfaceInjection wiki page you wrote some things that  
> implies that java.lang.Object can not be an injection target. What  
> was the motivation behind this?

Hmm... If you don't inject all the way up to object, your untyped  
method invocation looks like:
   if (x instanceof MyII)  ((MyII)x).myIIMethod(); else  
MyRuntime.defaultIIMethod(x);

But Groovy or some other language might simply want to inject its  
metaclass on every class it encounters.  So I retract the restriction.

BTW, the injection is done once for each concrete class encountered,  
*and* each superclass thereof.  (Not sure that it buys anything to  
look at interface supertypes.)

If, say, Object has already been injected, and File is being  
considered, the injector has the option to pull down all the methods  
injected into Object, or to replace any or all of them.  So the  
mechanism provides implementation inheritance.  As with normal non- 
injected interfaces , you are neither prevented from inheriting nor  
required to inherit.

-- John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
To unsubscribe from this group, send email to 
jvm-languages+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to