From 519880eefc4d3bc1467c8c20fb5c284271c10f4f Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 11 May 2006 07:24:45 +0000 Subject: [PATCH] 134471 - incremental structure model repair code overhaul - repair the filemap and typemap in addition to the handle map (long standing bug!) --- .../asm/internal/AspectJElementHierarchy.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java index 7839b3abd..b32391c42 100644 --- a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java +++ b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java @@ -406,6 +406,7 @@ public class AspectJElementHierarchy implements IHierarchy { fileMap.clear(); } + // TODO rename this method ... it does more than just the handle map public void updateHandleMap(Set deletedFiles) { // Only delete the entries we need to from the handle map - for performance reasons List forRemoval = new ArrayList(); @@ -418,6 +419,29 @@ public class AspectJElementHierarchy implements IHierarchy { String handle = (String) iter.next(); handleMap.remove(handle); } + forRemoval.clear(); + k = typeMap.keySet(); + for (Iterator iter = k.iterator(); iter.hasNext();) { + String element = (String) iter.next(); + IProgramElement ipe = (IProgramElement)typeMap.get(element); + if (deletedFiles.contains(getFilename(ipe.getHandleIdentifier()))) forRemoval.add(element); + } + for (Iterator iter = forRemoval.iterator(); iter.hasNext();) { + String handle = (String) iter.next(); + typeMap.remove(handle); + } + forRemoval.clear(); + k = fileMap.keySet(); + for (Iterator iter = k.iterator(); iter.hasNext();) { + String element = (String) iter.next(); + IProgramElement ipe = (IProgramElement)fileMap.get(element); + if (deletedFiles.contains(getFilename(ipe.getHandleIdentifier()))) forRemoval.add(element); + } + for (Iterator iter = forRemoval.iterator(); iter.hasNext();) { + String handle = (String) iter.next(); + fileMap.remove(handle); + } + } // XXX shouldn't be aware of the delimiter -- 2.39.5