Improve null-safety of module/spring-boot-devtools

See gh-47263
This commit is contained in:
Moritz Halbritter 2025-09-19 14:40:13 +02:00
parent 1023ed65a6
commit 58e2f9c872
4 changed files with 6 additions and 4 deletions

View File

@ -16,6 +16,8 @@
package org.springframework.boot.devtools.classpath;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.devtools.filewatch.ChangedFile;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.StringUtils;
@ -37,7 +39,7 @@ public class PatternClassPathRestartStrategy implements ClassPathRestartStrategy
this.excludePatterns = excludePatterns;
}
public PatternClassPathRestartStrategy(String excludePatterns) {
public PatternClassPathRestartStrategy(@Nullable String excludePatterns) {
this(StringUtils.commaDelimitedListToStringArray(excludePatterns));
}

View File

@ -47,7 +47,7 @@ public class ClassLoaderFile implements Serializable {
* @param kind the kind of file
* @param contents the file contents
*/
public ClassLoaderFile(Kind kind, byte[] contents) {
public ClassLoaderFile(Kind kind, byte @Nullable [] contents) {
this(kind, System.currentTimeMillis(), contents);
}

View File

@ -41,6 +41,6 @@ public interface ClassLoaderFileRepository {
* @param name the name of the file
* @return a {@link ClassLoaderFile} or {@code null}
*/
@Nullable ClassLoaderFile getFile(String name);
@Nullable ClassLoaderFile getFile(@Nullable String name);
}

View File

@ -143,7 +143,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable
}
@Override
public @Nullable ClassLoaderFile getFile(String name) {
public @Nullable ClassLoaderFile getFile(@Nullable String name) {
return this.filesByName.get(name);
}