docs: @Nullable
    public static Object constValue(Tree tree) {
      if (tree == null) {
        return null;
      }
      tree = stripParentheses(tree);
      Type type = ASTHelpers.getType(tree);
      Object value;
      if (tree instanceof JCLiteral) {
        value = ((JCLiteral) tree).value;
      } else if (type != null) {
        value = type.constValue();
      } else {
        return null;
      }
      if (type.hasTag(TypeTag.BOOLEAN) && value instanceof Integer) {
        return ((Integer) value) == 1;
      }
      return value;
    }