From db4d51ba322a329243f7ae761b218da824e0c591 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 24 Oct 2019 13:12:02 +0200 Subject: [PATCH] Remove unused type parameter declarations in XpathRequestMatchers Prior to this commit, several of the methods in XpathRequestMatchers declared unused type parameters (e.g., ). This was obviously the result of copying an existing method that actually needs the type parameter for proper casting. For example, the following ... public RequestMatcher exists() { // ... } ... should actually be declared without , since T is not used in the implementation or in the return type: public RequestMatcher exists() { // ... } This commit removes all unused type parameter declarations in XpathRequestMatchers. Side Effects: Now that we have removed the unused type parameter declarations, users will see the following side effects if they had previously declared a type argument when invoking such methods. - Java: an "Unused type arguments for the non generic method ..." warning will be generated by the compiler, but the code will continue to work unmodified. - Kotlin: a "Type inference failed: Not enough information to infer parameter T in fun ..." compiler error will be raised, causing the code to no longer compile (see https://youtrack.jetbrains.com/issue/KT-5464). Removal of the type argument declaration will allow the code to work correctly again. Closes gh-23860 --- .../web/client/match/XpathRequestMatchers.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java b/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java index 650909a75fd..3bc70803801 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java @@ -65,7 +65,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert it with the given {@code Matcher}. */ - public RequestMatcher node(Matcher matcher) { + public RequestMatcher node(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -77,7 +77,7 @@ public class XpathRequestMatchers { /** * Assert that content exists at the given XPath. */ - public RequestMatcher exists() { + public RequestMatcher exists() { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -89,7 +89,7 @@ public class XpathRequestMatchers { /** * Assert that content does not exist at the given XPath. */ - public RequestMatcher doesNotExist() { + public RequestMatcher doesNotExist() { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -102,7 +102,7 @@ public class XpathRequestMatchers { * Apply the XPath and assert the number of nodes found with the given * {@code Matcher}. */ - public RequestMatcher nodeCount(Matcher matcher) { + public RequestMatcher nodeCount(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -114,7 +114,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the number of nodes found. */ - public RequestMatcher nodeCount(int expectedCount) { + public RequestMatcher nodeCount(int expectedCount) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -126,7 +126,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the String content found with the given matcher. */ - public RequestMatcher string(Matcher matcher) { + public RequestMatcher string(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -150,7 +150,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the number found with the given matcher. */ - public RequestMatcher number(Matcher matcher) { + public RequestMatcher number(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -174,7 +174,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the boolean value found. */ - public RequestMatcher booleanValue(Boolean value) { + public RequestMatcher booleanValue(Boolean value) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception {