JetBrains / JetBrains/java-annotations

Ability to hint proper parameter names for functional interfaces

未关闭
#54 0 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Kotlin
星标
463
派生
72
PR 合并指标
30 天内没有已合并 PR

描述

I am (re)-using multiple common functional interfaces in my code, and the parameter names sometimes do not properly match the intent. For example `DoubleUnaryOperator` taking a double generically named `operand`.

I believe there could be an annotation hinting the IDE into using our own name
```java
// What is currently suggested
Vec.ZERO.withX(operand -> operand * 5);
// With hint
Vec.ZERO.withX(x -> x * 5);

// Similar example using UnaryOperator
// What is currently suggested
itemBuilder.meta(itemMetaBuilder -> itemMetaBuilder);
// With hint
itemBuilder.meta(metaBuilder -> metaBuilder);
```

The alternative would be creating my own interfaces, which feels a bit unnecessary.

贡献指南

打开贡献指南

调研方向

Start by reviewing the existing annotations in the java-annotations repository and the Java functional-interface examples in the issue. Determine the annotation semantics and IDE support needed to provide the requested parameter-name hints. Done means the proposal has a defined design and an implementation path validated against both examples.

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

评估

技术栈
java
领域
developer-experience
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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