Return unsigned data bytes from InputStream.read()

Proprietary

Mask a directly returned byte-array element with 0xff in an override of InputStream.read(). The contract returns data in the range 0 through 255 and reserves -1 for end of stream; promoting a signed byte can return negative data and mistake 0xff for EOF. Only direct primitive byte-array accesses are changed. Variables and helper calls that may represent EOF, other methods, bulk reads, casts, likely test sources and returns inside lambdas are left alone.

io.moderne.staticanalysis.UnsignedByteFromInputStream
mod run . --recipe=io.moderne.staticanalysis.UnsignedByteFromInputStream

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.