@@ -17,7 +17,7 @@ record RecordWithReadOnly(int id, @JsonProperty(access = Access.READ_ONLY) Strin
17
17
}
18
18
19
19
record RecordWithReadOnlyNamedProperty (int id ,
20
- @ JsonProperty (value = "name" , access = Access .READ_ONLY ) String name ) {
20
+ @ JsonProperty (value = "name" , access = Access .READ_ONLY ) String name ) {
21
21
}
22
22
23
23
record RecordWithReadOnlyAccessor (int id , String name ) {
@@ -29,8 +29,9 @@ public String name() {
29
29
}
30
30
}
31
31
32
- record RecordWithReadOnlyComponentOverriddenAccessor (int id , @ JsonProperty (access = Access .READ_ONLY ) String name ) {
33
-
32
+ record RecordWithReadOnlyComponentOverriddenAccessor (int id ,
33
+ @ JsonProperty (access = Access .READ_ONLY ) String name )
34
+ {
34
35
// @JsonProperty on overridden method is not automatically inherited by overriding method
35
36
@ Override
36
37
public String name () {
@@ -88,12 +89,14 @@ public void testSerializeReadOnlyNamedProperty() throws Exception {
88
89
}
89
90
90
91
/**
91
- * Currently documents a bug where a property was NOT ignored during deserialization if given an explicit name.
92
+ * Currently documents a bug where a property was NOT ignored during deserialization
93
+ * if given an explicit name.
92
94
* Also reproducible in 2.14.x.
93
95
*/
94
96
@ Test
95
97
public void testDeserializeReadOnlyNamedProperty () throws Exception {
96
- RecordWithReadOnlyNamedProperty value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ), RecordWithReadOnlyNamedProperty .class );
98
+ RecordWithReadOnlyNamedProperty value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ),
99
+ RecordWithReadOnlyNamedProperty .class );
97
100
assertEquals (new RecordWithReadOnlyNamedProperty (123 , "Bob" ), value ); // BUG: should be `null` instead of "Bob"
98
101
}
99
102
@@ -120,7 +123,8 @@ public void testDeserializeReadOnlyAccessor() throws Exception {
120
123
121
124
/*
122
125
/**********************************************************************
123
- /* Test methods, JsonProperty.access=READ_ONLY component, but accessor method was overridden without re-annotating with JsonProperty.access=READ_ONLY
126
+ /* Test methods, JsonProperty.access=READ_ONLY component, but accessor
127
+ * method was overridden without re-annotating with JsonProperty.access=READ_ONLY
124
128
/**********************************************************************
125
129
*/
126
130
@@ -153,7 +157,8 @@ public void testSerializeReadOnlyPrimitiveTypeProperty() throws Exception {
153
157
154
158
@ Test
155
159
public void testDeserializeReadOnlyPrimitiveTypeProperty () throws Exception {
156
- RecordWithReadOnlyPrimitiveType value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ), RecordWithReadOnlyPrimitiveType .class );
160
+ RecordWithReadOnlyPrimitiveType value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ),
161
+ RecordWithReadOnlyPrimitiveType .class );
157
162
assertEquals (new RecordWithReadOnlyPrimitiveType (0 , "Bob" ), value );
158
163
}
159
164
@@ -171,7 +176,8 @@ public void testSerializeReadOnlyAllProperties() throws Exception {
171
176
172
177
@ Test
173
178
public void testDeserializeReadOnlyAllProperties () throws Exception {
174
- RecordWithReadOnlyAll value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ), RecordWithReadOnlyAll .class );
179
+ RecordWithReadOnlyAll value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ),
180
+ RecordWithReadOnlyAll .class );
175
181
assertEquals (new RecordWithReadOnlyAll (0 , null ), value );
176
182
}
177
183
@@ -183,7 +189,8 @@ public void testSerializeReadOnlyAllProperties_WithNoArgConstructor() throws Exc
183
189
184
190
@ Test
185
191
public void testDeserializeReadOnlyAllProperties_WithNoArgConstructor () throws Exception {
186
- RecordWithReadOnlyAllAndNoArgConstructor value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ), RecordWithReadOnlyAllAndNoArgConstructor .class );
192
+ RecordWithReadOnlyAllAndNoArgConstructor value = MAPPER .readValue (a2q ("{'id':123,'name':'Bob'}" ),
193
+ RecordWithReadOnlyAllAndNoArgConstructor .class );
187
194
assertEquals (new RecordWithReadOnlyAllAndNoArgConstructor (0 , null ), value );
188
195
}
189
196
}
0 commit comments