modelcontextprotocol / modelcontextprotocol/java-sdk

Migrate null annotations to jspecify

未关闭
#1,066 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement P2 ready for work
主要语言
Java
星标
3.7k
派生
1.1k
平均合并
1 天 15 小时
30 天内合并 PR
9

描述

Currently, the sdk uses Reactor's reactor.util.annotation.Nullable annotations, such as here

https://github.com/modelcontextprotocol/java-sdk/blob/fd004989b9484c9b81be6b03463396797b354804/mcp-core/src/main/java/io/modelcontextprotocol/util/Assert.java#L28

This is causing warnings in my downstream build since that type refers to javax classes I don't have on the classpath.

This is Reactor Nullable, along with its imports:

import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;
import javax.annotation.meta.When;

@Nonnull(when = When.MAYBE)
@TypeQualifierNickname
@Deprecated
public @interface Nullable {
}

The Reactor type is now deprecated, and they recommend you using JSpecify which is fast becoming the standard, if it is not already.

I can possibly submit a PR for this, but I notice a lot of PRs opened recently have limited activity, so will wait for the go-ahead first.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 mcp-core/src/main/java/io/modelcontextprotocol/util/Assert.java 开始,在仓库中搜索 reactor.util.annotation.Nullable 以及相关的 Reactor null 注解。检查构建配置中的 JSpecify 依赖,然后验证所有相关注解都使用 JSpecify,并且 SDK 在不需要 javax 注解类的情况下也能完成构建。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, backend
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。