Skip to content
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

resource: Defer SHA-256 calculation into the future #5323

Merged
merged 4 commits into from Jul 19, 2022

Commits on Jul 19, 2022

  1. resource: Defer SHA-256 calculation into the future

    The osgi.content capability must hold the SHA-256 value of the
    resource. But this value is rarely used. So, when building a resource
    from a file, we defer the SHA-256 calculation until actually needed.
    The can help performance of FileSetRepository used by bndtools m2e.
    
    However, we do need the hashCode of the SHA-256 value early, so use
    a substitute hashCode value based upon the File object. This is not
    perfect since two files can hold identical content and the hashCode of
    their SHA-256 values should be identical. But in practice, this should
    work when creating a resource from a file since the early need for the
    hashCode of the SHA-256 value is in the computing of the hashCode of
    the capability so it can be inserted in a set. But creating a resource
    from a file only creates a single osgi.content capability.
    
    Fixes bndtools#5322
    
    Signed-off-by: BJ Hargrave <bj@hargrave.dev>
    bjhargrave committed Jul 19, 2022
    Copy the full SHA
    da892e6 View commit details
    Browse the repository at this point in the history
  2. unmodifiable: Optimization for copyOf a Set

    When we know the input is a Set, we don't need to remove any duplicates.
    
    Signed-off-by: BJ Hargrave <bj@hargrave.dev>
    bjhargrave committed Jul 19, 2022
    Copy the full SHA
    56ee3ca View commit details
    Browse the repository at this point in the history
  3. resource: Use unmodifiable package

    Signed-off-by: BJ Hargrave <bj@hargrave.dev>
    bjhargrave committed Jul 19, 2022
    Copy the full SHA
    f7aaf0d View commit details
    Browse the repository at this point in the history
  4. unmodifiable: Add stream collectors to Sets and Lists

    Signed-off-by: BJ Hargrave <bj@hargrave.dev>
    bjhargrave committed Jul 19, 2022
    Copy the full SHA
    038f0b8 View commit details
    Browse the repository at this point in the history