Consider a Java class Base and a Ruby class Derived that subclasses Base:
package com.foo;
public class Base {
public void doit() {}
}
class Derived < Java::ComFoo::Base
end
Then apply an aspect like
my_aspect = aspect :before, :types_and_descendents => Base, :calls_to => :doit do; ...; end
Then call my_aspect.unadvise later, Aquarium does not properly clean up the advice infrastructure from Derived which
it creates for the "doit" method (even though doit isn't defined in Derived).
It appears to work fine if you advise a Java hierarchy only or you advise the Ruby class and only the methods it explicitly
defines, including overrides of Java-class methods. The following changes to "my_aspect" work fine.
my_aspect = aspect :before, :types => Base, :calls_to => :doit do; ...; end
my_aspect = aspect :before, :types_and_descendents => Base, :calls_to => :doit, :restrict_methods_to =>
exclude_ancestor_methods do; ...; end
The 2nd variation works because "doit" is only defined in Base, so only that version will be advised. |