private static PsiElement decodeThisExpression(PsiThisExpression thisExpr,
                                                 PsiClass thisClass,
                                                 PsiExpression thisAccessExpr) throws IncorrectOperationException {
    final PsiJavaCodeReferenceElement qualifier = thisExpr.getQualifier();
    PsiClass encodedQualifierClass = thisExpr.getCopyableUserData(THIS_QUALIFIER_CLASS_KEY);
    thisExpr.putCopyableUserData(THIS_QUALIFIER_CLASS_KEY, null);
    if (qualifier == null){
      if (encodedQualifierClass != null && encodedQualifierClass.isValid()){
        if (encodedQualifierClass.equals(thisClass) && thisAccessExpr != null && thisAccessExpr.isValid()){
          if (thisAccessExpr instanceof PsiThisExpression) {
            PsiJavaCodeReferenceElement thisAccessQualifier = ((PsiThisExpression)thisAccessExpr).getQualifier();
            PsiElement resolve = thisAccessQualifier != null ? thisAccessQualifier.resolve() : null;
            if (PsiTreeUtil.getParentOfType(thisExpr, PsiClass.class) == resolve) {
              return thisExpr;
            }
          }
          return thisExpr.replace(thisAccessExpr);
        }
      }
    }
    else {
      PsiClass qualifierClass = (PsiClass)qualifier.resolve();
      if (encodedQualifierClass == qualifierClass && thisClass != null) {
        qualifier.bindToElement(thisClass);
      }
      else {
        if (qualifierClass != null) {
          if (qualifierClass.equals(thisClass) && thisAccessExpr != null && thisAccessExpr.isValid()) {
            return thisExpr.replace(thisAccessExpr);
          }
        }
      }
    }
    return thisExpr;
  }
private static PsiElement decodeThisExpression(PsiThisExpression thisExpr,
                                                 PsiClass thisClass,
                                                 PsiExpression thisAccessExpr)