@@ -283,6 +283,7 @@ public IRubyObject op_aref(ThreadContext context, IRubyObject vName) {
283283
284284 @ JRubyMethod (name ="[]=" )
285285 public IRubyObject op_aset (ThreadContext context , IRubyObject vName , IRubyObject value ) {
286+ checkFrozen ();
286287 String name = vName .asJavaString ();
287288 String nameWriter = name + "=" ;
288289 if (getMetaClass ().isMethodBound (nameWriter , true )) {
@@ -304,6 +305,7 @@ public RubyString indent_get(ThreadContext context) {
304305
305306 @ JRubyMethod (name ="indent=" )
306307 public IRubyObject indent_set (ThreadContext context , IRubyObject indent ) {
308+ checkFrozen ();
307309 this .indent = prepareByteList (context , indent );
308310 return indent ;
309311 }
@@ -319,6 +321,7 @@ public RubyString space_get(ThreadContext context) {
319321
320322 @ JRubyMethod (name ="space=" )
321323 public IRubyObject space_set (ThreadContext context , IRubyObject space ) {
324+ checkFrozen ();
322325 this .space = prepareByteList (context , space );
323326 return space ;
324327 }
@@ -335,6 +338,7 @@ public RubyString space_before_get(ThreadContext context) {
335338 @ JRubyMethod (name ="space_before=" )
336339 public IRubyObject space_before_set (ThreadContext context ,
337340 IRubyObject spaceBefore ) {
341+ checkFrozen ();
338342 this .spaceBefore = prepareByteList (context , spaceBefore );
339343 return spaceBefore ;
340344 }
@@ -351,6 +355,7 @@ public RubyString object_nl_get(ThreadContext context) {
351355 @ JRubyMethod (name ="object_nl=" )
352356 public IRubyObject object_nl_set (ThreadContext context ,
353357 IRubyObject objectNl ) {
358+ checkFrozen ();
354359 this .objectNl = prepareByteList (context , objectNl );
355360 return objectNl ;
356361 }
@@ -367,6 +372,7 @@ public RubyString array_nl_get(ThreadContext context) {
367372 @ JRubyMethod (name ="array_nl=" )
368373 public IRubyObject array_nl_set (ThreadContext context ,
369374 IRubyObject arrayNl ) {
375+ checkFrozen ();
370376 this .arrayNl = prepareByteList (context , arrayNl );
371377 return arrayNl ;
372378 }
@@ -382,6 +388,7 @@ public IRubyObject as_json_get(ThreadContext context) {
382388
383389 @ JRubyMethod (name ="as_json=" )
384390 public IRubyObject as_json_set (ThreadContext context , IRubyObject asJSON ) {
391+ checkFrozen ();
385392 if (asJSON .isNil () || asJSON == context .getRuntime ().getFalse ()) {
386393 this .asJSON = null ;
387394 } else {
@@ -402,6 +409,7 @@ public RubyInteger max_nesting_get(ThreadContext context) {
402409
403410 @ JRubyMethod (name ="max_nesting=" )
404411 public IRubyObject max_nesting_set (IRubyObject max_nesting ) {
412+ checkFrozen ();
405413 maxNesting = RubyNumeric .fix2int (max_nesting );
406414 return max_nesting ;
407415 }
@@ -420,6 +428,7 @@ public RubyBoolean script_safe_get(ThreadContext context) {
420428
421429 @ JRubyMethod (name ="script_safe=" , alias ="escape_slash=" )
422430 public IRubyObject script_safe_set (IRubyObject script_safe ) {
431+ checkFrozen ();
423432 scriptSafe = script_safe .isTrue ();
424433 return script_safe .getRuntime ().newBoolean (scriptSafe );
425434 }
@@ -443,6 +452,7 @@ public RubyBoolean strict_get(ThreadContext context) {
443452
444453 @ JRubyMethod (name ="strict=" )
445454 public IRubyObject strict_set (IRubyObject isStrict ) {
455+ checkFrozen ();
446456 strict = isStrict .isTrue ();
447457 return isStrict .getRuntime ().newBoolean (strict );
448458 }
@@ -472,6 +482,7 @@ public RubyInteger buffer_initial_length_get(ThreadContext context) {
472482
473483 @ JRubyMethod (name ="buffer_initial_length=" )
474484 public IRubyObject buffer_initial_length_set (IRubyObject buffer_initial_length ) {
485+ checkFrozen ();
475486 int newLength = RubyNumeric .fix2int (buffer_initial_length );
476487 if (newLength > 0 ) bufferInitialLength = newLength ;
477488 return buffer_initial_length ;
@@ -488,6 +499,7 @@ public RubyInteger depth_get(ThreadContext context) {
488499
489500 @ JRubyMethod (name ="depth=" )
490501 public IRubyObject depth_set (IRubyObject vDepth ) {
502+ checkFrozen ();
491503 depth = RubyNumeric .fix2int (vDepth );
492504 return vDepth ;
493505 }
@@ -532,6 +544,7 @@ public boolean getDeprecateDuplicateKey() {
532544 */
533545 @ JRubyMethod (visibility =Visibility .PRIVATE )
534546 public IRubyObject _configure (ThreadContext context , IRubyObject vOpts ) {
547+ checkFrozen ();
535548 OptionsReader opts = new OptionsReader (context , vOpts );
536549
537550 ByteList indent = opts .getString ("indent" );
0 commit comments