Skip to content

Commit 3d502d9

Browse files
committed
Add missing nullable declarations
See gh-22821
1 parent f8dc852 commit 3d502d9

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java

+6-16
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
5555

5656
private final Locale locale;
5757

58+
@Nullable
5859
private transient Set<String> keySet;
5960

61+
@Nullable
6062
private transient Collection<V> values;
6163

64+
@Nullable
6265
private transient Set<Entry<String, V>> entrySet;
6366

6467

@@ -320,6 +323,7 @@ protected boolean removeEldestEntry(Map.Entry<String, V> eldest) {
320323
return false;
321324
}
322325

326+
@Nullable
323327
private String removeCaseInsensitiveKey(String key) {
324328
return this.caseInsensitiveKeys.remove(convertKey(key));
325329
}
@@ -329,12 +333,10 @@ private class KeySet extends AbstractSet<String> {
329333

330334
private final Set<String> delegate;
331335

332-
333336
KeySet(Set<String> delegate) {
334337
this.delegate = delegate;
335338
}
336339

337-
338340
@Override
339341
public int size() {
340342
return this.delegate.size();
@@ -369,20 +371,17 @@ public Spliterator<String> spliterator() {
369371
public void forEach(Consumer<? super String> action) {
370372
this.delegate.forEach(action);
371373
}
372-
373374
}
374375

375376

376377
private class Values extends AbstractCollection<V> {
377378

378379
private final Collection<V> delegate;
379380

380-
381381
Values(Collection<V> delegate) {
382382
this.delegate = delegate;
383383
}
384384

385-
386385
@Override
387386
public int size() {
388387
return this.delegate.size();
@@ -412,20 +411,17 @@ public Spliterator<V> spliterator() {
412411
public void forEach(Consumer<? super V> action) {
413412
this.delegate.forEach(action);
414413
}
415-
416414
}
417415

418416

419417
private class EntrySet extends AbstractSet<Entry<String, V>> {
420418

421419
private final Set<Entry<String, V>> delegate;
422420

423-
424421
public EntrySet(Set<Entry<String, V>> delegate) {
425422
this.delegate = delegate;
426423
}
427424

428-
429425
@Override
430426
public int size() {
431427
return this.delegate.size();
@@ -441,7 +437,6 @@ public Iterator<Entry<String, V>> iterator() {
441437
return new EntrySetIterator();
442438
}
443439

444-
445440
@Override
446441
@SuppressWarnings("unchecked")
447442
public boolean remove(Object o) {
@@ -452,7 +447,6 @@ public boolean remove(Object o) {
452447
return false;
453448
}
454449

455-
456450
@Override
457451
public void clear() {
458452
this.delegate.clear();
@@ -468,14 +462,14 @@ public Spliterator<Entry<String, V>> spliterator() {
468462
public void forEach(Consumer<? super Entry<String, V>> action) {
469463
this.delegate.forEach(action);
470464
}
471-
472465
}
473466

474467

475468
private class EntryIterator {
476469

477470
private final Iterator<Entry<String, V>> delegate;
478471

472+
@Nullable
479473
private Entry<String, V> last;
480474

481475
public EntryIterator() {
@@ -494,12 +488,11 @@ public boolean hasNext() {
494488

495489
public void remove() {
496490
this.delegate.remove();
497-
if(this.last != null) {
491+
if (this.last != null) {
498492
removeCaseInsensitiveKey(this.last.getKey());
499493
this.last = null;
500494
}
501495
}
502-
503496
}
504497

505498

@@ -509,7 +502,6 @@ private class KeySetIterator extends EntryIterator implements Iterator<String> {
509502
public String next() {
510503
return nextEntry().getKey();
511504
}
512-
513505
}
514506

515507

@@ -519,7 +511,6 @@ private class ValuesIterator extends EntryIterator implements Iterator<V> {
519511
public V next() {
520512
return nextEntry().getValue();
521513
}
522-
523514
}
524515

525516

@@ -529,7 +520,6 @@ private class EntrySetIterator extends EntryIterator implements Iterator<Entry<S
529520
public Entry<String, V> next() {
530521
return nextEntry();
531522
}
532-
533523
}
534524

535525
}

0 commit comments

Comments
 (0)