Specify generic type nullness in spring-core

Also in spring-core-test.

See gh-34140
This commit is contained in:
Sébastien Deleuze
2025-01-13 20:52:00 +01:00
parent 435cb0c7d6
commit 9d9383aaeb
31 changed files with 160 additions and 134 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 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.
@@ -37,7 +37,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader {
private final ClassLoader testClassLoader;
private Function<String, byte[]> classResourceLookup = name -> null;
private Function<String, byte @Nullable []> classResourceLookup = name -> null;
public CompileWithForkedClassLoaderClassLoader(ClassLoader testClassLoader) {
@@ -48,7 +48,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader {
// Invoked reflectively by DynamicClassLoader
@SuppressWarnings("unused")
void setClassResourceLookup(Function<String, byte[]> classResourceLookup) {
void setClassResourceLookup(Function<String, byte @Nullable []> classResourceLookup) {
this.classResourceLookup = classResourceLookup;
}

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.
@@ -71,7 +71,7 @@ public class DynamicClassLoader extends ClassLoader {
"setClassResourceLookup", Function.class);
ReflectionUtils.makeAccessible(setClassResourceLookupMethod);
ReflectionUtils.invokeMethod(setClassResourceLookupMethod,
getParent(), (Function<String, byte[]>) this::findClassBytes);
getParent(), (Function<String, byte @Nullable []>) this::findClassBytes);
this.defineClassMethod = lookupMethod(parentClass,
"defineDynamicClass", String.class, byte[].class, int.class, int.class);
ReflectionUtils.makeAccessible(this.defineClassMethod);