Sunday, 15 February 2015

java - AspectJ unmatched type warning: how to interpret? -



java - AspectJ unmatched type warning: how to interpret? -

my goal 'around' equals methods of subclasses of type. so, wrote next aspect.

i'm using aspectj-maven-plugin, , i'm telling weave code in dependency jar file, since that's equals methods are.

i rewarded with:

warning:(22, 0) ajc: not match because declaring type java.lang.object, if match desired utilize target(com.basistech.rosette.dm.baseattribute+) [xlint:unmatchedsupertypeincall] warning:(22, 0) ajc: advice defined in com.basistech.rosette.dm.admequals has not been applied [xlint:advicedidnotmatch]

i puzzled. plenty of types in hierarchy of baseattribute declare equals, should not looking @ object. adding &&target(baseattribute+) not seem create error go away.

what missing, and/or how should go tracking down?

package com.basistech.rosette.dm; /** * see if can't create aspect spy on equals ... */ public aspect admequals { // narrow subclasses ... boolean around(object other): call(public boolean baseattribute+.equals(java.lang.object)) && args(other) { boolean result = proceed(other); if (!result) { system.out.println(this); system.out.println(other); system.out.println(result); } homecoming true; } }

ok, lite dawned. aspectj phone call specs describe method defined @ base of operations of class hierarchy, apparently, not overridden. next purports necessary dirty work.

public aspect admequals { // narrow subclasses ... boolean around(object other) : call(public boolean object.equals(java.lang.object)) && args(other) && target(baseattribute+) { boolean result = proceed(other); if (!result) { system.out.println(this); system.out.println(other); system.out.println(result); } homecoming true; } }

java aspectj aspectj-maven-plugin

No comments:

Post a Comment