私の目標はequals
、型のサブクラスのすべてのメソッドを「回避」することです。そこで、次の側面を書きました。
私は、aspectj-maven-plugin を使用しています。すべての equals メソッドがそこにあるため、コードを依存関係の jar ファイルに織り込むように指示しています。
私は以下の報酬を受けています:
Warning:(22, 0) ajc: does not match because declaring type is java.lang.Object, if match desired use 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]
私は困惑しています。BaseAttribute
declareの階層にはたくさんの型があるequals
ので、 を見てはいけませんObject
。追加&&target(BaseAttribute+)
しても、このエラーは解消されないようです。
私は何を見逃していますか、そして/またはこれを追跡するにはどうすればよいですか?
package com.basistech.rosette.dm;
/**
* See if we can't make an aspect to spy on equals ...
*/
public aspect AdmEquals {
// we would like to narrow this to 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);
}
return true;
}
}