@@ -53,10 +53,12 @@ private RepeatableContainers(@Nullable RepeatableContainers parent) {
53
53
54
54
55
55
/**
56
- * Add an additional explicit relationship between a contained and
56
+ * Add an additional explicit relationship between a container and
57
57
* repeatable annotation.
58
- * @param container the container type
59
- * @param repeatable the contained repeatable type
58
+ * <p>WARNING: the arguments supplied to this method are in the reverse order
59
+ * of those supplied to {@link #of(Class, Class)}.
60
+ * @param container the container annotation type
61
+ * @param repeatable the repeatable annotation type
60
62
* @return a new {@link RepeatableContainers} instance
61
63
*/
62
64
public RepeatableContainers and (Class <? extends Annotation > container ,
@@ -103,7 +105,9 @@ public static RepeatableContainers standardRepeatables() {
103
105
/**
104
106
* Create a {@link RepeatableContainers} instance that uses predefined
105
107
* repeatable and container types.
106
- * @param repeatable the contained repeatable annotation type
108
+ * <p>WARNING: the arguments supplied to this method are in the reverse order
109
+ * of those supplied to {@link #and(Class, Class)}.
110
+ * @param repeatable the repeatable annotation type
107
111
* @param container the container annotation type or {@code null}. If specified,
108
112
* this annotation must declare a {@code value} attribute returning an array
109
113
* of repeatable annotations. If not specified, the container will be
@@ -122,7 +126,7 @@ public static RepeatableContainers of(
122
126
}
123
127
124
128
/**
125
- * Create a {@link RepeatableContainers} instance that does not expand any
129
+ * Create a {@link RepeatableContainers} instance that does not support any
126
130
* repeatable annotations.
127
131
* @return a {@link RepeatableContainers} instance
128
132
*/
@@ -208,20 +212,18 @@ private static class ExplicitRepeatableContainer extends RepeatableContainers {
208
212
}
209
213
Class <?> returnType = valueMethod .getReturnType ();
210
214
if (!returnType .isArray () || returnType .getComponentType () != repeatable ) {
211
- throw new AnnotationConfigurationException ("Container type [" +
212
- container .getName () +
213
- "] must declare a 'value' attribute for an array of type [" +
214
- repeatable .getName () + "]" );
215
+ throw new AnnotationConfigurationException (
216
+ "Container type [%s] must declare a 'value' attribute for an array of type [%s]"
217
+ .formatted (container .getName (), repeatable .getName ()));
215
218
}
216
219
}
217
220
catch (AnnotationConfigurationException ex ) {
218
221
throw ex ;
219
222
}
220
223
catch (Throwable ex ) {
221
224
throw new AnnotationConfigurationException (
222
- "Invalid declaration of container type [" + container .getName () +
223
- "] for repeatable annotation [" + repeatable .getName () + "]" ,
224
- ex );
225
+ "Invalid declaration of container type [%s] for repeatable annotation [%s]"
226
+ .formatted (container .getName (), repeatable .getName ()), ex );
225
227
}
226
228
this .repeatable = repeatable ;
227
229
this .container = container ;
0 commit comments