[BUG]使用fastjson2的contains方法判断list类型的内容,输出错误
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
在使用fastjson2的contains方法判断list类型的内容,输出错误
### 环境信息
*请填写以下信息:*
- OS信息: NA
- JDK信息:Openjdk 21.0.5
- 版本信息:Fastjson2 2.0.57
### 重现步骤
*如何操作可以重现该问题:*
1. 使用 `JSONPath.contains` 方法
2. 输入 `$.classes[?(@.className == 'yingyu')]` 数据
3. 出现 `true` 错误
4.
```java
public static void main(String[] args) {
String jsonStr = "{\"classes\":[{\"className\":\"yuwen\"},{\"className\":\"shuxue\"}]}";
Object test = com.alibaba.fastjson2.JSON.parse(jsonStr);
System.out.println(com.alibaba.fastjson2.JSONPath.contains(test, "$.classes[?(@.className == 'yuwen')]")); // true
System.out.println(com.alibaba.fastjson2.JSONPath.contains(test, "$.classes[?(@.className == 'shuxue')]")); // true
System.out.println(com.alibaba.fastjson2.JSONPath.contains(test, "$.classes[?(@.className == 'yingyu')]")); // 期望为false,实际为true
}
```
### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*
className == 'yuwen'场景为true
className == 'shuxue'场景为true
className == 'yingyu'场景为false
### 相关日志输出
*请复制并粘贴任何相关的日志输出。*
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start by running the Java reproduction against JSONPath.contains with the provided JSON and three className expressions. Trace the JSONPath.contains entry point and the filtering expression handling; done means yuwen and shuxue return true while yingyu returns false.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100