[ 
http://issues.ops4j.org/jira/browse/QI-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_11305
 ] 

Sonny Gill commented on QI-54:
------------------------------

Right after posting this issue, I realized that the problem is that the 
constructor is not public.
(I had a feeling I was missing something :))

So, it is not a bug, although the exception message is a bit misleading since 
it says that the class should be static when it is already static.
A message 'No constructor found' or something like that might be more suitable.

> Static nested class cannot be used to build objects
> ---------------------------------------------------
>
>                 Key: QI-54
>                 URL: http://issues.ops4j.org/jira/browse/QI-54
>             Project: Qi4j
>          Issue Type: Bug
>          Components: Core Runtime
>    Affects Versions: 0.2
>            Reporter: Sonny Gill
>            Assignee: Rickard Öberg
>
> Registering a static nested class to build objects results in an 
> InvalidCompositeException
> Test case -
> import org.qi4j.bootstrap.ApplicationFactory;
> import org.qi4j.bootstrap.AssemblyException;
> import org.qi4j.bootstrap.ModuleAssembly;
> import org.qi4j.bootstrap.SingletonAssembler;
> import org.qi4j.entity.memory.MemoryEntityStoreService;
> import org.qi4j.runtime.structure.ApplicationInstance;
> import org.qi4j.spi.entity.UuidIdentityGeneratorService;
> import org.qi4j.structure.Visibility;
> public class TestCase
> {
>     public TestCase() throws Exception
>     {
>         SingletonAssembler assembler = new SingletonAssembler()
>         {
>             public void assemble( ModuleAssembly module ) throws 
> AssemblyException
>             {
>                 module.addServices( UuidIdentityGeneratorService.class, 
> MemoryEntityStoreService.class ).
>                     visibleIn( Visibility.layer );
>                 module.addObjects( TestCase.class, AClass.class );
>             }
>         };
>         final ApplicationInstance application = new 
> ApplicationFactory().newApplication(assembler).
>             newApplicationInstance( "Test" );
>         application.activate();
>     }
>     public static void main( String[] args ) throws Exception
>     {
>         new TestCase();
>     }
>     public static class AClass
>     {
>         AClass()
>         {
>             System.out.println( "AClass" );
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

Reply via email to