Don't comment out this check.  I think the right solution is to add synchronization (by calling getReadLock()) to DependenciesImpl.getLastModified() similar to DependenciesImol.getDeclaredDependencies() and DependenciesImpl.getExpandedDependencies().