@@ -96,7 +96,7 @@ enum UnknownNumberParsing {
9696 final int maxNumberDigits ;
9797 private final int maxStringBuffer ;
9898
99- public JParser (
99+ public JParser (
100100 final char [] tmp ,
101101 final byte [] buffer ,
102102 final int length ,
@@ -125,7 +125,7 @@ public JParser(
125125 * It will release reference to provided byte[] or InputStream input
126126 */
127127 @ Override
128- public void close () {
128+ public final void close () {
129129 buffer = originalBuffer ;
130130 bufferLenWithExtraSpace = originalBufferLenWithExtraSpace ;
131131 last = ' ' ;
@@ -137,7 +137,7 @@ public void close() {
137137 }
138138
139139 @ Override
140- public JParser process (final InputStream newStream ) {
140+ public final JParser process (final InputStream newStream ) {
141141 nameStack .clear ();
142142 currentPosition = 0 ;
143143 currentIndex = 0 ;
@@ -152,7 +152,7 @@ public JParser process(final InputStream newStream) {
152152 }
153153
154154 @ Override
155- public JParser process (final byte [] newBuffer , final int newLength ) {
155+ public final JParser process (final byte [] newBuffer , final int newLength ) {
156156 if (newBuffer != null ) {
157157 buffer = newBuffer ;
158158 bufferLenWithExtraSpace = buffer .length - 38 ; // maximum padding is for uuid
@@ -171,12 +171,12 @@ public JParser process(final byte[] newBuffer, final int newLength) {
171171 /**
172172 * Valid length of the input buffer.
173173 */
174- int length () {
174+ final int length () {
175175 return length ;
176176 }
177177
178178 @ Override
179- public String toString () {
179+ public final String toString () {
180180 return new String (buffer , 0 , length , utf8 );
181181 }
182182
@@ -195,7 +195,7 @@ private static int readFully(final byte[] buffer, final InputStream stream, fina
195195
196196 private static class EmptyEOFException extends EOFException {
197197
198- static final long serialVersionUID = 1L ;
198+ private static final long serialVersionUID = 1L ;
199199
200200 @ Override
201201 public Throwable fillInStackTrace () {
@@ -245,7 +245,7 @@ private int prepareNextBlock() {
245245 return available ;
246246 }
247247
248- boolean isEndOfStream () {
248+ final boolean isEndOfStream () {
249249 if (stream == null ) {
250250 return length == currentIndex ;
251251 }
@@ -262,12 +262,12 @@ boolean isEndOfStream() {
262262 * @return which was the last byte read
263263 */
264264 @ Override
265- public byte currentToken () {
265+ public final byte currentToken () {
266266 return currentIndex == 0 ? nextToken () : last ;
267267 }
268268
269269 @ Override
270- public String location () {
270+ public final String location () {
271271 final StringBuilder error = new StringBuilder (60 );
272272 positionDescription (0 , error );
273273 return error .toString ();
@@ -297,11 +297,11 @@ private void positionDescription(int offset, StringBuilder error) {
297297 }
298298 }
299299
300- int getCurrentIndex () {
300+ final int getCurrentIndex () {
301301 return currentIndex ;
302302 }
303303
304- int scanNumber () {
304+ final int scanNumber () {
305305 tokenStart = currentIndex - 1 ;
306306 int i = 1 ;
307307 int ci = currentIndex ;
@@ -316,7 +316,7 @@ int scanNumber() {
316316 return tokenStart ;
317317 }
318318
319- char [] prepareBuffer (final int start , final int len ) {
319+ final char [] prepareBuffer (final int start , final int len ) {
320320 if (len > maxNumberDigits ) {
321321 throw newParseErrorWith ("Too many digits detected in number" , len , "Too many digits detected in number" , len , "" );
322322 }
@@ -331,15 +331,15 @@ char[] prepareBuffer(final int start, final int len) {
331331 return _tmp ;
332332 }
333333
334- boolean allWhitespace (final int start , final int end ) {
334+ final boolean allWhitespace (final int start , final int end ) {
335335 final byte [] _buf = buffer ;
336336 for (int i = start ; i < end ; i ++) {
337337 if (!WHITESPACE [_buf [i ] + 128 ]) return false ;
338338 }
339339 return true ;
340340 }
341341
342- int findNonWhitespace (final int end ) {
342+ final int findNonWhitespace (final int end ) {
343343 final byte [] _buf = buffer ;
344344 for (int i = end - 1 ; i > 0 ; i --) {
345345 if (!WHITESPACE [_buf [i ] + 128 ]) return i + 1 ;
@@ -353,7 +353,7 @@ int findNonWhitespace(final int end) {
353353 *
354354 * @return temporary buffer
355355 */
356- char [] readSimpleQuote () {
356+ final char [] readSimpleQuote () {
357357 if (last != '"' ) throw newParseError ("Expecting '\" ' for string start" );
358358 int ci = tokenStart = currentIndex ;
359359 try {
@@ -371,40 +371,40 @@ char[] readSimpleQuote() {
371371 }
372372
373373 @ Override
374- public int readInt () {
374+ public final int readInt () {
375375 if (isNullValue ()) return 0 ;
376376 return NumberParser .deserializeInt (this );
377377 }
378378
379379 @ Override
380- public long readLong () {
380+ public final long readLong () {
381381 if (isNullValue ()) return 0L ;
382382 return NumberParser .deserializeLong (this );
383383 }
384384
385385 @ Override
386- public short readShort () {
386+ public final short readShort () {
387387 return NumberParser .deserializeShort (this );
388388 }
389389
390390 @ Override
391- public double readDouble () {
391+ public final double readDouble () {
392392 if (isNullValue ()) return 0D ;
393393 return NumberParser .deserializeDouble (this );
394394 }
395395
396396 @ Override
397- public BigDecimal readDecimal () {
397+ public final BigDecimal readDecimal () {
398398 return NumberParser .deserializeDecimal (this );
399399 }
400400
401401 @ Override
402- public BigInteger readBigInteger () {
402+ public final BigInteger readBigInteger () {
403403 return NumberParser .deserializeBigInt (this );
404404 }
405405
406406 @ Override
407- public boolean readBoolean () {
407+ public final boolean readBoolean () {
408408 if (wasTrue ()) {
409409 return true ;
410410 } else if (wasFalse () || isNullValue ()) {
@@ -422,13 +422,13 @@ public boolean readBoolean() {
422422 * @return parsed string
423423 */
424424 @ Override
425- public String readString () {
425+ public final String readString () {
426426 final int len = parseString ();
427427 //return valuesCache == null ? new String(chars, 0, len) : valuesCache.get(chars, len);
428428 return new String (chars , 0 , len );
429429 }
430430
431- int parseString () {
431+ final int parseString () {
432432 final int startIndex = currentIndex ;
433433 if (last != '"' ) throw newParseError ("Expecting '\" ' for string start" );
434434 else if (currentIndex == length ) throw newParseErrorAt ("Premature end of JSON string" , 0 );
@@ -633,7 +633,7 @@ private boolean wasWhiteSpace() {
633633 }
634634
635635 @ Override
636- public boolean hasNextStreamElement () {
636+ public final boolean hasNextStreamElement () {
637637 if (currentIndex >= length ) {
638638 return false ;
639639 }
@@ -651,7 +651,7 @@ public boolean hasNextStreamElement() {
651651 }
652652
653653 @ Override
654- public boolean hasNextElement () {
654+ public final boolean hasNextElement () {
655655 if (currentIndex >= length ) {
656656 return false ;
657657 }
@@ -677,7 +677,7 @@ public boolean hasNextElement() {
677677 * @return next non-whitespace byte in the JSON input
678678 */
679679 @ Override
680- public byte nextToken () {
680+ public final byte nextToken () {
681681 read ();
682682 if (WHITESPACE [last + 128 ]) {
683683 while (wasWhiteSpace ()) {
@@ -687,11 +687,11 @@ public byte nextToken() {
687687 return last ;
688688 }
689689
690- long positionInStream (final int offset ) {
690+ final long positionInStream (final int offset ) {
691691 return currentPosition + currentIndex - offset ;
692692 }
693693
694- int calcHash () {
694+ final int calcHash () {
695695 if (last != '"' ) throw newParseError ("Expecting '\" ' for attribute name start" );
696696 tokenStart = currentIndex ;
697697 int ci = currentIndex ;
@@ -784,7 +784,7 @@ private byte skipString() {
784784 }
785785
786786 @ Override
787- public String readRaw () {
787+ public final String readRaw () {
788788 readRawStartPosition = currentIndex - 1 ;
789789 if (stream != null ) {
790790 readRawBuffer = new ByteArrayOutputStream ();
@@ -805,7 +805,7 @@ public String readRaw() {
805805 }
806806
807807 @ Override
808- public void skipValue () {
808+ public final void skipValue () {
809809 skipNextValue ();
810810 // go back one as nextToken() is called next
811811 last = buffer [--currentIndex ];
@@ -881,7 +881,7 @@ private byte skipObject() {
881881 }
882882
883883 @ Override
884- public byte [] readBinary () {
884+ public final byte [] readBinary () {
885885 if (stream != null && Base64 .findEnd (buffer , currentIndex ) == buffer .length ) {
886886 final int len = parseString ();
887887 final byte [] input = new byte [len ];
@@ -899,7 +899,7 @@ public byte[] readBinary() {
899899 }
900900
901901 @ Override
902- public String nextField () {
902+ public final String nextField () {
903903 if (currentNames != null ) {
904904 final int hash = calcHash ();
905905 String key = currentNames .lookup (hash );
@@ -927,7 +927,7 @@ private String readKey() {
927927 }
928928
929929 @ Override
930- public boolean isNullValue () {
930+ public final boolean isNullValue () {
931931 if (last == 'n' ) {
932932 if (currentIndex + 2 < length
933933 && buffer [currentIndex ] == 'u'
@@ -980,7 +980,7 @@ private boolean wasFalse() {
980980 }
981981
982982 @ Override
983- public void startStream () {
983+ public final void startStream () {
984984 if (last == '[' ) return ;
985985 if (last == '{' ) {
986986 // go back one
@@ -999,15 +999,15 @@ public void startStream() {
999999 }
10001000
10011001 @ Override
1002- public void endStream () {
1002+ public final void endStream () {
10031003 // do nothing
10041004 }
10051005
10061006 /**
10071007 * Parse array start
10081008 */
10091009 @ Override
1010- public void startArray () {
1010+ public final void startArray () {
10111011 if (last != '[' && nextToken () != '[' ) {
10121012 if (currentIndex >= length ) throw newParseErrorAt ("Unexpected end in JSON" , 0 , eof );
10131013 throw newParseError ("Expecting '[' as array start" );
@@ -1018,7 +1018,7 @@ public void startArray() {
10181018 * Parse array end
10191019 */
10201020 @ Override
1021- public void endArray () {
1021+ public final void endArray () {
10221022 if (last != ']' && nextToken () != ']' ) {
10231023 if (currentIndex >= length ) throw newParseErrorAt ("Unexpected end in JSON" , 0 , eof );
10241024 throw newParseError ("Expecting ']' as array end" );
@@ -1036,7 +1036,7 @@ private void readStartObject() {
10361036 }
10371037
10381038 @ Override
1039- public void startObject () {
1039+ public final void startObject () {
10401040 readStartObject ();
10411041 if (currentNames != null ) {
10421042 nameStack .addFirst (currentNames );
@@ -1045,7 +1045,7 @@ public void startObject() {
10451045 }
10461046
10471047 @ Override
1048- public void startObject (final JsonNames names ) {
1048+ public final void startObject (final JsonNames names ) {
10491049 readStartObject ();
10501050 if (currentNames != null ) {
10511051 nameStack .addFirst (currentNames );
@@ -1057,7 +1057,7 @@ public void startObject(final JsonNames names) {
10571057 * Ensure object end
10581058 */
10591059 @ Override
1060- public void endObject () {
1060+ public final void endObject () {
10611061 currentNames = nameStack .pollFirst ();
10621062 if (last != '}' && nextToken () != '}' ) {
10631063 if (currentIndex >= length ) throw newParseErrorAt ("Unexpected end in JSON" , 0 , eof );
@@ -1068,7 +1068,7 @@ public void endObject() {
10681068 private final StringBuilder error = new StringBuilder (0 );
10691069 private final Formatter errorFormatter = new Formatter (error );
10701070
1071- JsonDataException newParseError (final String description ) {
1071+ final JsonDataException newParseError (final String description ) {
10721072 error .setLength (0 );
10731073 error .append (description );
10741074 error .append (", instead found '" );
@@ -1083,7 +1083,7 @@ private String errorMessage() {
10831083 return error .toString ().replace ("\n " , "\\ n" );
10841084 }
10851085
1086- JsonDataException newParseErrorAt (final String description , final int offset ) {
1086+ final JsonDataException newParseErrorAt (final String description , final int offset ) {
10871087 if (errorInfo == ErrorInfo .MINIMAL || errorInfo == ErrorInfo .DESCRIPTION_ONLY ) {
10881088 return new JsonDataException (description );
10891089 }
@@ -1094,7 +1094,7 @@ JsonDataException newParseErrorAt(final String description, final int offset) {
10941094 return new JsonDataException (errorMessage ());
10951095 }
10961096
1097- JsonDataException newParseErrorAt (final String description , final int offset , final Exception cause ) {
1097+ final JsonDataException newParseErrorAt (final String description , final int offset , final Exception cause ) {
10981098 if (cause == null ) throw new IllegalArgumentException ("cause can't be null" );
10991099 if (errorInfo == ErrorInfo .MINIMAL ) return new JsonDataException (description , cause );
11001100 error .setLength (0 );
@@ -1113,7 +1113,7 @@ JsonDataException newParseErrorAt(final String description, final int offset, fi
11131113 return new JsonDataException (errorMessage ());
11141114 }
11151115
1116- JsonDataException newParseErrorFormat (final String description , final int offset , final String extraFormat , Object ... args ) {
1116+ final JsonDataException newParseErrorFormat (final String description , final int offset , final String extraFormat , Object ... args ) {
11171117 if (errorInfo == ErrorInfo .MINIMAL ) return new JsonDataException (description );
11181118 error .setLength (0 );
11191119 errorFormatter .format (extraFormat , args );
@@ -1123,11 +1123,11 @@ JsonDataException newParseErrorFormat(final String description, final int offset
11231123 return new JsonDataException (errorMessage ());
11241124 }
11251125
1126- JsonDataException newParseErrorWith (String description , Object argument ) {
1126+ final JsonDataException newParseErrorWith (String description , Object argument ) {
11271127 return newParseErrorWith (description , 0 , description , argument , "" );
11281128 }
11291129
1130- JsonDataException newParseErrorWith (String description , int offset , String extra , Object extraArgument , String extraSuffix ) {
1130+ final JsonDataException newParseErrorWith (String description , int offset , String extra , Object extraArgument , String extraSuffix ) {
11311131 if (errorInfo == ErrorInfo .MINIMAL ) return new JsonDataException (description );
11321132 error .setLength (0 );
11331133 error .append (extra );
0 commit comments