TreeElement (TreeElement element, final Map<Object, Object> decodingState) { if (element instanceof CompositeElement) { if (element.getElementType() == GroovyElementTypes.REFERENCE_ELEMENT || element.getElementType() == GroovyElementTypes.REFERENCE_EXPRESSION) { GrReferenceElement ref = (GrReferenceElement)SourceTreeToPsiMap.treeElementToPsi(element); final PsiMember refMember = element.getCopyableUserData(REFERENCED_MEMBER_KEY); if (refMember != null) { element.putCopyableUserData(REFERENCED_MEMBER_KEY, null); PsiElement refElement1 = ref.resolve(); if (!refMember.getManager().areElementsEquivalent(refMember, refElement1)) { try { if (!(refMember instanceof PsiClass) || ref.getQualifier() == null) { // can restore only if short (otherwise qualifier should be already restored) ref = (GrReferenceElement)ref.bindToElement(refMember); } } catch (IncorrectOperationException ignored) { } return (TreeElement)SourceTreeToPsiMap.psiElementToTree(ref); } } return element; } } return null; }