Skip to content

Commit dc63608

Browse files
siuankwenshao
authored andcommitted
Exclude some fields in proguard rule which would be affected by reflection op
1 parent c8582b5 commit dc63608

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/src/main/resources/META-INF/proguard/fastjson2.pro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,18 @@
2424
# Keep any (anonymous) classes extending TypeReference
2525
-keep, allowobfuscation class com.alibaba.fastjson2.TypeReference
2626
-keep, allowobfuscation class * extends com.alibaba.fastjson2.TypeReference
27+
28+
# Don't rename/shrink the following class fields, as they are accessed by internal reflection tool *AtomicReferenceFieldUpdater*
29+
# They should always be described by "volatile" modifier, if not, please report an issue
30+
-keepclassmembers class com.alibaba.fastjson2.JSONFactory$CacheItem {
31+
volatile <fields>;
32+
}
33+
-keepclassmembers class com.alibaba.fastjson2.util.TypeUtils$Cache {
34+
volatile <fields>;
35+
}
36+
-keepclassmembers class com.alibaba.fastjson2.writer.FieldWriter {
37+
volatile com.alibaba.fastjson2.writer.ObjectWriter initObjectWriter;
38+
}
39+
-keepclassmembers class com.alibaba.fastjson2.writer.FieldWriterObject {
40+
volatile java.lang.Class initValueClass;
41+
}

0 commit comments

Comments
 (0)