Skip to content

Commit 037ea9c

Browse files
DiegoKrupitzaschauder
authored andcommitted
Remove unnecessary toString() call.
There were few explicit `toString()` calls that are not needed, since `toString()` will be called by default. Original pull request spring-projects#2431
1 parent 3abc78d commit 037ea9c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -278,7 +278,7 @@ public String toString() {
278278

279279
StringBuilder sb = new StringBuilder();
280280
if (parent != null) {
281-
sb.append(parent.toString());
281+
sb.append(parent);
282282
sb.append(" -");
283283
sb.append(name);
284284
sb.append("-> ");

src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2021 the original author or authors.
2+
* Copyright 2013-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -752,11 +752,11 @@ public Object prepare(@Nullable Object value) {
752752

753753
switch (type) {
754754
case STARTING_WITH:
755-
return String.format("%s%%", value.toString());
755+
return String.format("%s%%", value);
756756
case ENDING_WITH:
757-
return String.format("%%%s", value.toString());
757+
return String.format("%%%s", value);
758758
case CONTAINING:
759-
return String.format("%%%s%%", value.toString());
759+
return String.format("%%%s%%", value);
760760
case LIKE:
761761
default:
762762
return value;

src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2011-2021 the original author or authors.
2+
* Copyright 2011-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -191,7 +191,7 @@ private Set<String> scanForMappingFileLocations() {
191191
mappingFileUris.add(resourcePathInClasspath);
192192

193193
} catch (IOException e) {
194-
throw new IllegalStateException(String.format("Couldn't get URI for %s!", resource.toString()), e);
194+
throw new IllegalStateException(String.format("Couldn't get URI for %s!", resource), e);
195195
}
196196
}
197197

0 commit comments

Comments
 (0)