@@ -1985,16 +1985,14 @@ private void validate() {
19851985 if (this .isAliasPair ) {
19861986 AliasFor mirrorAliasFor = this .aliasedAttribute .getAnnotation (AliasFor .class );
19871987 if (mirrorAliasFor == null ) {
1988- String msg = String .format (
1989- "Attribute [%s] in annotation [%s] must be declared as an @AliasFor [%s]." ,
1988+ String msg = String .format ("Attribute [%s] in annotation [%s] must be declared as an @AliasFor [%s]." ,
19901989 this .aliasedAttributeName , this .sourceAnnotationType .getName (), this .sourceAttributeName );
19911990 throw new AnnotationConfigurationException (msg );
19921991 }
19931992
19941993 String mirrorAliasedAttributeName = getAliasedAttributeName (mirrorAliasFor , this .aliasedAttribute );
19951994 if (!this .sourceAttributeName .equals (mirrorAliasedAttributeName )) {
1996- String msg = String .format (
1997- "Attribute [%s] in annotation [%s] must be declared as an @AliasFor [%s], not [%s]." ,
1995+ String msg = String .format ("Attribute [%s] in annotation [%s] must be declared as an @AliasFor [%s], not [%s]." ,
19981996 this .aliasedAttributeName , this .sourceAnnotationType .getName (), this .sourceAttributeName ,
19991997 mirrorAliasedAttributeName );
20001998 throw new AnnotationConfigurationException (msg );
@@ -2156,12 +2154,13 @@ private String getAliasedAttributeName(AliasFor aliasFor, Method attribute) {
21562154
21572155 // Ensure user did not declare both 'value' and 'attribute' in @AliasFor
21582156 if (attributeDeclared && valueDeclared ) {
2159- throw new AnnotationConfigurationException ( String .format (
2160- "In @AliasFor declared on attribute [%s] in annotation [%s], attribute 'attribute' and its " +
2161- "alias 'value' are present with values of [%s] and [%s], but only one is permitted." ,
2162- attribute . getName (), attribute . getDeclaringClass (). getName (), attributeName , value ) );
2157+ String msg = String .format ("In @AliasFor declared on attribute [%s] in annotation [%s], attribute 'attribute' " +
2158+ "and its alias 'value' are present with values of [%s] and [%s], but only one is permitted." ,
2159+ attribute . getName (), attribute . getDeclaringClass (). getName (), attributeName , value );
2160+ throw new AnnotationConfigurationException ( msg );
21632161 }
21642162
2163+ // Either explicit attribute name or pointing to same-named attribute by default
21652164 attributeName = (attributeDeclared ? attributeName : value );
21662165 return (StringUtils .hasText (attributeName ) ? attributeName .trim () : attribute .getName ());
21672166 }
0 commit comments