Closed odrotbohm closed 3 months ago
+1
:+1:
Yes, but not in core, because we support old versions of the Java language that is still used in embedded systems. Matchers for Java 8 classes will have to go in their own add-on library for now.
You can have support for Java 8 types but keep compatibility with former version if you just use a JDK 8 to compile the code with e.g. 1.6 target. If the code using the newly introduced types is in dedicated classes, this doesn't cause any issues. Spring Framework makes heavy use of this technique.
:+1:
I have some String related utilities that I have created for my personal use. I would love to contribute those. Have we decided the way we have to package those classes? Will it be an extra library for 1.8 as well?
I suggest publishing them as an extension library to start with.
On Wednesday, 1 July 2015, Narendra Pathai notifications@github.com wrote:
I have some String related utilities that I have created for my personal use. I would love to contribute those. Have we decided the way we have to package those classes? Will it be an extra library for 1.8 as well?
— Reply to this email directly or view it on GitHub https://github.com/hamcrest/JavaHamcrest/issues/82#issuecomment-117516673 .
@npryce @olivergierke
I have an initial implementation at https://github.com/npathai/hamcrest-jdk8-extras
Please go through it and provide some inputs.
There are three methods: isPresent()
, isEmpty()
and isPresentAnd(Matcher)
. Out of which first two are obvious. The third one is useful for applying matchers on value inside the Optional
instance.
@npryce @npathai
https://github.com/npathai/hamcrest-jdk8-extras looks good, despite the double execution of the matcher in isPresentAnd(Matcher)
. Is there a chance to get it into hamcrest soon?
@scheffield Great. I will get to it soon n remove double execution. I have been busy lately. I will change it this weekend.
@scheffield I have resolved the issue. I will further refine the implementation if I get some reviews.
Does anyone feel we need matchers for new DateTime API of Java8?
@npathai I would rather see your extras merged into core project, but I think you should cover it, since you called your project "jdk8" :)
@matteprl Yes I would like that too. But I didn't get your point.
@npathai's hamcrest-jdk8-extras has been renamed to https://github.com/npathai/hamcrest-optional.
@npathai @stefanbirkner Thank you for information. I know that library is single file project. But have you considered putting it into maven? I like to keep my dependencies managed, and some people - just like me sometimes use search tool on sites like mvnrepository.com and just type hamcrest jdk8. I think it would also make more people use your library. :)
@matteprl Yes we are already considering that. It will be available very soon. Thanks for your inputs.
Any update about when this will make it into hamcrest project? I have seen that hamcrest-optional from @npathai was forked by @baev for maven release integration (https://github.com/baev/hamcrest-optional). But I would like to see an "official" hamcrest integration. From my point of view it makes totally sense to integrate the hamcrest-optional lib into hamcrest project.
@cod3hulk @matteprl @scheffield I have released hamcrest-optional to maven central
<dependency>
<groupId>com.github.npathai</groupId>
<artifactId>hamcrest-optional</artifactId>
<version>1.0</version>
</dependency>
Hi all. We at Spotify have open-sourced some matchers for Optionals here https://github.com/spotify/java-hamcrest. Hopefully you find these useful and maybe we can even get some of these into upstream.
Let us know if you have questions or ideas.
We are now at java 15 going on 16 and Java 7 is now very much end-of-life. Isn't it time to include optionals into the standard java hamcrest library?
Closing this issue, discussion can continue on #206
There's a Hamcrest-Extras library that has matchers for Guava's
Optional
. It would be cool to have the standard Hamcrest library provide these kinds of matchers for the pure JDK 8Optionals
as well.