Permalink
Browse files

Fix multi-JSF support issue reported at https://community.jboss.org/m…

  • Loading branch information...
1 parent 169487b commit a6b8a01d4f0eb4771a0e79d7250f1ddc1c5517e3 @jaikiran jaikiran committed with kabir Nov 27, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 jsf/injection/src/main/java/org/jboss/as/jsf/injection/AnnotationMap.java
@@ -50,7 +50,7 @@
*/
public class AnnotationMap {
/**
- * @see JSFAnnotationProcessor#FACES_ANNOTATIONS_SC_ATTR
+ * @see org.jboss.as.jsf.deployment.JSFAnnotationProcessor#FACES_ANNOTATIONS_SC_ATTR
*/
public static final String FACES_ANNOTATIONS_SC_ATTR = "org.jboss.as.jsf.FACES_ANNOTATIONS";
private static final String ANNOTATION_MAP_CONVERTED = "org.jboss.as.jsf.ANNOTATION_MAP_CONVERTED";
@@ -100,14 +100,19 @@ private AnnotationMap() {}
}
private static Map<Class<? extends Annotation>, Set<Class<?>>> convert(Map<Class<? extends Annotation>, Set<Class<?>>> annotations) {
- for (Class<? extends Annotation> anno : annotations.keySet()) {
- for (Class<?> clazz : annotations.get(anno)) {
+ final Map<Class<? extends Annotation>, Set<Class<?>>> convertedAnnotatedClasses = new HashMap<Class<? extends Annotation>, Set<Class<?>>>();
+ for (Map.Entry<Class<? extends Annotation>, Set<Class<?>>> entry : annotations.entrySet()) {
+ final Class<? extends Annotation> annotation = entry.getKey();
+ final Set<Class<?>> annotated = entry.getValue();
+ final Class<? extends Annotation> knownAnnotation = stringToAnnoMap.get(annotation.getName());
+ if (knownAnnotation != null) {
+ convertedAnnotatedClasses.put(knownAnnotation, annotated); // put back in the map with the proper version of the class
+ } else {
+ // just copy over the original annotation to annotated classes mapping
+ convertedAnnotatedClasses.put(annotation, annotated);
}
- Set<Class<?>> annotated = annotations.remove(anno);
- Class<? extends Annotation> annoClass = stringToAnnoMap.get(anno.getName());
- annotations.put(annoClass, annotated); // put back in the map with the proper version of the class
}
- return annotations;
+ return convertedAnnotatedClasses;
}
}

0 comments on commit a6b8a01

Please sign in to comment.