-
1. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 9, 2007 11:43 AM (in response to dunks80)Hi,
Can you please add a JIRA issue with a testcase demonstrating the behaviour?
Thanks! -
2. Re: Inteception on field inherited through generic superclas
dunks80 Jan 9, 2007 12:15 PM (in response to dunks80)Posted case to jira with simple test case
http://jira.jboss.com/jira/browse/JBAOP-339 -
3. Re: Inteception on field inherited through generic superclas
vincent.marquez Jan 9, 2007 7:51 PM (in response to dunks80)Actually, i'm not sure this is a problem with generics. I'm having trouble with fields being aspected/intercepted from a parentclass without using generics.
Seems like the pointcut isn't being applied to fields inherited through the superclass... -
4. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 9, 2007 8:07 PM (in response to dunks80)Inherited fields *should* work. Can you try and see if making the base class non-abstract makes a difference? We have a test in trunk, but that does not seem to have been ported to the 1.5 branch. However, if I remember correctly this was only a problem with the new weaving style in trunk.
I aim to release 1.5.3.GA before this weekend, so if there is a problem I would like to get this fix in before then. Please let me know -
5. Re: Inteception on field inherited through generic superclas
vincent.marquez Jan 9, 2007 8:23 PM (in response to dunks80)I'm not not using an abstract class, and I'm having the same problem. The problem remains when I use an example without generics also.
-
6. Re: Inteception on field inherited through generic superclas
tombatlecruiser Jan 10, 2007 10:47 AM (in response to dunks80)Hi,
Any chance to have this one solved in release 1.5.3.GA?(http://jira.jboss.org/jira/browse/JBAOP-301)
Thanks. -
7. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 10, 2007 12:43 PM (in response to dunks80)I've renamed JBAOP-339 and ported the fix for JBAOP-301 to Branch_AOP_1_5. It will be in the coming release
-
8. Re: Inteception on field inherited through generic superclas
tombatlecruiser Jan 11, 2007 4:13 AM (in response to dunks80)One more question: will this work also for parent class private fields?
class POJO
{
private int field;
setXXX and getXXX for field
}
class Sub extends POJO
{
private int subField;
setXXX and getXXX for subField
}
Sub sub = new Sub();
sub.setField(5); // will be this one intercepted ?
Thanks. -
9. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 11, 2007 9:14 AM (in response to dunks80)Yes, and I have now added some tests for this
-
10. Re: Inteception on field inherited through generic superclas
markodevelop2 Jan 12, 2007 12:18 PM (in response to dunks80)I have the same problem. From what I saw I AOP source code the ClassAdvisor.resolveFieldPointcut() method is trying to make an incorrect comparation.
If I declarepublic class A{ private int field1; public void setField1(int value){ this.field1=value; ... }; } public class B extends A{ ... }
for a pointcut class B-->field1 (declared in class A), it compares classB->field1 (pointcut declaration) with classA->field1 (retrived by javassist ). Maybe the comparation should be extended to the entire hierarchy. -
11. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 12, 2007 12:44 PM (in response to dunks80)A slightly different variety of the problem, which will be fixed in the 1.5.3.GA release due very soon.
For your use-case you should be able to usefield(* $instanceof{A}->field)
Or are you saying that you also havepublic class C extends A{}
and you would only like to apply the interceptor to B? This is currently not possible -
12. Re: Inteception on field inherited through generic superclas
markodevelop2 Jan 15, 2007 4:27 AM (in response to dunks80)Thank for your quick reply :)
I my case I'm using dynamic AOP and I don't know from the beginning the base class name. The only thing I know is the name of the derived class "C" and the name of a field (which might be defined in class "A"). (Of course you can say that I can find the name of the class extended by class "C" using reflection)
I can NOT use the pointdef with "instanceof" since I am NOT interested to watch fields modifications in ALL classes derived from "A", only modifications made in a particular class "C".
Can you please tell me if modifying the way ClassAdvisor is doing the comparation will solve my problem? Or should I be more patience and wait for the next release? -
13. Re: Inteception on field inherited through generic superclas
ttarhan Jan 16, 2007 5:52 PM (in response to dunks80)Kabir,
Did you get an updated version released with this fix? I don't see it anywhere.
Thanks,
Tolga -
14. Re: Inteception on field inherited through generic superclas
kabirkhan Jan 17, 2007 6:17 AM (in response to dunks80)"ttarhan" wrote:
Kabir,
Did you get an updated version released with this fix? I don't see it anywhere.
I will be releasing 1.5.3.GA later today once svn is up again following our upgrade
Thank for your quick reply :)
I my case I'm using dynamic AOP and I don't know from the beginning the base class name. The only thing I know is the name of the derived class "C" and the name of a field (which might be defined in class "A"). (Of course you can say that I can find the name of the class extended by class "C" using reflection)
I can NOT use the pointdef with "instanceof" since I am NOT interested to watch fields modifications in ALL classes derived from "A", only modifications made in a particular class "C".
Can you please tell me if modifying the way ClassAdvisor is doing the comparation will solve my problem? Or should I be more patience and wait for the next release?
This will not be possible in 1.5.x, but it can be made possible in 2.0. However, you will still need to at least "prepare" the field in the superclass. When loading the superclass we (Java) does not know of all possible sub-classes.