ErrorTreeElement (ErrorTreeElement element) { synchronized (myLock) { List<ErrorTreeElement> elements = mySimpleMessages.get(element.getKind()); if (elements == null) { elements = new ArrayList<>(); mySimpleMessages.put(element.getKind(), elements); } elements.add(element); } return element; }