Agilefreaks / Aquarium

An AOP library for Ruby
https://rubygems.org/gems/aquarium/
149 stars 24 forks source link

[RubyForge-18326] Advise on a Java method, using the Java name (e.g., `doIt`), on a Ruby subclass, #4

Open hedgehog opened 14 years ago

hedgehog commented 14 years ago

Date:2008-02-23 21:36 Priority:4 Submitted By:Dean Wampler (deanwampler) Assigned To:Dean Wampler (deanwampler) Category:JRuby Integration State:Open Summary:Advise on a Java method, using the Java name (e.g., doIt), on a Ruby subclass, is not invoked

Detailed description

For example:

package com.foo;
public class  Foo {
  public void doIt() {}
}

class RubyFoo < Java::ComFoo::Foo
end

Now

aspect1 = aspect :before, :calls_to => :doIt, :on_type => RubyFoo do
...
end

Even though aspect1.matched_join_points will contain the expected JoinPoint, the advise will never be called. However, if you use

aspect2 = aspect :before, :calls_to => :do_it, :on_type => RubyFoo do
...
end

The advice will be invoked if Foo#doIt is invoked.