alibaba / alibaba/jetcache

@Cached#postCondition条件报错

Open
#405 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

`
@Cached(name = "jetCache:getListById:", key = "#id", expire = 60,
postCondition = "#result != null && #result.size() != 0")

public List getListById(Integer id) {
if (Objects.isNull(id)) {
return Collections.emptyList();
}
return iXXInterface.getXXListById(id);
}
`
当返回 Collections.emptyList()时,报错 EmptyList不能转成 ArrayList

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the @Cached annotation's postCondition handling and reproduce the issue using getListById(Integer id), especially when it returns Collections.emptyList(). Done means the postCondition no longer causes an EmptyList-to-ArrayList conversion error for this return value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.