From fcfdaf918a394323a94fece363f50e521a7fc049 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 18 May 2010 21:59:03 +0000 Subject: [PATCH] 312839: WeaverStateInfo compression and move to signatures in 'aspectsAffectingType' rather than names --- .../aspectj/weaver/bcel/BcelClassWeaver.java | 6 +- .../org/aspectj/weaver/bcel/BcelWeaver.java | 64 +++++++++---------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index 547f0ad7d..74e6d1c25 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -434,7 +434,7 @@ class BcelClassWeaver implements IClassWeaver { if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { - aspectsAffectingType.add(munger.getAspectType().getName()); + aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } @@ -510,7 +510,7 @@ class BcelClassWeaver implements IClassWeaver { if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { - aspectsAffectingType.add(munger.getAspectType().getName()); + aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } @@ -1512,7 +1512,7 @@ class BcelClassWeaver implements IClassWeaver { if (munger instanceof BcelAdvice) { BcelAdvice bcelAdvice = (BcelAdvice) munger; if (bcelAdvice.getConcreteAspect() != null) { - aspectsAffectingType.add(bcelAdvice.getConcreteAspect().getName()); + aspectsAffectingType.add(bcelAdvice.getConcreteAspect().getSignature()); } } else { // It is a 'Checker' - we don't need to remember aspects diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index b44481621..a0edd7e22 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -1319,42 +1319,40 @@ public class BcelWeaver { // are around! world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.PROCESSING_REWEAVABLE, className, classType .getSourceLocation().getSourceFile()), null, null); - Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); - if (aspectsPreviouslyInWorld != null) { - // keep track of them just to ensure unique missing aspect error - // reporting - Set alreadyConfirmedReweavableState = new HashSet(); - for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) { - String requiredTypeName = (String) iter.next(); - if (!alreadyConfirmedReweavableState.contains(requiredTypeName)) { - ResolvedType rtx = world.resolve(UnresolvedType.forName(requiredTypeName), true); - boolean exists = !rtx.isMissing(); - if (!exists) { - world.getLint().missingAspectForReweaving.signal(new String[] { requiredTypeName, className }, - classType.getSourceLocation(), null); - // world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE, - // requiredTypeName, className), classType.getSourceLocation(), null); + Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); + // keep track of them just to ensure unique missing aspect error + // reporting + Set alreadyConfirmedReweavableState = new HashSet(); + for (String requiredTypeSignature : aspectsPreviouslyInWorld) { + // for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) { + // String requiredTypeName = (String) iter.next(); + if (!alreadyConfirmedReweavableState.contains(requiredTypeSignature)) { + ResolvedType rtx = world.resolve(UnresolvedType.forSignature(requiredTypeSignature), true); + boolean exists = !rtx.isMissing(); + if (!exists) { + world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className }, classType + .getSourceLocation(), null); + // world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE, + // requiredTypeName, className), classType.getSourceLocation(), null); + } else { + if (world.isOverWeaving()) { + // System.out.println(">> Removing " + requiredTypeName + " from weaving process: " + // + xcutSet.deleteAspect(rtx)); } else { - if (world.isOverWeaving()) { - // System.out.println(">> Removing " + requiredTypeName + " from weaving process: " - // + xcutSet.deleteAspect(rtx)); - } else { - // weaved in aspect that are not declared in aop.xml - // trigger an error for now - // may cause headhache for LTW and packaged lib - // without aop.xml in - // see #104218 - if (!xcutSet.containsAspect(rtx)) { - world.showMessage(IMessage.ERROR, WeaverMessages.format( - WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED, requiredTypeName, className), null, - null); - } else if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { - world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE, - requiredTypeName, rtx.getSourceLocation().getSourceFile()), null, null); - } + // weaved in aspect that are not declared in aop.xml + // trigger an error for now + // may cause headhache for LTW and packaged lib + // without aop.xml in + // see #104218 + if (!xcutSet.containsAspect(rtx)) { + world.showMessage(IMessage.ERROR, WeaverMessages.format( + WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED, rtx.getName(), className), null, null); + } else if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { + world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE, rtx + .getName(), rtx.getSourceLocation().getSourceFile()), null, null); } - alreadyConfirmedReweavableState.add(requiredTypeName); } + alreadyConfirmedReweavableState.add(requiredTypeSignature); } } } -- 2.39.5