-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serialize skip thrift generate isSetXXX method
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
core/src/test/java/com/alibaba/fastjson2/issues/Issue707.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.alibaba.fastjson2.issues; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue707 { | ||
@Test | ||
public void test() { | ||
Bean bean = new Bean(); | ||
String str = JSON.toJSONString(bean); | ||
assertEquals("{\"id\":0}", str); | ||
} | ||
|
||
public static class Bean { | ||
private int flags; | ||
private int id; | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
flags |= 1; | ||
this.id = id; | ||
} | ||
|
||
public boolean isSetId() { | ||
return (flags & 1) == 0; | ||
} | ||
|
||
public void unsetId() { | ||
flags = 0; | ||
} | ||
} | ||
} |