5050import org .jruby .rack .RackException ;
5151import org .jruby .rack .RackResponse ;
5252import org .jruby .rack .RackResponseEnvironment ;
53- import org .jruby .runtime .Arity ;
5453import org .jruby .runtime .Block ;
5554import org .jruby .runtime .BlockBody ;
5655import org .jruby .runtime .Helpers ;
5756import org .jruby .runtime .JavaInternalBlockBody ;
5857import org .jruby .runtime .ObjectAllocator ;
58+ import org .jruby .runtime .Signature ;
5959import org .jruby .runtime .ThreadContext ;
6060import org .jruby .runtime .Visibility ;
6161import org .jruby .runtime .builtin .IRubyObject ;
@@ -93,7 +93,7 @@ public static IRubyObject is_swallow_client_abort(final ThreadContext context, f
9393 @ JRubyMethod (name = "swallow_client_abort=" , meta = true , required = 1 )
9494 public static IRubyObject set_swallow_client_abort (final IRubyObject self , final IRubyObject value ) {
9595 if ( value instanceof RubyBoolean ) {
96- swallowClientAbort = (( RubyBoolean ) value ) .isTrue ();
96+ swallowClientAbort = value .isTrue ();
9797 }
9898 else {
9999 swallowClientAbort = ! value .isNil ();
@@ -124,7 +124,7 @@ public static IRubyObject is_dechunk(final ThreadContext context, final IRubyObj
124124 @ JRubyMethod (name = "dechunk=" , meta = true , required = 1 )
125125 public static IRubyObject set_dechunk (final IRubyObject self , final IRubyObject value ) {
126126 if ( value instanceof RubyBoolean ) {
127- dechunk = (( RubyBoolean ) value ) .isTrue ();
127+ dechunk = value .isTrue ();
128128 }
129129 else {
130130 dechunk = ! value .isNil ();
@@ -138,7 +138,7 @@ public static IRubyObject set_dechunk(final IRubyObject self, final IRubyObject
138138 * Returns the channel chunk size to be used e.g. when a (send) file
139139 * response is detected. By setting this value to nil you force an "explicit"
140140 * byte buffer to be used when copying between channels.
141- *
141+ * <p>
142142 * Note: High values won't hurt when sending small files since most Java
143143 * (file) channel implementations handle this gracefully. However if you're
144144 * on Windows it is recommended to not set this higher than the "magic"
@@ -169,7 +169,7 @@ public static IRubyObject set_channel_chunk_size(final IRubyObject self, final I
169169 }
170170 else {
171171 final long val = value .convertToInteger ("to_i" ).getLongValue ();
172- channelChunkSize = Integer . valueOf (( int ) val ) ;
172+ channelChunkSize = ( int ) val ;
173173 }
174174 return value ;
175175 }
@@ -204,7 +204,7 @@ public static IRubyObject set_channel_buffer_size(final IRubyObject self, final
204204 }
205205 else {
206206 final long val = value .convertToInteger ("to_i" ).getLongValue ();
207- channelBufferSize = Integer . valueOf (( int ) val ) ;
207+ channelBufferSize = ( int ) val ;
208208 }
209209 return value ;
210210 }
@@ -228,7 +228,7 @@ protected Response(Ruby runtime, RubyClass metaClass) {
228228 @ JRubyMethod (required = 1 )
229229 public IRubyObject initialize (final ThreadContext context , final IRubyObject arg ) {
230230 if ( arg instanceof RubyArray ) {
231- final RubyArray arr = (RubyArray ) arg ;
231+ final RubyArray <?> arr = (RubyArray <?> ) arg ;
232232 if ( arr .size () < 3 ) {
233233 throw context .runtime .newArgumentError ("expected 3 array elements (rack-respose)" );
234234 }
@@ -297,10 +297,10 @@ public String getBody() {
297297 try {
298298 final StringBuilder bodyParts = new StringBuilder ();
299299 invoke (context , this .body , "each" ,
300- new JavaInternalBlockBody (context .runtime , Arity .ONE_REQUIRED ) {
300+ new JavaInternalBlockBody (context .runtime , Signature .ONE_REQUIRED ) {
301301 @ Override
302302 public IRubyObject yield (ThreadContext context , IRubyObject [] args ) {
303- return yield (context , args [0 ]);
303+ return this . yield (context , args [0 ]);
304304 }
305305
306306 @ Override
@@ -347,7 +347,7 @@ public void respond(final RackResponseEnvironment response) throws RackException
347347
348348 @ JRubyMethod (name = "write_status" )
349349 public IRubyObject write_status (final ThreadContext context , final IRubyObject response ) {
350- writeStatus ( ( RackResponseEnvironment ) response .toJava (RackResponseEnvironment .class ) );
350+ writeStatus (response .toJava (RackResponseEnvironment .class ));
351351 return context .nil ;
352352 }
353353
@@ -358,7 +358,7 @@ protected void writeStatus(final RackResponseEnvironment response) {
358358 @ JRubyMethod (name = "write_headers" )
359359 public IRubyObject write_headers (final ThreadContext context , final IRubyObject response )
360360 throws IOException {
361- writeHeaders ( ( RackResponseEnvironment ) response .toJava (RackResponseEnvironment .class ) );
361+ writeHeaders (response .toJava (RackResponseEnvironment .class ));
362362 return context .nil ;
363363 }
364364
@@ -394,10 +394,10 @@ public void visit(final IRubyObject key, final IRubyObject val) {
394394 final RubyString newLine = RubyString .newString (context .runtime , NEW_LINE );
395395 // value.each_line { |val| response.addHeader(key.to_s, val.chomp("\n")) }
396396 invoke (context , val , each_line ? "each_line" : "each" ,
397- new JavaInternalBlockBody (context .runtime , Arity .ONE_REQUIRED ) {
397+ new JavaInternalBlockBody (context .runtime , Signature .ONE_REQUIRED ) {
398398 @ Override
399399 public IRubyObject yield (ThreadContext context , IRubyObject [] args ) {
400- return yield (context , args [0 ]);
400+ return this . yield (context , args [0 ]);
401401 }
402402
403403 @ Override
@@ -430,7 +430,7 @@ else if ( val instanceof RubyTime ) {
430430 @ JRubyMethod (name = "write_body" )
431431 public IRubyObject write_body (final ThreadContext context , final IRubyObject response )
432432 throws IOException {
433- writeBody ( ( RackResponseEnvironment ) response .toJava (RackResponseEnvironment .class ) );
433+ writeBody (response .toJava (RackResponseEnvironment .class ));
434434 return context .nil ;
435435 }
436436
@@ -463,7 +463,7 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept
463463 else {
464464 final ThreadContext context = currentContext ();
465465 final IRubyObject channel = body .callMethod (context , "to_channel" );
466- bodyChannel = ( Channel ) channel .toJava (Channel .class );
466+ bodyChannel = channel .toJava (Channel .class );
467467 }
468468 if ( bodyChannel instanceof FileChannel ) {
469469 transferChannel ( (FileChannel ) bodyChannel , response .getOutputStream () );
@@ -486,10 +486,10 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept
486486 final String method = body .respondsTo ("each_line" ) ? "each_line" : "each" ;
487487 try {
488488 invoke (context , body , method ,
489- new JavaInternalBlockBody (context .runtime , Arity .ONE_REQUIRED ) {
489+ new JavaInternalBlockBody (context .runtime , Signature .ONE_REQUIRED ) {
490490 @ Override
491491 public IRubyObject yield (ThreadContext context , IRubyObject [] args ) {
492- return yield (context , args [0 ]);
492+ return this . yield (context , args [0 ]);
493493 }
494494
495495 @ Override
0 commit comments