JetBrains / JetBrains/java-annotations

Ability to hint proper parameter names for functional interfaces

Ouverte
#54 0 commentaires 6 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Kotlin
Étoiles
463
Forks
72
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.