if (changed && worthReporting) {
ResolvedType declaringAspect = null;
AsmManager model = ((BcelWorld) getWorld()).getModelAsAsmManager();
if (model != null) {
if (munger instanceof NewParentTypeMunger) {
NewParentTypeMunger nptMunger = (NewParentTypeMunger) munger;
declaringAspect = nptMunger.getDeclaringType();
if (declaringAspect.isParameterizedOrGenericType()) {
declaringAspect = declaringAspect.getRawType();
}
ResolvedType thisAspect = getAspectType();
AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, thisAspect);
// Add a relationship on the actual declaring aspect too
if (!thisAspect.equals(declaringAspect)) {
// Might be the case the declaring aspect is generic and thisAspect is parameterizing it. In that case
// record the actual parameterizations
ResolvedType target = weaver.getLazyClassGen().getType();
ResolvedType newParent = nptMunger.getNewParent();
IProgramElement thisAspectNode = model.getHierarchy().findElementForType(thisAspect.getPackageName(),
thisAspect.getClassName());
Map<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap();
if (declareParentsMap == null) {
declareParentsMap = new HashMap<String, List<String>>();
thisAspectNode.setDeclareParentsMap(declareParentsMap);
}
String tname = target.getName();
String pname = newParent.getName();
List<String> newparents = declareParentsMap.get(tname);
if (newparents == null) {
newparents = new ArrayList<String>();
declareParentsMap.put(tname, newparents);
}
newparents.add(pname);
AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
}
} else {
declaringAspect = getAspectType();
AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
}
}
}
// TAG: WeavingMessage
if (changed && worthReporting && munger != null && !weaver.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
String tName = weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getName();
if (tName.indexOf("no debug info available") != -1) {
tName = "no debug info available";
} else {
tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath());
}
String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
// This message could come out of AjLookupEnvironment.addParent
// if doing parents munging at compile time only...
NewParentTypeMunger parentTM = (NewParentTypeMunger) munger;
if (parentTM.isMixin()) {
weaver.getWorld()
.getMessageHandler()
.handleMessage(
WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_MIXIN, new String[] {
parentTM.getNewParent().getName(), fName, weaver.getLazyClassGen().getType().getName(),
tName }, weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
} else {
if (parentTM.getNewParent().isInterface()) {
weaver.getWorld()
.getMessageHandler()
.handleMessage(
WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
new String[] { weaver.getLazyClassGen().getType().getName(), tName,
parentTM.getNewParent().getName(), fName }, weaver.getLazyClassGen()
.getClassName(), getAspectType().getName()));
} else {
weaver.getWorld()
.getMessageHandler()
.handleMessage(
WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS,
new String[] { weaver.getLazyClassGen().getType().getName(), tName,
parentTM.getNewParent().getName(), fName }));
// TAG: WeavingMessage DECLARE PARENTS: EXTENDS
// reportDeclareParentsMessage(WeaveMessage.
// WEAVEMESSAGE_DECLAREPARENTSEXTENDS,sourceType,parent);
}