ArtifactPointer (@NotNull Artifact artifact) { myLock.lock(); try { ArtifactPointerImpl pointer = myNameToPointers.computeIfAbsent(artifact.getName(), name -> new ArtifactPointerImpl(name, myProject)); pointer.setArtifact(artifact); return pointer; } finally { myLock.unlock(); } }