Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 260551 Details for
Bug 490339
Optional.orElse() doesn't accept null argument when parameter type is @NonNull
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
OrElseNull.java shows the problem
file_490339.txt (text/plain), 796 bytes, created by
Colin Bartolome
on 2016-03-23 17:13:11 EDT
(
hide
)
Description:
OrElseNull.java shows the problem
Filename:
MIME Type:
Creator:
Colin Bartolome
Created:
2016-03-23 17:13:11 EDT
Size:
796 bytes
patch
obsolete
>import java.util.stream.Stream; > >import org.eclipse.jdt.annotation.Nullable; > >public class OrElseNull >{ > private enum Type > { > INVALID(false); > > private boolean valid; > > private Type(boolean valid) > { > this.valid = valid; > } > > public boolean isValid() > { > return valid; > } > } > > public static @Nullable Type getFirstValidType() > { > @Nullable Type type = Stream.of(Type.values()) > .filter(Type::isValid) > .findFirst() > .orElse(null); // "Null type mismatch" error here > > if (type == null) // "Always yields false" warning here > { > System.err.println("No valid types!"); > } > > return type; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 490339
: 260551