Open Vampire opened 6 years ago
There's the same problem as in #24 and I'm not even sure if I like this idea. Optionals usually shouldn't be used as parameters, even though this is some kind of special use case.
The big advantage of Optionals (which is the reason I use them in Javacord 3) is, that you can immediately see whether a method might return a null value or not. This doesn't apply for method parameters.
If someone really needs the methods of Optional, one can just use Optional.ofNullable(...)
to convert it.
Yeah, I also have seen the inspection of IJ in the meantime, but I really wonder why they are not good as parameters, except for type erasure vs. reflective usage. But same here, of course you can do it yourself, the lib just did it for you in other cases. You are free to not do it, is was just an idea I had and thought might be useful. :-)
Allow
Optional<GroupChannel>
and so on as parameters and directly put theOptional
in there instead of usingorElse(null)
, mapping should be by type parameter if possible or if not, by parameter name if possible (In Java 8 you can use a java compiler switch to make the parameter names available during runtime)