Remove unused type parameter declarations in XpathRequestMatchers

Prior to this commit, several of the methods in XpathRequestMatchers
declared unused type parameters (e.g., <T>). This was obviously the
result of copying an existing method that actually needs the type
parameter for proper casting.

For example, the following ...

public <T> RequestMatcher exists() {
    // ...
}

... should actually be declared without <T>, 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
This commit is contained in:
Sam Brannen 2019-10-24 13:12:02 +02:00
parent 693101ded8
commit db4d51ba32
1 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,7 @@ public class XpathRequestMatchers {
/**
* Apply the XPath and assert it with the given {@code Matcher<Node>}.
*/
public <T> RequestMatcher node(Matcher<? super Node> matcher) {
public RequestMatcher node(Matcher<? super Node> 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 <T> 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 <T> 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<Integer>}.
*/
public <T> RequestMatcher nodeCount(Matcher<Integer> matcher) {
public RequestMatcher nodeCount(Matcher<Integer> 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 <T> 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 <T> RequestMatcher string(Matcher<? super String> matcher) {
public RequestMatcher string(Matcher<? super String> 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 <T> RequestMatcher number(Matcher<? super Double> matcher) {
public RequestMatcher number(Matcher<? super Double> 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 <T> RequestMatcher booleanValue(Boolean value) {
public RequestMatcher booleanValue(Boolean value) {
return new AbstractXpathRequestMatcher() {
@Override
protected void matchInternal(MockClientHttpRequest request) throws Exception {