You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Clement Escoffier (JIRA)" <ji...@apache.org> on 2013/04/08 11:29:16 UTC

[jira] [Commented] (FELIX-3990) iPOJO 1.8.6 manipulator removes custom annotations

    [ https://issues.apache.org/jira/browse/FELIX-3990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13625246#comment-13625246 ] 

Clement Escoffier commented on FELIX-3990:
------------------------------------------

In iPOJO 1.8.6, we are injecting proxy by default. You can disable the proxy-fixation by setting the ipojo.proxy system property to 'disabled' (http://felix.apache.org/site/service-requirement-handler.html#ServiceRequirementHandler-Proxies).
                
> 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-manipulator-1.8.6, ipojo-runtime-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