380297 - IllegalStateException: manually changing @Converters to @Converter. Patch from Brian.
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotatedElement.java
index cc93e73..d5d8075 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotatedElement.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceAnnotatedElement.java
@@ -774,18 +774,19 @@
}
/**
- * If we get here, the container annotation does <em>not</em> exist but
- * the standalone nestable annotation does.
+ * If we get here, the container annotation is either empty or does
+ * <em>not</em> exist but the standalone nestable annotation does.
*/
void synchronizeNestableAnnotation(org.eclipse.jdt.core.dom.Annotation astStandaloneNestableAnnotation) {
- if (this.nestedAnnotations.size() == 0) {
- throw new IllegalStateException(); // should not get here...
- }
-
this.containerAnnotation = null;
- this.nestedAnnotations.get(0).synchronizeWith((CompilationUnit) astStandaloneNestableAnnotation.getRoot()); // TODO pass the AST annotation!
- // remove any remaining nested annotations
- this.syncRemoveNestedAnnotations(1);
+ if (this.nestedAnnotations.size() == 0) {
+ // container annotation is present but empty
+ this.syncAddNestedAnnotation(astStandaloneNestableAnnotation);
+ } else {
+ this.nestedAnnotations.get(0).synchronizeWith((CompilationUnit) astStandaloneNestableAnnotation.getRoot()); // TODO pass the AST annotation!
+ // remove any remaining nested annotations
+ this.syncRemoveNestedAnnotations(1);
+ }
}
@Override
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java
index 0b0f31b..2a46bc6 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceNode.java
@@ -330,7 +330,7 @@
}
}
- private void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
int index = this.nestedAnnotations.size();
A nestedAnnotation = this.buildNestedAnnotation(index);
nestedAnnotation.initialize((CompilationUnit) astAnnotation.getRoot());