Skip to content

Commit

Permalink
Hide component1() destructuring from Java consumers (#30)
Browse files Browse the repository at this point in the history
I propose simple change that i think would be beneficial from the perspective of java consumers, namely annotating `component1()` function with kotlin's `@JvmSynthetic`

As a consequence method will become invisible from Java. Long story short i think it's rather unneccesary to pollute java with a method that quite frankly doesn't say anything for them as the concept of kotlin's destructuring is simply not there. For getting actual values there is `toNullable` already so i don't see a point

Right now it looks like this:

![koptional-in-java](https://user-images.githubusercontent.com/2744747/43391846-106b5ac8-93f2-11e8-9701-5f9d6940eef8.png)
  • Loading branch information
radekkozak authored and artem-zinnatullin committed Jul 31, 2018
1 parent abdeb01 commit a8c7191
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions koptional/src/main/kotlin/com/gojuno/koptional/Optional.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sealed class Optional<out T : Any> {
/**
* Unwraps this optional into the value it holds or null if there is no value held.
*/
@JvmSynthetic
abstract operator fun component1(): T?

companion object {
Expand Down

0 comments on commit a8c7191

Please sign in to comment.