Advanced @Contract capabilities
还没有人认领这个 Issue。
评估
调研方向
首先查看此 issue 中的 Contract 注解和示例语法,包括提议的 CacheReference 和 Reference 行为。确定是否可以指定一种独立的高级 contract 语法,以及需要哪些验证规则;当语法和支持的行为得到明确的定义并达成一致时,工作即完成。
由索引模型根据 Issue 内容生成。
描述
I was thinking about possible extra possibilities for the Contract annotation.
I have this example already; I will add more as I stumble upon them:
Consider this method:
@Contract("CacheReference -> param1; null -> fail; !null -> new")
protected abstract CacheReference<K, V> advanceIntoCacheRef(Reference<V> reference);
The method should do the following things; as described by the contract:
- Throw an NPE, if the parameter is
null - Wrap the parameter
Reference(if notinstanceof CacheReference, else see next) into aCacheReference - Return first parameter if the first parameter is
instanceof CacheReference(which is already imported due to return type; return types should be validated byparamN)
Now, obviously this contract won't work, because it doesn't know about more things than nulls; really. Given other capabilities of IntelliJ, it should be fairly easy coming up with a simple, standalone concept for advanced Contract syntax.
- 主要语言
- Kotlin
- 星标
- 465
- 派生
- 74
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JetBrains/java-annotations 的其他 Issue
-
@TestOnly should be allowed for ElementType.PACKAGE可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
JetBrains/java-annotations#123 ·
-
难度 5/5 一周以上 新手友好度 25/100
JetBrains/java-annotations#134 · 6 条评论 · 1 个 reaction ·
-
Add AndroidTarget as KMP target可能重新可做 @serjsysoev 于 516 天前认领,目前没有进行中的 PR。 未关闭
JetBrains/java-annotations#125 · 1 个 reaction · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 35/100
JetBrains/java-annotations#122 · 2 条评论 ·
-
Allow use of @Language on (formatted-)string literals可能重新可做 @serjsysoev 于 692 天前认领,目前没有进行中的 PR。 未关闭
JetBrains/java-annotations#117 · 4 条评论 · 已指派 1 人 ·
查看 JetBrains/java-annotations 的全部 Issue
相似的 Issue
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
-
Bookmarking an article that is already bookmarked under its redirect URL deletes both bookmarks可能已有人在做 @aakarshitv 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
kiwix/kiwix-android#5176 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
d4rken-org/amply#135 ·
维护者通常 1 天内回复
-
Source: c7 Type: bug
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 90/100
navikt/esyfo-narmesteleder#654 ·
维护者通常 1 天内回复