Skip to content

Commit fdf3bcc

Browse files
committed
Remove obsolete AttributeMethods.hasOnlyValueAttribute() method
See gh-29685
1 parent 5ddc984 commit fdf3bcc

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,6 @@ private AttributeMethods(@Nullable Class<? extends Annotation> annotationType, M
8686
}
8787

8888

89-
/**
90-
* Determine if this instance only contains a single attribute named
91-
* {@code value}.
92-
* @return {@code true} if there is only a value attribute
93-
*/
94-
boolean hasOnlyValueAttribute() {
95-
return (this.attributeMethods.length == 1 &&
96-
MergedAnnotation.VALUE.equals(this.attributeMethods[0].getName()));
97-
}
98-
99-
10089
/**
10190
* Determine if values from the given annotation can be safely accessed without
10291
* causing any {@link TypeNotPresentException TypeNotPresentExceptions}.

spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,24 +58,6 @@ void forAnnotationTypeWhenHasMultipleAttributesReturnsAttributes() {
5858
assertThat(getAll(methods)).flatExtracting(Method::getName).containsExactly("intValue", "value");
5959
}
6060

61-
@Test
62-
void hasOnlyValueAttributeWhenHasOnlyValueAttributeReturnsTrue() {
63-
AttributeMethods methods = AttributeMethods.forAnnotationType(ValueOnly.class);
64-
assertThat(methods.hasOnlyValueAttribute()).isTrue();
65-
}
66-
67-
@Test
68-
void hasOnlyValueAttributeWhenHasOnlySingleNonValueAttributeReturnsFalse() {
69-
AttributeMethods methods = AttributeMethods.forAnnotationType(NonValueOnly.class);
70-
assertThat(methods.hasOnlyValueAttribute()).isFalse();
71-
}
72-
73-
@Test
74-
void hasOnlyValueAttributeWhenHasOnlyMultipleAttributesIncludingValueReturnsFalse() {
75-
AttributeMethods methods = AttributeMethods.forAnnotationType(MultipleAttributes.class);
76-
assertThat(methods.hasOnlyValueAttribute()).isFalse();
77-
}
78-
7961
@Test
8062
void indexOfNameReturnsIndex() {
8163
AttributeMethods methods = AttributeMethods.forAnnotationType(MultipleAttributes.class);

0 commit comments

Comments
 (0)