Skip to content

Commit 453c0e5

Browse files
committed
Backport changes from main
1 parent a6b567a commit 453c0e5

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

spring-core/src/main/java/org/springframework/aot/hint/support/FilePatternResourceHintsRegistrar.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* based on a file name prefix and an extension with convenience to support
3131
* multiple classpath locations.
3232
*
33-
* <p>Only register hints for matching classpath locations, which allows for
33+
* <p>Only registers hints for matching classpath locations, which allows for
3434
* several locations to be provided without contributing unnecessary hints.
3535
*
3636
* @author Stephane Nicoll
@@ -49,8 +49,8 @@ public class FilePatternResourceHintsRegistrar {
4949
* extensions.
5050
* @param names the file names
5151
* @param locations the classpath locations
52-
* @param extensions the file extensions (starts with a dot)
53-
* @deprecated as of 6.0.12 in favor of {@link #forClassPathLocations(String...) the builder}
52+
* @param extensions the file extensions (starting with a dot)
53+
* @deprecated as of 6.0.12 in favor of {@linkplain #forClassPathLocations(String...) the builder}
5454
*/
5555
@Deprecated(since = "6.0.12", forRemoval = true)
5656
public FilePatternResourceHintsRegistrar(List<String> names, List<String> locations,
@@ -74,7 +74,7 @@ public static Builder forClassPathLocations(String... locations) {
7474

7575
@Deprecated(since = "6.0.12", forRemoval = true)
7676
public void registerHints(ResourceHints hints, @Nullable ClassLoader classLoader) {
77-
ClassLoader classLoaderToUse = (classLoader != null) ? classLoader : getClass().getClassLoader();
77+
ClassLoader classLoaderToUse = (classLoader != null ? classLoader : getClass().getClassLoader());
7878
List<String> includes = new ArrayList<>();
7979
for (String location : this.locations) {
8080
if (classLoaderToUse.getResource(location) != null) {
@@ -118,7 +118,7 @@ public Builder withClasspathLocations(String... classpathLocations) {
118118

119119
/**
120120
* Consider the specified file prefixes. Any file whose name starts with one
121-
* of the specified prefix is considered. A prefix cannot contain the {@code *}
121+
* of the specified prefixes is considered. A prefix cannot contain the {@code *}
122122
* character.
123123
* @param filePrefixes the file prefixes to consider
124124
* @return this builder
@@ -129,8 +129,8 @@ public Builder withFilePrefixes(String... filePrefixes) {
129129
}
130130

131131
/**
132-
* Consider the specified file extensions. A file extension must starts with a
133-
* {@code .} character..
132+
* Consider the specified file extensions. A file extension must start with a
133+
* {@code .} character.
134134
* @param fileExtensions the file extensions to consider
135135
* @return this builder
136136
*/
@@ -147,8 +147,8 @@ FilePatternResourceHintsRegistrar build() {
147147

148148
/**
149149
* Register resource hints for the current state of this builder. For each
150-
* classpath location that resolves against the {@code ClassLoader}, file
151-
* starting with the configured file prefixes and extensions are registered.
150+
* classpath location that resolves against the {@code ClassLoader}, files
151+
* with the configured file prefixes and extensions are registered.
152152
* @param hints the hints contributed so far for the deployment unit
153153
* @param classLoader the classloader, or {@code null} if even the system ClassLoader isn't accessible
154154
*/
@@ -173,13 +173,13 @@ private static List<String> validateClasspathLocations(String... locations) {
173173
return parsedLocations;
174174
}
175175

176-
private static List<String> validateFilePrefixes(String... fileNames) {
177-
for (String name : fileNames) {
178-
if (name.contains("*")) {
179-
throw new IllegalArgumentException("File prefix '" + name + "' cannot contain '*'");
176+
private static List<String> validateFilePrefixes(String... filePrefixes) {
177+
for (String filePrefix : filePrefixes) {
178+
if (filePrefix.contains("*")) {
179+
throw new IllegalArgumentException("File prefix '" + filePrefix + "' cannot contain '*'");
180180
}
181181
}
182-
return Arrays.asList(fileNames);
182+
return Arrays.asList(filePrefixes);
183183
}
184184

185185
private static List<String> validateFileExtensions(String... fileExtensions) {
@@ -192,4 +192,5 @@ private static List<String> validateFileExtensions(String... fileExtensions) {
192192
}
193193

194194
}
195+
195196
}

0 commit comments

Comments
 (0)