Skip to content

Conversation

IrvingOS
Copy link
Contributor

  • Change the cast target from WeakReference<Object> to WeakEntry in WeakCache.class.
  • Change the cast target from SoftReference<Object> to SoftEntry in SoftCache.class.

Because I don't think it's necessary to convert delegate.get(key) to WeakReference or SoftReference and then suppress the warning with @SuppressWarnings("unchecked").
If my idea is wrong, please point it out.
Thanks!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 87.316% when pulling 358e96b on IrvingOS:change-cast-target into 78d821f on mybatis:master.

Copy link
Member

@harawata harawata left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, @IrvingOS !

The code is implemented against Weak/SoftReference, so we should not use the subclasses here.
You should be able to remove @SuppressWarning by using the wild card. e.g. SoftReference<?>

FYI, you can update this PR by adding/pushing new commits to the same branch.

@IrvingOS
Copy link
Contributor Author

Thanks so much for your early reply, @harawata .

@IrvingOS IrvingOS closed this Aug 15, 2022
@IrvingOS IrvingOS deleted the change-cast-target branch August 15, 2022 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants