Polishing and removal of "this." for method invocations

This commit is contained in:
Sam Brannen
2025-06-09 14:10:30 +02:00
parent 99890b6147
commit 18d6a55e3e
37 changed files with 127 additions and 135 deletions

View File

@@ -597,8 +597,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
prepareResponse(response);
// Header phase
String eTagValue = (this.getEtagGenerator() != null) ? this.getEtagGenerator().apply(resource) : null;
long lastModified = (this.isUseLastModified()) ? resource.lastModified() : -1;
String eTagValue = (getEtagGenerator() != null ? getEtagGenerator().apply(resource) : null);
long lastModified = (isUseLastModified() ? resource.lastModified() : -1);
if (new ServletWebRequest(request, response).checkNotModified(eTagValue, lastModified)) {
logger.trace("Resource not modified");
return;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -54,7 +54,7 @@ class MatrixVariablesMapMethodArgumentResolverTests {
private MockHttpServletRequest request;
private final ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
private final ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
@BeforeEach

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -54,7 +54,7 @@ class MatrixVariablesMethodArgumentResolverTests {
private MockHttpServletRequest request;
private ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
@BeforeEach

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -62,8 +62,8 @@ class RequestResponseBodyAdviceChainTests {
private Class<? extends HttpMessageConverter<?>> converterType = StringHttpMessageConverter.class;
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), 0);
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), -1);
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), 0);
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), -1);
private ServerHttpRequest request = new ServletServerHttpRequest(new MockHttpServletRequest());
private ServerHttpResponse response = new ServletServerHttpResponse(new MockHttpServletResponse());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -54,7 +54,7 @@ class UriComponentsBuilderMethodArgumentResolverTests {
this.servletRequest = new MockHttpServletRequest();
this.webRequest = new ServletWebRequest(this.servletRequest);
Method method = this.getClass().getDeclaredMethod(
Method method = getClass().getDeclaredMethod(
"handle", UriComponentsBuilder.class, ServletUriComponentsBuilder.class, int.class);
this.builderParam = new MethodParameter(method, 0);
this.servletBuilderParam = new MethodParameter(method, 1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -175,7 +175,7 @@ class DefaultHandlerExceptionResolverTests {
void handleMethodArgumentNotValid() throws Exception {
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(new TestBean(), "testBean");
errors.rejectValue("name", "invalid");
MethodParameter parameter = new MethodParameter(this.getClass().getMethod("handle", String.class), 0);
MethodParameter parameter = new MethodParameter(getClass().getMethod("handle", String.class), 0);
MethodArgumentNotValidException ex = new MethodArgumentNotValidException(parameter, errors);
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertThat(mav).as("No ModelAndView returned").isNotNull();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -117,7 +117,7 @@ class InputTagTests extends AbstractFormTagTests {
final String NAME = "Rob \"I Love Cafés\" Harrop";
final String HTML_ESCAPED_NAME = "Rob &quot;I Love Cafés&quot; Harrop";
this.getPageContext().getResponse().setCharacterEncoding("UTF-8");
getPageContext().getResponse().setCharacterEncoding("UTF-8");
this.tag.setPath("name");
this.rob.setName(NAME);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -33,9 +33,9 @@ class PasswordInputTagTests extends InputTagTests {
@Test // SPR-2866
void passwordValueIsNotRenderedByDefault() throws Exception {
this.getTag().setPath("name");
getTag().setPath("name");
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
String output = getOutput();
assertTagOpened(output);
@@ -47,10 +47,10 @@ class PasswordInputTagTests extends InputTagTests {
@Test // SPR-2866
void passwordValueIsRenderedIfShowPasswordAttributeIsSetToTrue() throws Exception {
this.getTag().setPath("name");
this.getPasswordTag().setShowPassword(true);
getTag().setPath("name");
getPasswordTag().setShowPassword(true);
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
String output = getOutput();
assertTagOpened(output);
@@ -62,10 +62,10 @@ class PasswordInputTagTests extends InputTagTests {
@Test // >SPR-2866
void passwordValueIsNotRenderedIfShowPasswordAttributeIsSetToFalse() throws Exception {
this.getTag().setPath("name");
this.getPasswordTag().setShowPassword(false);
getTag().setPath("name");
getPasswordTag().setShowPassword(false);
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
String output = getOutput();
assertTagOpened(output);
@@ -78,14 +78,14 @@ class PasswordInputTagTests extends InputTagTests {
@Test
@Override
public void dynamicTypeAttribute() {
assertThatIllegalArgumentException().isThrownBy(() ->
this.getTag().setDynamicAttribute(null, "type", "email"))
.withMessage("Attribute type=\"email\" is not allowed");
assertThatIllegalArgumentException()
.isThrownBy(() -> getTag().setDynamicAttribute(null, "type", "email"))
.withMessage("Attribute type=\"email\" is not allowed");
}
@Override
protected void assertValueAttribute(String output, String expectedValue) {
if (this.getPasswordTag().isShowPassword()) {
if (getPasswordTag().isShowPassword()) {
super.assertValueAttribute(output, expectedValue);
}
else {
@@ -110,7 +110,7 @@ class PasswordInputTagTests extends InputTagTests {
}
private PasswordInputTag getPasswordTag() {
return (PasswordInputTag) this.getTag();
return (PasswordInputTag) getTag();
}
}