From 940d6fea4a1f37d25d365cc93aac61f17fd23d7f Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 17 Oct 2022 13:41:01 -0700 Subject: [PATCH 1/3] Add section to coding guidelines on Optional usage --- docs/contributing/style-guideline.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/contributing/style-guideline.md b/docs/contributing/style-guideline.md index 8f647164a6c3..7466e65fa5b1 100644 --- a/docs/contributing/style-guideline.md +++ b/docs/contributing/style-guideline.md @@ -126,3 +126,11 @@ plugins { id("otel.nullaway-conventions") } ``` + +## java.util.Optional usage + +`Optional` is not generally used in this project, following the reasoning from +https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12. + +It is ok to use `Optional` in places where it does not leak into public API signatures and where +performance is not critical. From f841247eed310943226a0ca22e9f637abe30c045 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 18 Oct 2022 12:00:12 -0700 Subject: [PATCH 2/3] Update docs/contributing/style-guideline.md Co-authored-by: Fabrizio Ferri-Benedetti --- docs/contributing/style-guideline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing/style-guideline.md b/docs/contributing/style-guideline.md index 7466e65fa5b1..9db043129515 100644 --- a/docs/contributing/style-guideline.md +++ b/docs/contributing/style-guideline.md @@ -129,8 +129,8 @@ plugins { ## java.util.Optional usage -`Optional` is not generally used in this project, following the reasoning from -https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12. +Following the reasoning from [Writing a Java library with better experience (slide 12)](https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12), +usage of `java.util.Optional` is kept at a minimum in this project. It is ok to use `Optional` in places where it does not leak into public API signatures and where performance is not critical. From 0a2a7fc48e065c40c97aaa54e5e1166603d20367 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 18 Oct 2022 17:12:17 -0700 Subject: [PATCH 3/3] Spotless --- docs/contributing/style-guideline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/style-guideline.md b/docs/contributing/style-guideline.md index 9db043129515..2b54b53fa20b 100644 --- a/docs/contributing/style-guideline.md +++ b/docs/contributing/style-guideline.md @@ -129,7 +129,7 @@ plugins { ## java.util.Optional usage -Following the reasoning from [Writing a Java library with better experience (slide 12)](https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12), +Following the reasoning from [Writing a Java library with better experience (slide 12)](https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12), usage of `java.util.Optional` is kept at a minimum in this project. It is ok to use `Optional` in places where it does not leak into public API signatures and where