Bugs: Browse | Submit New | Admin

[#18325] Can't cleanly remove advice from Ruby classes that extend Java classes, when using :types_and_descendents=>Java_type

Date:
2008-02-24 02:21
Priority:
4
Submitted By:
Dean Wampler (deanwampler)
Assigned To:
Dean Wampler (deanwampler)
Category:
JRuby Integration
State:
Open
Summary:
Can't cleanly remove advice from Ruby classes that extend Java classes, when using :types_and_descendents=>Java_type

Detailed description
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.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item