GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `hamcrest-core` and `hamcrest-library` are split packages · Issue #269 · hamcrest/JavaHamcrest

hamcrest-core and hamcrest-library are split packages #269

New issue
Copy link
New issue
Copy link
Closed
Closed
hamcrest-core and hamcrest-library are split packages#269
Copy link

Description

@shs96c
shs96c
opened on Aug 19, 2019
Issue body actions

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.

Activity

  1. tumbarumba commented on Aug 19, 2019

    @tumbarumba
    tumbarumba
    on Aug 19, 2019
    Member
    More actions

    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: hamcrest-2.1.jar (now contains all the code), hamcrest-core-2.1.jar and hamcrest-library-2.1.jar (both empty shims to allow transitive depenencies to find hamcrest-2.1.jar). All 3 jars specify 'Automatic-Module-Name': 'org.hamcrest' in the manifest. I was under the impression that this would Just Work™ with Java 9 modules.

    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)

  2. shs96c commented on Aug 20, 2019

    @shs96c
    shs96c
    on Aug 20, 2019
    Author
    More actions

    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.

  3. sf105 commented on Aug 20, 2019

    @sf105
    sf105
    on Aug 20, 2019 via email
    Member
    More actions
    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>.
  4. tumbarumba commented on Aug 20, 2019

    @tumbarumba
    tumbarumba
    on Aug 20, 2019
    Member
    More actions

    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.

  5. shs96c commented on Aug 20, 2019

    @shs96c
    shs96c
    on Aug 20, 2019 via email
    Author
    More actions
    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.
  6. tumbarumba
    added a commit that references this issue on Aug 24, 2019

    Use different module names for hamcrest jars.

    c1ea49a
  7. tumbarumba commented on Aug 24, 2019

    @tumbarumba
    tumbarumba
    on Aug 24, 2019
    Member
    More actions

    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.

  8. tumbarumba
    closed this as completedon Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.