lastnpe / eclipse-null-eea-augments

Eclipse External null Annotations (EEA) repository
http://lastnpe.org
Eclipse Public License 2.0
41 stars 22 forks source link

add full annotations for Optional #95

Closed J-N-K closed 4 years ago

J-N-K commented 4 years ago

Signed-off-by: Jan N. Klug jan.n.klug@rub.de

jason-faust commented 4 years ago

I'll take a look at these closer to the weekend when I have a chance to get a working environment for this stuff again.

jason-faust commented 4 years ago

These are the results that I got from annotating Optional, some differences with:

class java/util/Optional
empty
 <T:Ljava/lang/Object;>()Ljava/util/Optional<TT;>;
 <T:Ljava/lang/Object;>()L1java/util/Optional<TT;>;
equals
 (Ljava/lang/Object;)Z
 (L0java/lang/Object;)Z
filter
 (Ljava/util/function/Predicate<-TT;>;)Ljava/util/Optional<TT;>;
 (L1java/util/function/Predicate<-TT;>;)L1java/util/Optional<TT;>;
flatMap
 <U:Ljava/lang/Object;>(Ljava/util/function/Function<-TT;+Ljava/util/Optional<+TU;>;>;)Ljava/util/Optional<TU;>;
 <U:Ljava/lang/Object;>(L1java/util/function/Function<-TT;+Ljava/util/Optional<+TU;>;>;)L1java/util/Optional<TU;>;
get
 ()TT;
 ()T1T;
ifPresent
 (Ljava/util/function/Consumer<-TT;>;)V
 (L1java/util/function/Consumer<-TT;>;)V
ifPresentOrElse
 (Ljava/util/function/Consumer<-TT;>;Ljava/lang/Runnable;)V
 (L1java/util/function/Consumer<-TT;>;L1java/lang/Runnable;)V
map
 <U:Ljava/lang/Object;>(Ljava/util/function/Function<-TT;+TU;>;)Ljava/util/Optional<TU;>;
 <U:Ljava/lang/Object;>(L1java/util/function/Function<-TT;+TU;>;)L1java/util/Optional<TU;>;
of
 <T:Ljava/lang/Object;>(TT;)Ljava/util/Optional<TT;>;
 <T:Ljava/lang/Object;>(T1T;)L1java/util/Optional<TT;>;
ofNullable
 <T:Ljava/lang/Object;>(TT;)Ljava/util/Optional<TT;>;
 <T:Ljava/lang/Object;>(T0T;)L1java/util/Optional<TT;>;
or
 (Ljava/util/function/Supplier<+Ljava/util/Optional<+TT;>;>;)Ljava/util/Optional<TT;>;
 (L1java/util/function/Supplier<+Ljava/util/Optional<+TT;>;>;)L1java/util/Optional<TT;>;
orElseGet
 (Ljava/util/function/Supplier<+TT;>;)TT;
 (L1java/util/function/Supplier<+TT;>;)TT;
orElseThrow
 ()TT;
 ()T1T;
orElseThrow
 <X:Ljava/lang/Throwable;>(Ljava/util/function/Supplier<+TX;>;)TT;^TX;
 <X:Ljava/lang/Throwable;>(L1java/util/function/Supplier<+TX;>;)T1T;
stream
 ()Ljava/util/stream/Stream<TT;>;
 ()L1java/util/stream/Stream<TT;>;
toString
 ()Ljava/lang/String;
 ()L1java/lang/String;
J-N-K commented 4 years ago

Agreed. I didn't look at filter as it was there before and forgot the orElseThrow without parameter.