Skip to content

feat: generic type support for attachable #5

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

Merged
merged 1 commit into from
May 4, 2023

Conversation

driventokill
Copy link
Member

The attachable implementation uses String as key type. If someone selects the same string in the top layer, the value will be shaded in the lower layer.

Although we can isolate using the namespace of a string, it is not an absolute security guarantee. Adding generics does not impose a burden on using a string as the key type, but it should be noted that the current default implementation uses a hash map for storage, which requires the key to meet the requirements of the hash map for the key type.

Resolves: #4

The attachable implementation uses String as key type.
If someone selects the same string in the top layer,
the value will be shaded in the lower layer.

Although we can isolate using the namespace of a string,
it is not an absolute security guarantee. Adding generics
does not impose a burden on using a string as the key type,
but it should be noted that the current default implementation
uses a hash map for storage, which requires the key to meet
the requirements of the hash map for the key type.

Resolves: #4
@driventokill driventokill requested a review from oldratlee May 4, 2023 14:56
@driventokill driventokill self-assigned this May 4, 2023
@codecov
Copy link

codecov bot commented May 4, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (0f91f7f) 100.00% compared to head (e2106d3) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##                main        #5   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        11        11           
===========================================
  Files              2         2           
  Lines             14        14           
  Branches           3         3           
===========================================
  Hits              14        14           
Impacted Files Coverage Δ
...java/io/foldright/inspectablewrappers/Wrapper.java 100.00% <100.00%> (ø)
.../inspectablewrappers/utils/AttachableDelegate.java 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@driventokill driventokill added the enhancement New feature or request label May 4, 2023
Copy link
Member

@oldratlee oldratlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oldratlee oldratlee merged commit df45499 into main May 4, 2023
@driventokill driventokill deleted the feature/attachable-generics branch May 5, 2023 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Whether the key of Attachable should support type information to prevent collision?
2 participants