Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jaxb
diff options
context:
space:
mode:
authorpfullbright2011-06-23 17:12:59 +0000
committerpfullbright2011-06-23 17:12:59 +0000
commitcf130b5341a2df3cb36d442f572795c93beb02f2 (patch)
tree8dd14f23b723187e69fda8874767e04ca10b0eec /jaxb
parenteb0de6e28acb146d247f09900fe913fcfe2ab83a (diff)
downloadwebtools.dali-cf130b5341a2df3cb36d442f572795c93beb02f2.tar.gz
webtools.dali-cf130b5341a2df3cb36d442f572795c93beb02f2.tar.xz
webtools.dali-cf130b5341a2df3cb36d442f572795c93beb02f2.zip
bug 345031 - catch CCE and avoid creating annotation in improper location
Diffstat (limited to 'jaxb')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java
index f92161e939..16bc7bd06b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java
@@ -80,9 +80,17 @@ abstract class SourceAnnotatedElement<A extends AnnotatedElement>
if (jdtAnnotationName != null) {
if (this.annotationIsValid(jdtAnnotationName)) {
if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates
- Annotation annotation = this.buildAnnotation(jdtAnnotationName);
- annotation.initialize((CompilationUnit) node.getRoot());
- this.annotations.add(annotation);
+ // TODO - remove and replace with API post 3.0
+ try {
+ Annotation annotation = this.buildAnnotation(jdtAnnotationName);
+ annotation.initialize((CompilationUnit) node.getRoot());
+ this.annotations.add(annotation);
+ }
+ catch (ClassCastException cce) {
+ // an annotation has been placed on a java member to which it is not been targetted,
+ // and an exception has occurred in the annotation construction/initialization,
+ // which is expecting only a certain subset of members
+ }
}
}
else if(this.annotationIsValidNestable(jdtAnnotationName)) {
@@ -283,9 +291,17 @@ abstract class SourceAnnotatedElement<A extends AnnotatedElement>
annotation.synchronizeWith((CompilationUnit) node.getRoot());
annotationsToRemove.remove(annotation);
} else {
- annotation = this.buildAnnotation(jdtAnnotationName);
- annotation.initialize((CompilationUnit) node.getRoot());
- this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
+ // TODO - remove and replace with API post 3.0
+ try {
+ annotation = this.buildAnnotation(jdtAnnotationName);
+ annotation.initialize((CompilationUnit) node.getRoot());
+ this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
+ }
+ catch (ClassCastException cce) {
+ // an annotation has been placed on a java member to which it is not been targetted,
+ // and an exception has occurred in the annotation construction/initialization,
+ // which is expecting only a certain subset of members
+ }
}
}

Back to the top