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