Skip to content

Commit 9959870

Browse files
committed
add NullMarked
1 parent 46ef301 commit 9959870

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/main/java/org/webjars/WebJarCache.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.webjars;
22

33

4+
import org.jspecify.annotations.NullMarked;
5+
46
import java.util.Optional;
57
import java.util.function.Function;
68

@@ -9,6 +11,7 @@
911
* Since classpath resources are essentially immutable, the WebJarsCache does not have the concept of expiry.
1012
* Cache keys and values are Strings because that is all that is needed.
1113
*/
14+
@NullMarked
1215
public interface WebJarCache {
1316

1417
Optional<String> computeIfAbsent(String key, Function<String, Optional<String>> function);

src/main/java/org/webjars/WebJarCacheDefault.java

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package org.webjars;
22

3+
import org.jspecify.annotations.NullMarked;
4+
35
import java.util.Optional;
46
import java.util.concurrent.ConcurrentMap;
57
import java.util.function.Function;
68

9+
10+
@NullMarked
711
public class WebJarCacheDefault implements WebJarCache {
812

913
final ConcurrentMap<String, Optional<String>> cache;

src/test/java/org/webjars/WebJarVersionLocatorTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.junit.Assert.assertEquals;
44
import static org.junit.Assert.assertNull;
55

6+
import org.jspecify.annotations.NullMarked;
67
import org.junit.Test;
78

89
import java.util.Optional;
@@ -46,6 +47,7 @@ public void full_path_exists_version_supplied() {
4647
public void cache_is_populated_on_lookup() {
4748
AtomicInteger numLookups = new AtomicInteger(0);
4849

50+
@NullMarked
4951
class InspectableCache implements WebJarCache {
5052
final ConcurrentHashMap<String, Optional<String>> cache = new ConcurrentHashMap<>();
5153

0 commit comments

Comments
 (0)