Actually, looking at the entire method, and more weird stuff shows up;

    protected PropertyModel getPropertyModel( Method method )
    {
        PropertyModel propertyModel;
        Annotation[] annotations = method.getAnnotations();
        List<Annotation> constraintAnnotations = null;
        ConstraintsModel constraintsModel = null;
        for( Annotation annotation : annotations )
        {
            if( annotation.annotationType().getAnnotation(
ConstraintDeclaration.class ) != null )
            {
                Constraints constraintsAnnotation =
annotation.annotationType().getAnnotation( Constraints.class );
                List<ConstraintModel> constraintModels;
                if( constraintsAnnotation != null )
                {
                    constraintModels = new ArrayList<ConstraintModel>();
                    Class<? extends Constraint<?,?>>[]
constraintImplementations = constraintsAnnotation.value();
                    for( Class<? extends Constraint<?,?>>
constraintImplementation : constraintImplementations )
                    {
                        Class<? extends Annotation> annotationType =
annotation.annotationType();
                        ConstraintModel constraintModel = new
ConstraintModel( constraintImplementation, annotationType );
                        constraintModels.add( constraintModel );
                    }
                }
                // This line is never used...
//                ConstraintDeclarationModel
constraintDeclarationModel = new ConstraintDeclarationModel(
annotation.annotationType(), constraintModels );

                if( constraintAnnotations == null )
                {
                    constraintAnnotations = new ArrayList<Annotation>();
                    constraintsModel = new ConstraintsModel(
constraintAnnotations );
                }
                constraintAnnotations.add( annotation );
            }
        }
        propertyModel = new PropertyModel( method, constraintsModel );
        return propertyModel;
    }

The

                  List<ConstraintModel> constraintModels;

will be populated, but never used.

The
                    constraintsModel = new ConstraintsModel(
constraintAnnotations );
is sitting in a loop, and only the last one found is used outside the loop.


Something is not right here...

Rickard?


Cheers
Niclas

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

Reply via email to