docs: @Nullable
    public static TreePath findEnclosingMethodOrLambdaOrInitializer(TreePath path) {
      TreePath curPath = path.getParentPath();
      while (curPath != null) {
        if (curPath.getLeaf() instanceof MethodTree
            || curPath.getLeaf() instanceof LambdaExpressionTree) {
          return curPath;
        }
        TreePath parent = curPath.getParentPath();
        if (parent != null && parent.getLeaf() instanceof ClassTree) {
          if (curPath.getLeaf() instanceof BlockTree) {
            // found initializer block
            return curPath;
          }
          if (curPath.getLeaf() instanceof VariableTree
              && ((VariableTree) curPath.getLeaf()).getInitializer() != null) {
            // found field with an inline initializer
            return curPath;
          }
        }
        curPath = parent;
      }
      return null;
    }