From fdf3bcc9d90f9e2e3950015c79998715697e6021 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 13 Dec 2022 15:52:01 +0100 Subject: [PATCH] Remove obsolete AttributeMethods.hasOnlyValueAttribute() method See gh-29685 --- .../core/annotation/AttributeMethods.java | 11 ---------- .../annotation/AttributeMethodsTests.java | 20 +------------------ 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java b/spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java index ea9b6b715d9f..dc122981aa0d 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java @@ -86,17 +86,6 @@ private AttributeMethods(@Nullable Class annotationType, M } - /** - * Determine if this instance only contains a single attribute named - * {@code value}. - * @return {@code true} if there is only a value attribute - */ - boolean hasOnlyValueAttribute() { - return (this.attributeMethods.length == 1 && - MergedAnnotation.VALUE.equals(this.attributeMethods[0].getName())); - } - - /** * Determine if values from the given annotation can be safely accessed without * causing any {@link TypeNotPresentException TypeNotPresentExceptions}. diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java index 6fb0dcdb433b..a15ff7fa5192 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,24 +58,6 @@ void forAnnotationTypeWhenHasMultipleAttributesReturnsAttributes() { assertThat(getAll(methods)).flatExtracting(Method::getName).containsExactly("intValue", "value"); } - @Test - void hasOnlyValueAttributeWhenHasOnlyValueAttributeReturnsTrue() { - AttributeMethods methods = AttributeMethods.forAnnotationType(ValueOnly.class); - assertThat(methods.hasOnlyValueAttribute()).isTrue(); - } - - @Test - void hasOnlyValueAttributeWhenHasOnlySingleNonValueAttributeReturnsFalse() { - AttributeMethods methods = AttributeMethods.forAnnotationType(NonValueOnly.class); - assertThat(methods.hasOnlyValueAttribute()).isFalse(); - } - - @Test - void hasOnlyValueAttributeWhenHasOnlyMultipleAttributesIncludingValueReturnsFalse() { - AttributeMethods methods = AttributeMethods.forAnnotationType(MultipleAttributes.class); - assertThat(methods.hasOnlyValueAttribute()).isFalse(); - } - @Test void indexOfNameReturnsIndex() { AttributeMethods methods = AttributeMethods.forAnnotationType(MultipleAttributes.class);