Gang,
I reported to Rickard yesterday that strange thing happens in
activate() method (see expeption below), basically some form of
incorrect handling of Activatable (possibly Initalizable) interfaces
in the ASM generation code. Rickard's response was that "Well, this
should show up everywhere then...", and I think I have found the
actual problem. See below.

I am adding the following test to qi4j-runtime in 'develop' branch to
showcase the problem;

public class ComplexActivatableTest extends AbstractQi4jTest
{

    public void assemble( ModuleAssembly module )
        throws AssemblyException
    {
        module.addServices( SuperType.class );
    }

    @Test
    public void validateThatApplicationGotAssembled()
    {
        ServiceReference<SuperType> reference =
serviceLocator.findService( SuperType.class );
        reference.get().doSomething();
    }

    @Mixins( { DomainType.class, ActivationMixin.class } )
    public interface SuperType extends Activatable, ServiceComposite
    {
        void doSomething();
    }

    public abstract static class DomainType
        implements SuperType
    {
        public void doSomething()
        {
            System.out.println("Hedhman");
        }
    }

    public static class ActivationMixin
        implements Activatable
    {

        public void activate()
            throws Exception
        {
        }

        public void passivate()
            throws Exception
        {
        }
    }
}


org.qi4j.api.service.ServiceUnavailableException: Could not activate
service SuperType
        at 
org.qi4j.runtime.service.ServiceReferenceInstance.getInstance(ServiceReferenceInstance.java:123)
        at 
org.qi4j.runtime.service.ServiceReferenceInstance.access$100(ServiceReferenceInstance.java:36)
        at 
org.qi4j.runtime.service.ServiceReferenceInstance$ServiceInvocationHandler.invoke(ServiceReferenceInstance.java:169)
        at $Proxy12.doSomething(Unknown Source)
        at 
org.qi4j.runtime.service.ComplexActivatableTest.validateThatApplicationGotAssembled(ComplexActivatableTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at 
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at 
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at 
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at 
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at 
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at 
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at 
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at 
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
Caused by: org.qi4j.api.common.ConstructionException: Could not find
the subclass method
        at 
org.qi4j.runtime.composite.CompositeMethodModel.newCompositeMethodInstance(CompositeMethodModel.java:204)
        at 
org.qi4j.runtime.composite.CompositeMethodModel.getInstance(CompositeMethodModel.java:172)
        at 
org.qi4j.runtime.composite.CompositeMethodModel.invoke(CompositeMethodModel.java:156)
        at 
org.qi4j.runtime.composite.CompositeMethodsModel.invoke(CompositeMethodsModel.java:117)
        at 
org.qi4j.runtime.composite.AbstractCompositeModel.invoke(AbstractCompositeModel.java:144)
        at 
org.qi4j.runtime.composite.TransientInstance.invokeComposite(TransientInstance.java:79)
        at 
org.qi4j.runtime.service.ComplexActivatableTest_DomainType_Stub.activate(Unknown
Source)
        at org.qi4j.runtime.composite.MixinModel.activate(MixinModel.java:317)
        at 
org.qi4j.runtime.composite.AbstractMixinsModel.activate(AbstractMixinsModel.java:301)
        at org.qi4j.runtime.service.ServiceModel.activate(ServiceModel.java:339)
        at 
org.qi4j.runtime.service.ServiceInstance.activate(ServiceInstance.java:58)
        at org.qi4j.runtime.service.Activator.activate(Activator.java:61)
        at 
org.qi4j.runtime.service.ServiceReferenceInstance.getInstance(ServiceReferenceInstance.java:118)
        ... 24 more
Caused by: java.lang.NoSuchMethodException:
org.qi4j.runtime.service.ComplexActivatableTest_ActivationMixin_Stub._activate()
        at java.lang.Class.getMethod(Class.java:1605)
        at 
org.qi4j.runtime.composite.CompositeMethodModel.newCompositeMethodInstance(CompositeMethodModel.java:201)
        ... 36 more


-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/24svnvk
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to