mirror of https://github.com/androidx/media
Add nullness annotations to `SimpleCache`
#fixit PiperOrigin-RevId: 558783228
This commit is contained in:
parent
4fad529433
commit
91764baa90
|
@ -652,7 +652,8 @@ public final class SimpleCache implements Cache {
|
|||
updateFile = true;
|
||||
}
|
||||
SimpleCacheSpan newSpan =
|
||||
contentIndex.get(key).setLastTouchTimestamp(span, lastTouchTimestamp, updateFile);
|
||||
Assertions.checkNotNull(contentIndex.get(key))
|
||||
.setLastTouchTimestamp(span, lastTouchTimestamp, updateFile);
|
||||
notifySpanTouched(span, newSpan);
|
||||
return newSpan;
|
||||
}
|
||||
|
@ -673,7 +674,7 @@ public final class SimpleCache implements Cache {
|
|||
}
|
||||
while (true) {
|
||||
SimpleCacheSpan span = cachedContent.getSpan(position, length);
|
||||
if (span.isCached && span.file.length() != span.length) {
|
||||
if (span.isCached && Assertions.checkNotNull(span.file).length() != span.length) {
|
||||
// The file has been modified or deleted underneath us. It's likely that other files will
|
||||
// have been modified too, so scan the whole in-memory representation.
|
||||
removeStaleSpans();
|
||||
|
@ -701,7 +702,7 @@ public final class SimpleCache implements Cache {
|
|||
}
|
||||
totalSpace -= span.length;
|
||||
if (fileIndex != null) {
|
||||
String fileName = span.file.getName();
|
||||
String fileName = Assertions.checkNotNull(span.file).getName();
|
||||
try {
|
||||
fileIndex.remove(fileName);
|
||||
} catch (IOException e) {
|
||||
|
@ -722,7 +723,7 @@ public final class SimpleCache implements Cache {
|
|||
ArrayList<CacheSpan> spansToBeRemoved = new ArrayList<>();
|
||||
for (CachedContent cachedContent : contentIndex.getAll()) {
|
||||
for (CacheSpan span : cachedContent.getSpans()) {
|
||||
if (span.file.length() != span.length) {
|
||||
if (Assertions.checkNotNull(span.file).length() != span.length) {
|
||||
spansToBeRemoved.add(span);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue