List<HighlightVisitor> () { int oldCount = incVisitorUsageCount(1); List<HighlightVisitor> highlightVisitors = HighlightVisitor.EP_HIGHLIGHT_VISITOR.getExtensionList(myProject); if (oldCount != 0) { HighlightVisitor[] clones = new HighlightVisitor[highlightVisitors.size()]; for (int i = 0; i < highlightVisitors.size(); i++) { HighlightVisitor highlightVisitor = highlightVisitors.get(i); HighlightVisitor cloned = highlightVisitor.clone(); assert cloned.getClass() == highlightVisitor.getClass() : highlightVisitor.getClass()+".clone() must return a copy of "+highlightVisitor.getClass()+"; but got: "+cloned+" of "+cloned.getClass(); clones[i] = cloned; } // List.of will copy the array - do not use it return Arrays.asList(clones); } return highlightVisitors; }