YANG, BongYeol created FELIX-3990:
-------------------------------------
Summary: iPOJO 1.8.6 manipulator removes custom annotations
Key: FELIX-3990
URL: https://issues.apache.org/jira/browse/FELIX-3990
Project: Felix
Issue Type: Bug
Components: iPOJO
Affects Versions: ipojo-runtime-1.8.6, ipojo-manipulator-1.8.6
Environment: JDK 1.7.0_17, felix framework 4.2.0
Reporter: YANG, BongYeol
I want to migrate from iPOJO 1.4.0 to 1.8.6 and tested my bundles.
In ipojo 1.4.0, custom (user-defined) runtime annotations are moved to ipojo
generated proxy class, but ipojo 1.8.6 does not care about it.
For example:
# TestMethod.java
package org.araqne.test;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface TestMethod {
String name();
}
# TestService.java
package org.araqne.test;
public interface TestService {
void stop();
void start();
}
# TestServiceImpl.java
package org.araqne.test.impl;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.araqne.test.TestMethod;
import org.araqne.test.TestService;
@Component(name = "test-service")
@Provides
public class TestServiceImpl implements TestService {
public TestServiceImpl(String guid) {
}
@Override
@TestMethod(name = "start")
public void start() {
}
@Override
@TestMethod(name = "stop")
public void stop() {
}
}
# OtherServiceImpl.java
package org.araqne.test.impl;
import java.lang.reflect.Method;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Validate;
import org.araqne.test.TestMethod;
import org.araqne.test.TestService;
@Component(name = "test-base-service")
public class OtherServiceImpl {
@Requires
private TestService testService;
public OtherServiceImpl(String guid) {
}
@Validate
public void s() {
Method[] methods = testService.getClass().getDeclaredMethods();
for (Method m : methods) {
TestMethod rpcMethod =
m.getAnnotation(TestMethod.class);
if (rpcMethod == null) {
System.out.println(String.format("annotation
not found: method [%s], class=[%s]", m.getName(),
testService.getClass().getName()));
} else {
System.out.println(String.format("annotation
found: method [%s], class=[%s]", m.getName(),
testService.getClass().getName()));
}
}
}
}
In iPOJO 1.4.0, bundle print out like this:
annotation found: method [start], class=[org.araqne.test.impl.TestServiceImpl]
annotation found: method [stop], class=[org.araqne.test.impl.TestServiceImpl]
annotation not found: method [__start],
class=[org.araqne.test.impl.TestServiceImpl]
annotation not found: method [__stop],
class=[org.araqne.test.impl.TestServiceImpl]
annotation not found: method [_setInstanceManager],
class=[org.araqne.test.impl.TestServiceImpl]
annotation not found: method [getComponentInstance],
class=[org.araqne.test.impl.TestServiceImpl]
In iPOJO 1.8.6, bundle print out like this:
annotation not found: method [start], class=[org.araqne.test.TestService$$Proxy]
annotation not found: method [stop], class=[org.araqne.test.TestService$$Proxy]
Are there any other workaround for this? or just bug?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira