Author: clement
Date: Thu Jan 13 17:01:51 2011
New Revision: 1058663
URL: http://svn.apache.org/viewvc?rev=1058663&view=rev
Log:
Fix FELIX-2779 iPOJO manipulator badly supports custom annotation attributes of
type Class
Just applied the provided patch and update the changelog.
Modified:
felix/trunk/ipojo/manipulator/doc/changelog.txt
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
Modified: felix/trunk/ipojo/manipulator/doc/changelog.txt
URL:
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/doc/changelog.txt?rev=1058663&r1=1058662&r2=1058663&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/doc/changelog.txt (original)
+++ felix/trunk/ipojo/manipulator/doc/changelog.txt Thu Jan 13 17:01:51 2011
@@ -1,6 +1,7 @@
Changes from the 1.6.4 to 1.8.0
-------------------------------
** Bug
+ * [FELIX-2779] - iPOJO manipulator badly supports custom annotation
attributes of type Class
* [FELIX-2664] - Native methods should not be manipulated
** Improvement
Modified:
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
URL:
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java?rev=1058663&r1=1058662&r2=1058663&view=diff
==============================================================================
---
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
(original)
+++
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
Thu Jan 13 17:01:51 2011
@@ -163,8 +163,15 @@ public class CustomAnnotationVisitor ext
m_elem.addAttribute(new Attribute(arg0, v));
return;
}
+
// Attributes are added as normal attributes
- m_elem.addAttribute(new Attribute(arg0, arg1.toString()));
+ if (!(arg1 instanceof Type)) {
+ m_elem.addAttribute(new Attribute(arg0, arg1.toString()));
+ } else {
+ // Attributes of type class need a special handling
+ m_elem.addAttribute(new Attribute(arg0, ((Type)
arg1).getClassName()));
+ }
+
if (m_root) {
if (arg0.equals("id")) {
m_id = arg1.toString();
@@ -278,9 +285,19 @@ public class CustomAnnotationVisitor ext
*/
public void visit(String arg0, Object arg1) {
if (m_acc == null) {
- m_acc = "{" + arg1.toString();
+ if (!(arg1 instanceof Type)) {
+ m_acc = "{" + arg1.toString();
+ } else {
+ // Attributes of type class need a special handling
+ m_acc = "{" + ((Type) arg1).getClassName();
+ }
} else {
- m_acc = m_acc + "," + arg1.toString();
+ if (!(arg1 instanceof Type)) {
+ m_acc = m_acc + "," + arg1.toString();
+ } else {
+ // Attributes of type class need a special handling
+ m_acc = m_acc + "," + ((Type) arg1).getClassName();
+ }
}
}