Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-08-08 12:00:19 +0000
committerkmoore2011-08-08 12:00:19 +0000
commit023e134d493ffda496708705d70e8b459f2972bb (patch)
treeaac7f6bb2c4657208423baa3458c3029c084f45a
parentfca7bedfea00faa6ed060f7013b840fdbcdeeb8b (diff)
downloadwebtools.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.java25
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();
+ }
}
}

Back to the top