[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] hashCode() for mixin?
|
Hi! :o)
OK, it turns out (I think), that thisJoinPoint doesn't work for inter-type
declarations (at least, I got a compile error), but you made me see that I
needed to use the interface as a target - all I had to do was change from
this(mi) to target(mi) in the advice I had:
public aspect FieldDisplayableHash {
pointcut miHash(MixinInterface mi):
call(public int Object.hashCode()) && target(mi);
int around(MixinInterface mi): miHash(mi) {
int hash = proceed(mi);
return hash ^ mi.state.hashCode();
}
}
Thanks! (now I must return to working on Mule...)
Andrew
PS I didn't actually have a hashCode method in the interface -p
Holger Hoffstätte said:
> (hi Andrew, good to see you here too :)
>
> andrew cooke wrote:
>> Now I want to alter the hashCode method on the affected classes so that
>> the value reflects not just the state of the original class, but
>> includes
>> the mixin state too.
>
> I cannot test right now but maybe thisJoinPoint().getTarget().hashCode()
> will give you what you want? I had a similar problem a long time ago and
> *think* that was what got me further.
>
> hth,
> Holger
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>