Re: RFE: Refactor java.util.Optional and add NonNull checks

2023-08-28 Thread Oleksii Kucheruk
ed your optional only has 2 subclasses and can thus generate > optimized machine code. Or maybe your benchmark is wrong that the result is > not consumed by blackhole so the whole benchmark is moot. We need the code > to make a verdict. > > Chen > > On Mon, Aug 28, 2023 at 6:

Re: RFE: Refactor java.util.Optional and add NonNull checks

2023-08-28 Thread Oleksii Kucheruk
lymorphic. > > Thanks > > On Mon, 28 Aug 2023 at 18:27, Oleksii Kucheruk > wrote: > >> Thank you Quân. >> >> All you saying guys make sense. >> Yes there is a difference calling methods by pointer and involving >> vtable. But one thing didn'

Re: RFE: Refactor java.util.Optional and add NonNull checks

2023-08-28 Thread Oleksii Kucheruk
the > presence of Value classes, so making it polymorphic is unacceptable. > > Thanks. > > On Wed, 23 Aug 2023 at 22:43, Oleksii Kucheruk > wrote: > >> Hi there. >> I have found that `java.util.Optional` is written procedural style and >> has `ifnonnull`

Thanks for re-play

2023-08-25 Thread Oleksii Kucheruk
Hi there! I’ve e nominate my self to be a change provoker of this community! I’ve propose to stop kissing everyones butts only because of the history, go this evening to your favorite bar get drunk, talk to people about your beliefs and in the morning or next day assemble all your craziest hidden

Re: RFE: Refactor java.util.Optional and add NonNull checks

2023-08-24 Thread Oleksii Kucheruk
ee the javadoc) so the class has to > be final. > > And more generally, the API of a classes of OpenJDK will not change based > on some stylistic issue, OOP or not. > > regards, > Rémi Forax > > [1] > https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/do

RFE: Refactor java.util.Optional and add NonNull checks

2023-08-23 Thread Oleksii Kucheruk
Hi there. I have found that `java.util.Optional` is written procedural style and has `ifnonnull` checks in each method. I propose to refactor `Optional` in accordance to OOP-style. This will eliminates all unnecessary `if`-statements, removes duplications and reduces bytecode size more then twice.