void (@NotNull AbstractFileViewProvider copy) { if (copy instanceof FreeThreadedFileViewProvider) { LOG.assertTrue(this instanceof FreeThreadedFileViewProvider, "Injected file can't have non-injected original file"); } Set<AbstractFileViewProvider> copies = getUserData(KNOWN_COPIES); if (copies == null) { copies = putUserDataIfAbsent(KNOWN_COPIES, Collections.newSetFromMap(CollectionFactory.createConcurrentWeakMap())); } if (copy.getUserData(KNOWN_COPIES) != null) { List<AbstractFileViewProvider> derivations = JBTreeTraverser.from(AbstractFileViewProvider::getKnownCopies).withRoot(copy).toList(); if (derivations.contains(this)) { throw new IllegalStateException("An attempted cycle in view provider copy graph involving " + this + " and " + copy); } } copies.add(copy); }