https://bugs.eclipse.org/bugs/show_bug.cgi?id=73931
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
index 7a06e74..e9cb67c 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
@@ -8,7 +8,7 @@
  * Contributors:
  *   IBM - Initial API and implementation
  *
- * $Id: ProfileOperations.java,v 1.8.2.7 2004/09/15 16:46:31 khussey Exp $
+ * $Id: ProfileOperations.java,v 1.8.2.8 2004/09/15 17:02:49 khussey Exp $
  */
 package org.eclipse.uml2.internal.operation;
 
@@ -617,11 +617,12 @@
 			TreeIterator eAllContents = new AbstractTreeIterator(package_, true) {
 
 				public Iterator getChildren(Object parent) {
-					return new ArrayList(((EObject) parent).eContents())
-						.iterator();
+					return ((EObject) parent).eContents().iterator();
 				}
 			};
 
+			List eAnnotationsToRemove = new ArrayList();
+
 			while (eAllContents.hasNext()) {
 				EObject eObject = (EObject) eAllContents.next();
 
@@ -662,11 +663,16 @@
 					}
 
 					if (appliedStereotypes.isEmpty()) {
-						element.getEAnnotations().remove(
-							appliedStereotypesEAnnotation);
+						eAnnotationsToRemove.add(appliedStereotypesEAnnotation);
 					}
 				}
 			}
+
+			for (Iterator eAnnotations = eAnnotationsToRemove.iterator(); eAnnotations
+				.hasNext();) {
+
+				((EAnnotation) eAnnotations.next()).setEModelElement(null);
+			}
 		}
 
 		getOrCreateEAnnotation(ANNOTATION_SOURCE__ATTRIBUTES,