aws / aws/aws-lambda-java-libs
Bug: JSON serialization ignores fields from child classes (Java 8 Lambda runtime works, Java 11 Lambda runtime fails)
- 主要語言
- Java
- 星號
- 548
- 分支
- 241
- 平均合併
- 2 天 5 分鐘
- 30 天內合併 PR
- 11
描述
I noticed this issue when updating my lambda function from Java 8 to Java 11, and it seems to be related to the code in this repository.
The problematic situation occurs when a lambda function declares that it returns `TestParent`, but actually returns an instance of `TestChild`:
```java
public class TestParent {
public String parentField = "parentField";
}
public class TestChild extends TestParent {
public String childField = "childField";
}
```
To reproduce the issue, please run the attached test case (maven project): [aws-lambda-json-child-field-bug.zip](https://github.com/aws/aws-lambda-java-libs/files/9210528/aws-lambda-json-child-field-bug.zip)
It should fail with an error like below:
```
org.junit.ComparisonFailure:
Expected :{"parentField":"parentField","childField":"childField"}
Actual :{"parentField":"parentField"}
```
You can see that the fields from `TestChild` are missing. This is the issue, and this seems to be new -- in the Java 8 lambda runtime this worked ok.
Thanks for any help!
貢獻指南
研究方向
首先,在 Java 11 Lambda 執行環境上執行隨附的 aws-lambda-json-child-field-bug.zip Maven 測試案例,並與 Java 8 進行比較。追蹤測試所使用的 JSON 序列化進入點;當序列化後的 TestChild 執行個體同時包含 parentField 和 childField 時即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- aws, java
- 領域
- cloud
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100