-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hamcrest-core
and hamcrest-library
are split packages
#269
Comments
Thanks for raising this issue, @shs96c. i'm not a heavy user of Java 9, so I'm not sure: is this still a problem with Hamcrest 2.1? Hamcrest 2.1 was released as 3 jars: In nearly all cases, Hamcrest 2.1 can be a drop in replacement for Hamcrest 1.3 (though there are some quirks in upgrading: http://hamcrest.org/JavaHamcrest/distributables#upgrading-from-hamcrest-1x) |
I don't think that'll work. The JPMS uses the module name to look up the jar to use, so if multiple jars share the same name there's some distinctly undefined behaviour. Having the I've bumped my hamcrest to 2.1, dropped the Still, the same module name everywhere is going to cause chaos. |
Frankly, we’re so strapped for effort that we’ll take whatever contributions we can. The hope was to do a serious rethink with Java closures, but that never happened.
S
… On 20 Aug 2019, at 15:01, Simon Stewart ***@***.***> wrote:
I don't think that'll work. The JPMS uses the module name to look up the jar to use, so if multiple jars share the same name there's some distinctly undefined behaviour. Having the core and library jars be empty should be fine, however.
I've bumped my hamcrest to 2.1, dropped the core and library deps, and (after losing @factory and fixing up code to pretend it never happened) everything seems happier.
Still, the same module name everywhere is going to cause chaos.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#269?email_source=notifications&email_token=AABCNWNGI5TLAXPTL5H4ACDQFPTLDA5CNFSM4IM472BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4WGNJY#issuecomment-523003559>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AABCNWPUVGEG257EA5JZ4IDQFPTLDANCNFSM4IM472BA>.
|
If we modified the jars so that they had different values in I should sit down and create a code sample to test this out. |
That should work, as the jars are just empty.
…Sent from my iPhone
On 20 Aug 2019, at 22:21, Joe Schmetzer ***@***.***> wrote:
If we modified the jars so that they had different values in Automatic-Module-Name, such as org.hamcrest, org.hamcrest.core and org.hamcrest.library, would that solve the issue? Would that cause other problems?
I should sit down and create a code sample to test this out.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Resolves issue #269. Changes the module name of hamcrest-core and hamcrest-libary to avoid split package problems with Java 9.
I was able to reproduce this problem at https://github.com/tumbarumba/hamcrest-test-harness, and tested out the fix in PR #270, which Worked for Me™. Closing this issue on that basis. |
It's great that these hamcrest jars (at version 1.3, which is what junit 4.12 depends on) declare an automatic module name so that they can be used with the JPMS, but there's a problem --- they create a "split package" since they both try and export classes in
org.hamcrest
This causes any java 9 modular build that includes both libraries to fail.This can be fixed by making sure that all the classes in any package are in the same jar, so either by combining all the hamcrest jars, or by being careful with how the release artifacts are constructed.
The text was updated successfully, but these errors were encountered: