Skip to content

Commit aa98069

Browse files
committed
bug fixed for JSONType.ignores. for issue alibaba#1146
1 parent 4a26b68 commit aa98069

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/main/java/com/alibaba/fastjson/util/TypeUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ public static List<FieldInfo> computeGetters(Class<?> clazz, //
979979
continue;
980980
}
981981

982+
if (isJSONTypeIgnore(clazz, jsonType, propertyName)) {
983+
continue;
984+
}
985+
982986
Field field = getField(clazz, propertyName, declaredFields);
983987

984988
if (field == null) {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.alibaba.json.bvt.issue_1100;
2+
3+
import com.alibaba.fastjson.JSON;
4+
import com.alibaba.fastjson.annotation.JSONType;
5+
import junit.framework.TestCase;
6+
7+
/**
8+
* Created by wenshao on 14/04/2017.
9+
*/
10+
public class Issue1146 extends TestCase {
11+
public void test_for_issue() throws Exception {
12+
String json = JSON.toJSONString(new Test());
13+
assertEquals("{\"zzz\":true}", json);
14+
}
15+
16+
@JSONType(ignores = {"xxx", "yyy"})
17+
public static class Test {
18+
19+
public boolean isXxx() {
20+
return true;
21+
}
22+
public boolean getYyy() {
23+
return true;
24+
}
25+
public boolean getZzz() {
26+
return true;
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)