@Rickard && @Niclas:

When looking at ServiceDependencyResolver#resolveDependency there
are 3 steps when resolving:

1. lookup from internal Map (Cache)
2. looking for a concrete class
3. looking for a composite

So it seems for me, that your intention for step 2. was (may be long 
time ago) to allow concrete classes as services, but the block for 2. is 
missing a

        return resolution;

statement. Or what is this block for then?

I still claim that the Energy4Java has a bug, because the field 
objectModelFactory is never assigned, but used in 
newObjectBuilderFactory(), which then later causes a 
NullPointerException in ObjectBuilderFactoryImpl#getObjectResolution.
A

this.objectModelFactory = objectModelFactory;

at the end of the Energy4Java constructor should do that.

I've added both lines above to my environment and my code with a 
concrete service class works as expected.

A different version with a service as composite works only if I setup 
Energy4Java with my own CompositeRegistry and implement 
getCompositeType() accordingly, because the default CompositeRegistry, 
which is CompositeRegistryImpl is not really implemented.

@Niclas:

Didn't want to start the 'when to use final' discussion again, i 
personally never use final on parameters, except in relation with 
anonymous inner classes. But perhaps we should start a discussion about 
tool supported 'smell' detection with tools like PMD, XRadar and others?

So long
        Georg



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

Reply via email to