@@ -52,9 +52,11 @@ public Fields serialize(Object object) {
52
52
if (!SUPPORTED_CLASSES .contains (object .getClass ()))
53
53
throw new IllegalArgumentException ();
54
54
Fields fields = new Fields ();
55
- if (object instanceof Collection <?> collection ) {
55
+ if (object instanceof Collection <?>) {
56
+ Collection <?> collection = (Collection <?>) object ;
56
57
fields .putObject ("values" , collection .toArray ());
57
- } else if (object instanceof Map <?, ?> map ) {
58
+ } else if (object instanceof Map <?, ?>) {
59
+ Map <?, ?> map = (Map <?, ?>) object ;
58
60
fields .putObject ("keys" , map .keySet ().toArray ());
59
61
fields .putObject ("values" , map .values ().toArray ());
60
62
} else if (object instanceof UUID ) {
@@ -91,13 +93,15 @@ public <T> T newInstance(Class<T> type) {
91
93
@ Override
92
94
public void deserialize (Object object , Fields fields ) throws StreamCorruptedException {
93
95
try {
94
- if (object instanceof Collection <?> collection ) {
96
+ if (object instanceof Collection <?>) {
97
+ Collection <?> collection = (Collection <?>) object ;
95
98
Object [] values = fields .getObject ("values" , Object [].class );
96
99
if (values == null )
97
100
throw new StreamCorruptedException ();
98
101
collection .addAll ((Collection ) Arrays .asList (values ));
99
102
return ;
100
- } else if (object instanceof Map <?, ?> map ) {
103
+ } else if (object instanceof Map <?, ?>) {
104
+ Map <?, ?> map = (Map <?, ?>) object ;
101
105
Object [] keys = fields .getObject ("keys" , Object [].class ), values = fields .getObject ("values" , Object [].class );
102
106
if (keys == null || values == null || keys .length != values .length )
103
107
throw new StreamCorruptedException ();
0 commit comments