oldValue is never written to, was this intended?
1289 }
1290
1291 K key;
1292 V oldValue;1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
1295 Object keyReference = node.getKeyReference();
key is never written to, was this intended?
1288 return null;
1289 }
1290
1291 K key;1292 V oldValue;
1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
oldValue is never written to, was this intended?
1289 }
1290
1291 K key;
1292 V oldValue;1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
1295 Object keyReference = node.getKeyReference();
refreshes is never written to, was this intended?
1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
1295 Object keyReference = node.getKeyReference();
1296 ConcurrentMap<Object, CompletableFuture<?>> refreshes;1297 if (((now - writeTime) > refreshAfterWriteNanos()) && (keyReference != null)
1298 && ((key = node.getKey()) != null) && ((oldValue = node.getValue()) != null)
1299 && ((writeTime & 1L) == 0L) && !(refreshes = refreshes()).containsKey(keyReference)
key is never written to, was this intended?
1288 return null;
1289 }
1290
1291 K key;1292 V oldValue;
1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
oldValue is never written to, was this intended?
1289 }
1290
1291 K key;
1292 V oldValue;1293 long writeTime = node.getWriteTime();
1294 long refreshWriteTime = writeTime | 1L;
1295 Object keyReference = node.getKeyReference();
Description
A local variable of a method or constructor has been found to have no writes to it.
This will cause a compile error when the project is built.
Java always expects a local variable to be assigned a value before it is read from. If no assignment is performed, Java will raise a compile error indicating that the variable was expected to be initialized before use.
Bad Practice
In the example below, x
is not written to before use.
int someMethod() {
int x;
// x is never written to.
return x + 5; // will cause a compiler error.
}
Recommended
Always initialize variables to a sensible default value before using them.
int someMethod() {
int x = 0;
return x + 5;
}