Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ext {
description = "Spring Framework"

configure(allprojects) { project ->
apply from: rootProject.file('gradle/error-prone.gradle')
apply plugin: "org.springframework.build.localdev"
group = "org.springframework"
repositories {
Expand Down
21 changes: 21 additions & 0 deletions gradle/error-prone.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import static java.lang.System.getenv

apply plugin: 'net.ltgt.errorprone'

dependencies {
errorprone('com.google.errorprone:error_prone_core:2.42.0')
errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.25.0')
}

tasks.withType(JavaCompile).configureEach {
options.errorprone {
disableAllChecks = true // remove once applied error-prone. # https://github.com/google/error-prone/issues/5280
error('RedundantStringConversion')
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
errorproneArgs.addAll(
'-XepPatchLocation:IN_PLACE',
'-XepPatchChecks:RedundantStringConversion'
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public String toLongString() {

@Override
public String toString() {
return "execution(" + getSignature().toString() + ")";
return "execution(" + getSignature() + ")";
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private Map<String, Object> asMap(Object object) {
}
else {
// It has to be a map key in this case
result.put("[" + key.toString() + "]", value);
result.put("[" + key + "]", value);
}
});
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public String getType(TypeMirror type) {
if (type instanceof DeclaredType declaredType) {
Element enclosingElement = declaredType.asElement().getEnclosingElement();
if (enclosingElement instanceof TypeElement) {
return getQualifiedName(enclosingElement) + "$" + declaredType.asElement().getSimpleName().toString();
return getQualifiedName(enclosingElement) + "$" + declaredType.asElement().getSimpleName();
}
else {
return getQualifiedName(declaredType.asElement());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public final Exception[] getMessageExceptions() {
sb.append("Failed messages: ");
for (int i = 0; i < this.messageExceptions.length; i++) {
Exception subEx = this.messageExceptions[i];
sb.append(subEx.toString());
sb.append(subEx);
if (i < this.messageExceptions.length - 1) {
sb.append("; ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ private void parseCachingAnnotation(
private void validateCacheOperation(AnnotatedElement ae, CacheOperation operation) {
if (StringUtils.hasText(operation.getKey()) && StringUtils.hasText(operation.getKeyGenerator())) {
throw new IllegalStateException("Invalid cache annotation configuration on '" +
ae.toString() + "'. Both 'key' and 'keyGenerator' attributes have been set. " +
ae + "'. Both 'key' and 'keyGenerator' attributes have been set. " +
"These attributes are mutually exclusive: either set the SpEL expression used to" +
"compute the key at runtime or set the name of the KeyGenerator bean to use.");
}
if (StringUtils.hasText(operation.getCacheManager()) && StringUtils.hasText(operation.getCacheResolver())) {
throw new IllegalStateException("Invalid cache annotation configuration on '" +
ae.toString() + "'. Both 'cacheManager' and 'cacheResolver' attributes have been set. " +
ae + "'. Both 'cacheManager' and 'cacheResolver' attributes have been set. " +
"These attributes are mutually exclusive: the cache manager is used to configure a" +
"default cache resolver if none is set. If a cache resolver is set, the cache manager" +
"won't be used.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ <T extends CacheOperation.Builder> T merge(Element element, ReaderContext reader

if (StringUtils.hasText(builder.getKey()) && StringUtils.hasText(builder.getKeyGenerator())) {
throw new IllegalStateException("Invalid cache advice configuration on '" +
element.toString() + "'. Both 'key' and 'keyGenerator' attributes have been set. " +
element + "'. Both 'key' and 'keyGenerator' attributes have been set. " +
"These attributes are mutually exclusive: either set the SpEL expression used to" +
"compute the key at runtime or set the name of the KeyGenerator bean to use.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public FilteringClassFileTransformer(

@Override
public String toString() {
return "FilteringClassFileTransformer for: " + this.targetTransformer.toString();
return "FilteringClassFileTransformer for: " + this.targetTransformer;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void generate(ClassEmitter ce, Context context, List methods) {
private static void superHelper(CodeEmitter e, MethodInfo method, Context context)
{
if (TypeUtils.isAbstract(method.getModifiers())) {
e.throw_exception(ABSTRACT_METHOD_ERROR, method.toString() + " is abstract" );
e.throw_exception(ABSTRACT_METHOD_ERROR, method + " is abstract" );
} else {
e.load_this();
context.emitLoadArgsAndInvoke(e, method);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String toString() {
if (i > 0) {
sb.append(", ");
}
sb.append(chain[i].toString());
sb.append(chain[i]);
}
sb.append("}");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ else if (this.dimensions != null) {
for (int i = 1; i < count; i++) {
sj.add(getChild(i).toStringAST());
}
sb.append(sj.toString());
sb.append(sj);
}

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ private String appendPayload(Object payload) {
}
byte[] bytes = (byte[]) payload;
MimeType mimeType = getContentType();
String contentType = (mimeType != null ? " " + mimeType.toString() : "");
String contentType = (mimeType != null ? " " + mimeType : "");
if (bytes.length == 0 || mimeType == null || !isReadableContentType()) {
return contentType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public void setErrorChannel(MessageChannel errorChannel) {
* @return the message
*/
public String getShortLogMessage(Object payload) {
return "headers=" + this.headers.toString() + getShortPayloadLogMessage(payload);
return "headers=" + this.headers + getShortPayloadLogMessage(payload);
}

/**
Expand All @@ -489,7 +489,7 @@ public String getShortLogMessage(Object payload) {
* @return the message
*/
public String getDetailedLogMessage(@Nullable Object payload) {
return "headers=" + this.headers.toString() + getDetailedPayloadLogMessage(payload);
return "headers=" + this.headers + getDetailedPayloadLogMessage(payload);
}

protected String getShortPayloadLogMessage(Object payload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void afterConcurrentHandlingStarted(WebRequest request) {
* @see #PARTICIPATE_SUFFIX
*/
protected String getParticipateAttributeName() {
return obtainEntityManagerFactory().toString() + PARTICIPATE_SUFFIX;
return obtainEntityManagerFactory() + PARTICIPATE_SUFFIX;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private static String filterBindMarker(CharSequence input) {
if (builder.isEmpty()) {
return "";
}
return "_" + builder.toString();
return "_" + builder;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected String getRequestDetails() {
if (!this.requests.isEmpty()) {
sb.append(":\n");
for (ClientHttpRequest request : this.requests) {
sb.append(request.toString()).append('\n');
sb.append(request).append('\n');
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static URI initURI(HttpServletRequest servletRequest) {
try {
// Maybe malformed query, try to parse and encode it
query = UriComponentsBuilder.fromUriString("?" + query).build().toUri().getRawQuery();
return new URI(servletRequest.getRequestURL().toString() + "?" + query);
return new URI(servletRequest.getRequestURL() + "?" + query);
}
catch (URISyntaxException ex2) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private static URI initUri(HttpServletRequest servletRequest) {
try {
// Maybe malformed query, try to parse and encode it
query = UriComponentsBuilder.fromUriString("?" + query).build().toUri().getRawQuery();
return new URI(servletRequest.getRequestURL().toString() + "?" + query);
return new URI(servletRequest.getRequestURL() + "?" + query);
}
catch (URISyntaxException ex2) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public List<String> getPathSegments() {
}
queryBuilder.append(name);
if (value != null) {
queryBuilder.append('=').append(value.toString());
queryBuilder.append('=').append(value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ else if (p.processCurlyBrackets(c)) {
}
// Otherwise, port-invalid validation error, return failure.
else {
p.failure("Invalid port: \"" + Character.toString(c) + "\"");
p.failure("Invalid port: \"" + c + "\"");
}
}
},
Expand Down Expand Up @@ -2703,7 +2703,7 @@ else if (c == ':') {
// IPv6-invalid-code-point validation error, return failure.
else if (c != EOF) {
throw new InvalidUrlException(
"IPv6 address contains \"" + Character.toString(c) + "\", which is " +
"IPv6 address contains \"" + c + "\", which is " +
"neither an ASCII hex digit nor a ':'.");
}
// Set address[pieceIndex] to value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public UnsupportedMediaTypeException(@Nullable MediaType contentType, List<Media

private static String initReason(@Nullable MediaType contentType, @Nullable ResolvableType bodyType) {
return "Content type '" + (contentType != null ? contentType : "") + "' not supported" +
(bodyType != null ? " for bodyType=" + bodyType.toString() : "");
(bodyType != null ? " for bodyType=" + bodyType : "");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ public void changeParser(PathPatternParser parser) {

@Override
public String toString() {
return "!" + this.delegate.toString();
return "!" + this.delegate;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void afterPropertiesSet() {
}

String mediaTypeInfo = (logger.isDebugEnabled() && requestedMediaTypes != null ?
" given " + requestedMediaTypes.toString() : "");
" given " + requestedMediaTypes : "");

if (this.useNotAcceptableStatusCode) {
if (logger.isDebugEnabled()) {
Expand Down