diff options
author | kmoore | 2011-08-08 12:00:19 +0000 |
---|---|---|
committer | kmoore | 2011-08-08 12:00:19 +0000 |
commit | 023e134d493ffda496708705d70e8b459f2972bb (patch) | |
tree | aac7f6bb2c4657208423baa3458c3029c084f45a | |
parent | fca7bedfea00faa6ed060f7013b840fdbcdeeb8b (diff) | |
download | webtools.dali-023e134d493ffda496708705d70e8b459f2972bb.tar.gz webtools.dali-023e134d493ffda496708705d70e8b459f2972bb.tar.xz webtools.dali-023e134d493ffda496708705d70e8b459f2972bb.zip |
fixed annotation removal code when changing the primary annotation
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java index deb400b105..588efe1a33 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMember.java @@ -74,23 +74,26 @@ abstract class SourceMember<M extends Member> } for (Annotation annotation : this.getAnnotations()) { if ( ! CollectionTools.contains(annotationNames, annotation.getAnnotationName())) { - if (annotationIsValidContainer(annotation.getAnnotationName())) { - this.annotationContainers.remove(getAnnotationProvider().getNestableAnnotationName(annotation.getAnnotationName())); - } - else { - this.annotations.remove(annotation); - } + this.annotations.remove(annotation); annotation.removeAnnotation(); } } - //At this point the only thing remaining would be a standalone "nestable" annotation Iterator<AnnotationContainer> containers = this.annotationContainers.values().iterator(); for (; containers.hasNext();) { AnnotationContainer container = containers.next(); - String nestedAnnotatioName = container.getNestedAnnotationName(); - if ( ! CollectionTools.contains(annotationNames, nestedAnnotatioName)) { - containers.remove(); - container.getNestedAnnotations().iterator().next().removeAnnotation(); + if (container.getContainerAnnotation() != null) { + if ( ! CollectionTools.contains(annotationNames, container.getContainerAnnotation().getAnnotationName())) { + containers.remove(); + container.getContainerAnnotation().removeAnnotation(); + } + } + else { + //At this point the only thing remaining would be a standalone "nestable" annotation + String nestedAnnotatioName = container.getNestedAnnotationName(); + if ( ! CollectionTools.contains(annotationNames, nestedAnnotatioName)) { + containers.remove(); + container.getNestedAnnotations().iterator().next().removeAnnotation(); + } } } |