@@ -63,7 +63,7 @@ public static List<Member<?>> parse(final Class<?> type)
6363 // Parse class level (i.e., generic) @Parameter annotations.
6464 final Class <?> paramsClass = findParametersDeclaration (type );
6565 if (paramsClass != null ) {
66- parseFunctionalParameters (items , names , problems , findParametersDeclaration ( type ) , type );
66+ parseFunctionalParameters (items , names , problems , paramsClass , type );
6767 }
6868
6969 // Parse field level @Parameter annotations.
@@ -162,40 +162,38 @@ private static void parseFunctionalParameters(final ArrayList<Member<?>> items,
162162 AnnotatedElement annotationBearer , Type type ) {
163163 Parameter [] annotations = parameters (annotationBearer );
164164
165-
166165 final Class <?> functionalType = findFunctionalInterface (Types .raw (type ), annotations .length );
167166 if (functionalType == null ) {
168- problems .add (new ValidityProblem ("Could not find functional interface of " + type .getTypeName () + " with the the required number of "
169- + "parameters: " + annotations .length ));
170- }
171-
172- // TODO: Consider allowing partial override of class @Parameters.
173- for ( int i = 0 ; i < annotations . length ; i ++) {
174- String key = annotations [ i ]. key ();
175-
176- Type paramType = type ;
177- if ( type instanceof Class ) {
178- paramType = Types . parameterizeRaw (( Class <?>) type );
179- }
180-
181- final Type itemType = Types .param ( paramType , functionalType , i );
182- final Class <?> rawItemType = Types . raw ( itemType );
183- final boolean valid = checkValidity ( annotations [ i ], key , rawItemType , false ,
184- names , problems );
185- if (! valid ) continue ; // NB: Skip invalid parameters.
186-
187- // add item to the list
188- try {
189- final ParameterMember <?> item = //
190- new FunctionalParameterMember <>( itemType , annotations [ i ] );
191- names .add (key );
192- items . add ( item );
193- }
194- catch ( final ValidityException exc ) {
195- problems . addAll ( exc . problems ());
167+ problems .add (new ValidityProblem ("Could not find functional interface of " + type .getTypeName () + " with the required number of "
168+ + "type parameters: " + annotations .length ));
169+ } else {
170+ // TODO: Consider allowing partial override of class @Parameters.
171+ for ( int i = 0 ; i < annotations . length ; i ++) {
172+ String key = annotations [ i ]. key ();
173+
174+ Type paramType = type ;
175+ if ( type instanceof Class ) {
176+ paramType = Types . parameterizeRaw (( Class <?>) type );
177+ }
178+
179+ final Type itemType = Types . param ( paramType , functionalType , i );
180+ final Class <?> rawItemType = Types .raw ( itemType );
181+ final boolean valid = checkValidity ( annotations [ i ], key , rawItemType , false ,
182+ names , problems );
183+ if (! valid ) continue ; // NB: Skip invalid parameters.
184+
185+ // add item to the list
186+ try {
187+ final ParameterMember <?> item = //
188+ new FunctionalParameterMember <>( itemType , annotations [ i ]);
189+ names . add ( key );
190+ items .add (item );
191+ }
192+ catch ( final ValidityException exc ) {
193+ problems . addAll ( exc . problems ());
194+ }
196195 }
197196 }
198-
199197 }
200198
201199 private static boolean isImmutable (final Class <?> type ) {
0 commit comments