On 2010-06-04 16.00, Philippe Van Dyck wrote:
Hi Rickard,

I still use the @This annotation and recently switched to the latest
version with ASM.
My application lost at least 1/3 of it's memory usage and looks more
responsive.
All the concerns I use are "out-mixin" calls.
Could you please explain what you mean exactly by "subclass *every*
mixin, not just the abstract ones" ?

Well, let's say you have a plain mixin that implements an interface, no abstract or anything like that. If one method calls another method, and I don't subclass the mixin, then no concerns will be triggered, and no constraints. Like so:
interface FooBar
{
  public String hello();
  public String world(String name); // No @Optional!
}

public class FooBarMixin
  implements Foobar
{
  @This FooBar fooBar; // Inject proxy

  public String hello()
  {
    return world(null); // This will work but shouldn't
return fooBar.world(null); // This will throw exception due to null constraint being checked
  }

  public String world(String name)
  {
    return name+" World";
  }
}
---
If I don't subclass FooBarMixin in Qi4j, then the direct in-mixin call will not trigger concerns+sideeffects+constraints, whereas the call to the @This-injected one will. If I instead always subclass mixins and override methods, such as "world", then the "return world(null);" call will cause an IllegalArgumentException since the overriden world() method will route the call through the composite before hitting the mixin.

As it looks right now I have to always subclass mixins and introduce method overrides. This was done before with CGLIB.

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to