From e968f2b83132dc6a75fbb07d75c1e1af7b143070 Mon Sep 17 00:00:00 2001 From: John Wagenleitner Date: Fri, 22 Apr 2016 22:53:51 -0700 Subject: [PATCH 1/3] refactor(json): remove final modifier from private methods Since private methods cannot be meaningfully overridden, declaring them final is redundant and can be confusing to those reviewing the code. --- .../src/main/java/groovy/json/internal/CharBuf.java | 6 +++--- .../main/java/groovy/json/internal/CharSequenceValue.java | 2 +- .../src/main/java/groovy/json/internal/JsonFastParser.java | 2 +- .../main/java/groovy/json/internal/JsonParserCharArray.java | 4 ++-- .../json/internal/JsonParserUsingCharacterSource.java | 4 ++-- .../src/main/java/groovy/json/internal/LazyValueMap.java | 2 +- .../src/main/java/groovy/json/internal/NumberValue.java | 2 +- .../src/main/java/groovy/json/internal/ValueMapImpl.java | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java index 790b19f8783..8491498c4fa 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java @@ -386,7 +386,7 @@ public final CharBuf addJsonEscapedString(final char[] charArray) { final byte[] charTo = new byte[2]; - private final CharBuf doAddJsonEscapedString(char[] charArray) { + private CharBuf doAddJsonEscapedString(char[] charArray) { char[] _buffer = buffer; int _location = this.location; @@ -558,11 +558,11 @@ public CharBuf add(byte[] chars) { return this; } - private static final void sysstemarraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { + private static void sysstemarraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { System.arraycopy(src, srcPos, dest, destPos, length); } - private static final void arraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { + private static void arraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { sysstemarraycopy(src, srcPos, dest, destPos, length); } diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java index ab33c26c265..6ec62208c29 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java @@ -113,7 +113,7 @@ public boolean isContainer() { return false; } - private final Object doToValue() { + private Object doToValue() { switch (type) { case DOUBLE: return doubleValue(); diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java index c088b4dd2f3..cc90a4d43f6 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java @@ -155,7 +155,7 @@ private Value decodeValueOverlay() { } } - private final Value decodeNumberOverlay(final boolean minus) { + private Value decodeNumberOverlay(final boolean minus) { char[] array = charArray; final int startIndex = __index; diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java index f716d97d5ba..6bb55b874d3 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java @@ -158,7 +158,7 @@ protected Object decodeValue() { return decodeValueInternal(); } - private final Object decodeValueInternal() { + private Object decodeValueInternal() { Object value = null; skipWhiteSpace(); @@ -213,7 +213,7 @@ private final Object decodeValueInternal() { int[] endIndex = new int[1]; - private final Object decodeNumber() { + private Object decodeNumber() { Number num = CharScanner.parseJsonNumber(charArray, __index, charArray.length, endIndex); __index = endIndex[0]; diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserUsingCharacterSource.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserUsingCharacterSource.java index 0678f68b3be..47a470f37aa 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserUsingCharacterSource.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserUsingCharacterSource.java @@ -108,7 +108,7 @@ protected final void complain(String complaint) { throw new JsonException(exceptionDetails(complaint)); } - private final Object decodeValue() { + private Object decodeValue() { CharacterSource characterSource = this.characterSource; Object value = null; characterSource.skipWhiteSpace(); @@ -163,7 +163,7 @@ private final Object decodeValue() { return value; } - private final Object decodeNumber(boolean negative) { + private Object decodeNumber(boolean negative) { char[] chars = characterSource.readNumber(); Object value = null; diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java index 639c4649a62..91dea6eee6b 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java @@ -194,7 +194,7 @@ public Set> entrySet() { return map.entrySet(); } - private final void buildMap() { + private void buildMap() { /** added to avoid hash collision attack. */ if (Sys.is1_7OrLater() && System.getProperty("jdk.map.althashing.threshold") != null) { map = new HashMap(items.length); diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java index fe543abf3c0..ceb9864c125 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java @@ -99,7 +99,7 @@ public boolean isContainer() { return false; } - private final Object doToValue() { + private Object doToValue() { switch (type) { case DOUBLE: return bigDecimalValue(); diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java index 8c77b1f775f..b2a7cfa1cbb 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java @@ -110,7 +110,7 @@ public Set> entrySet() { /** * Build the map if requested to, it does this lazily. */ - private final void buildIfNeededMap() { + private void buildIfNeededMap() { if (map == null) { map = new HashMap(items.length); From 92944edac0e3e15f38ff1bad3701df4330d6760b Mon Sep 17 00:00:00 2001 From: John Wagenleitner Date: Fri, 22 Apr 2016 23:04:11 -0700 Subject: [PATCH 2/3] refactor(json): simplified expressions --- .../groovy/json/internal/BaseJsonParser.java | 10 +--------- .../java/groovy/json/internal/CharBuf.java | 12 ++--------- .../json/internal/CharSequenceValue.java | 3 +-- .../main/java/groovy/json/internal/Dates.java | 20 ++++++------------- .../groovy/json/internal/JsonFastParser.java | 8 +++----- .../json/internal/JsonParserCharArray.java | 6 ++---- .../groovy/json/internal/JsonParserLax.java | 14 ++++--------- .../groovy/json/internal/NumberValue.java | 3 +-- .../json/internal/ReaderCharacterSource.java | 4 +--- .../main/java/groovy/json/internal/Value.java | 2 +- 10 files changed, 22 insertions(+), 60 deletions(-) diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java index 0f23e4115d3..03e94de26c6 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java @@ -213,15 +213,7 @@ protected static int findEndQuote(final char[] array, int index) { break; } } - if (isEscape(currentChar)) { - if (!escape) { - escape = true; - } else { - escape = false; - } - } else { - escape = false; - } + escape = isEscape(currentChar) && !escape; } return index; } diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java index 8491498c4fa..560a47cc6fc 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java @@ -310,7 +310,7 @@ public final CharBuf addChars(char[] chars) { capacity = buffer.length; } - arraycopy(chars, 0, buffer, location, chars.length); + System.arraycopy(chars, 0, buffer, location, chars.length); location += chars.length; return this; } @@ -328,7 +328,7 @@ public final CharBuf addQuoted(char[] chars) { _buffer[_location] = '"'; _location++; - arraycopy(chars, 0, _buffer, _location, chars.length); + System.arraycopy(chars, 0, _buffer, _location, chars.length); _location += (chars.length); _buffer[_location] = '"'; @@ -558,14 +558,6 @@ public CharBuf add(byte[] chars) { return this; } - private static void sysstemarraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { - System.arraycopy(src, srcPos, dest, destPos, length); - } - - private static void arraycopy(final char[] src, final int srcPos, final char[] dest, final int destPos, final int length) { - sysstemarraycopy(src, srcPos, dest, destPos, length); - } - public CharBuf add(byte[] bytes, int start, int end) { int charsLength = end - start; if (charsLength + location > capacity) { diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java index 6ec62208c29..9d76cd60e02 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharSequenceValue.java @@ -158,9 +158,8 @@ public boolean equals(Object o) { if (startIndex != value1.startIndex) return false; if (!Arrays.equals(buffer, value1.buffer)) return false; if (type != value1.type) return false; - if (value != null ? !value.equals(value1.value) : value1.value != null) return false; + return value != null ? value.equals(value1.value) : value1.value == null; - return true; } public int hashCode() { diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Dates.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Dates.java index 75c8a9186bb..5a07c6baa5f 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Dates.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/Dates.java @@ -33,8 +33,7 @@ public static long utc(long time) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); calendar.setTimeZone(UTC_TIME_ZONE); - long utcNow = calendar.getTime().getTime(); - return utcNow; + return calendar.getTime().getTime(); } private static Date internalDate(TimeZone tz, int year, int month, int day, int hour, @@ -72,7 +71,7 @@ public static Date toDate(TimeZone tz, int year, int month, int day, public static Date fromISO8601(char[] charArray, int from, int to) { try { if (isISO8601(charArray, from, to)) { - int year = CharScanner.parseIntFromTo(charArray, from + 0, from + 4); + int year = CharScanner.parseIntFromTo(charArray, from, from + 4); int month = CharScanner.parseIntFromTo(charArray, from + 5, from + 7); int day = CharScanner.parseIntFromTo(charArray, from + 8, from + 10); int hour = CharScanner.parseIntFromTo(charArray, from + 11, from + 13); @@ -85,10 +84,7 @@ public static Date fromISO8601(char[] charArray, int from, int to) { if (charArray[from + 19] == 'Z') { tz = TimeZone.getTimeZone("GMT"); } else { - StringBuilder builder = new StringBuilder(9); - builder.append("GMT"); - builder.append(charArray, from + 19, 6); - String tzStr = builder.toString(); + String tzStr = "GMT" + String.valueOf(charArray, from + 19, 6); tz = TimeZone.getTimeZone(tzStr); } return toDate(tz, year, month, day, hour, minute, second); @@ -103,7 +99,7 @@ public static Date fromISO8601(char[] charArray, int from, int to) { public static Date fromJsonDate(char[] charArray, int from, int to) { try { if (isJsonDate(charArray, from, to)) { - int year = CharScanner.parseIntFromTo(charArray, from + 0, from + 4); + int year = CharScanner.parseIntFromTo(charArray, from, from + 4); int month = CharScanner.parseIntFromTo(charArray, from + 5, from + 7); int day = CharScanner.parseIntFromTo(charArray, from + 8, from + 10); int hour = CharScanner.parseIntFromTo(charArray, from + 11, from + 13); @@ -154,13 +150,9 @@ public static boolean isISO8601QuickCheck(char[] charArray, int start, int to) { final int length = to - start; try { - if (length == JSON_TIME_LENGTH || length == LONG_ISO_8601_TIME_LENGTH - || length == SHORT_ISO_8601_TIME_LENGTH || (length >= 17 && (charArray[start + 16] == ':')) - ) { - return true; - } + return length == JSON_TIME_LENGTH || length == LONG_ISO_8601_TIME_LENGTH + || length == SHORT_ISO_8601_TIME_LENGTH || (length >= 17 && (charArray[start + 16] == ':')); - return false; } catch (Exception ex) { ex.printStackTrace(); return false; diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java index cc90a4d43f6..a2dfb1ee95a 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java @@ -122,10 +122,10 @@ private Value decodeValueOverlay() { return decodeJsonObjectLazyFinalParse(); case 't': - return decodeTrue() == true ? ValueContainer.TRUE : ValueContainer.FALSE; + return decodeTrue() ? ValueContainer.TRUE : ValueContainer.FALSE; case 'f': - return decodeFalse() == false ? ValueContainer.FALSE : ValueContainer.TRUE; + return !decodeFalse() ? ValueContainer.FALSE : ValueContainer.TRUE; case 'n': return decodeNull() == null ? ValueContainer.NULL : ValueContainer.NULL; @@ -219,9 +219,7 @@ private Value decodeNumberOverlay(final boolean minus) { Type type = doubleFloat ? Type.DOUBLE : Type.INTEGER; - NumberValue value = new NumberValue(chop, type, startIndex, __index, this.charArray); - - return value; + return new NumberValue(chop, type, startIndex, __index, this.charArray); } private Value decodeStringOverlay() { diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java index 6bb55b874d3..85120d1d106 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserCharArray.java @@ -43,8 +43,7 @@ protected Object decodeFromChars(char[] cs) { __index = 0; charArray = cs; lastIndex = cs.length - 1; - Object value = decodeValue(); - return value; + return decodeValue(); } protected final boolean hasMore() { @@ -363,8 +362,7 @@ protected final List decodeJsonArray() { } } catch (Exception ex) { if (ex instanceof JsonException) { - JsonException jsonException = (JsonException) ex; - throw jsonException; + throw (JsonException) ex; } throw new JsonException(exceptionDetails("issue parsing JSON array"), ex); } diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserLax.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserLax.java index 0238b359cfb..09b87f20753 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserLax.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonParserLax.java @@ -258,7 +258,7 @@ private Value decodeValueInternal() { case 't': if (isTrue()) { - return decodeTrue() == true ? ValueContainer.TRUE : ValueContainer.FALSE; + return decodeTrue() ? ValueContainer.TRUE : ValueContainer.FALSE; } else { value = decodeStringLax(); } @@ -266,7 +266,7 @@ private Value decodeValueInternal() { case 'f': if (isFalse()) { - return decodeFalse() == false ? ValueContainer.FALSE : ValueContainer.TRUE; + return !decodeFalse() ? ValueContainer.FALSE : ValueContainer.TRUE; } else { value = decodeStringLax(); } @@ -441,9 +441,7 @@ protected final Value decodeNumberLax(boolean minus) { Type type = doubleFloat ? Type.DOUBLE : Type.INTEGER; - NumberValue value = new NumberValue(chop, type, startIndex, __index, this.charArray); - - return value; + return new NumberValue(chop, type, startIndex, __index, this.charArray); } private boolean isNull() { @@ -530,11 +528,7 @@ private Value decodeStringDouble() { } case '\\': - if (!escape) { - escape = true; - } else { - escape = false; - } + escape = !escape; encoded = true; continue; } diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java index ceb9864c125..ffa5ffb4fe5 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java @@ -130,9 +130,8 @@ public boolean equals(Object o) { if (startIndex != value1.startIndex) return false; if (!Arrays.equals(buffer, value1.buffer)) return false; if (type != value1.type) return false; - if (value != null ? !value.equals(value1.value) : value1.value != null) return false; + return value != null ? value.equals(value1.value) : value1.value == null; - return true; } public int hashCode() { diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java index abff7d007ed..b2521c6e697 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java @@ -72,10 +72,8 @@ private void ensureBuffer() { try { if (index >= length && !done) { readNextBuffer(); - } else if (done && index >= length) { - more = false; } else { - more = true; + more = !(done && index >= length); } } catch (Exception ex) { String str = CharScanner.errorDetails("ensureBuffer issue", readBuf, index, ch); diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java index 77c9819f073..095609b7acd 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java @@ -57,7 +57,7 @@ public interface Value { boolean isContainer(); //either a map or a collection - public void chop(); + void chop(); char charValue(); } From 48fa97e2ebbc29c369a9b66a9dfbf491208294dc Mon Sep 17 00:00:00 2001 From: John Wagenleitner Date: Fri, 22 Apr 2016 23:08:34 -0700 Subject: [PATCH 3/3] refactor(json): inline to eliminate unused Classes --- .../groovy/json/internal/BaseJsonParser.java | 5 ++- .../main/java/groovy/json/internal/Byt.java | 30 ------------------ .../java/groovy/json/internal/CharBuf.java | 3 +- .../java/groovy/json/internal/Charsets.java | 31 ------------------- 4 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 subprojects/groovy-json/src/main/java/groovy/json/internal/Byt.java delete mode 100644 subprojects/groovy-json/src/main/java/groovy/json/internal/Charsets.java diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java index 03e94de26c6..699b1b8ad49 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/BaseJsonParser.java @@ -24,6 +24,7 @@ import org.codehaus.groovy.runtime.ResourceGroovyMethods; import java.io.*; +import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; /** @@ -66,7 +67,9 @@ public abstract class BaseJsonParser implements JsonParser { protected static final boolean internKeys = Boolean.parseBoolean(System.getProperty("groovy.json.internKeys", "false")); protected static ConcurrentHashMap internedKeysCache; - protected String charset = Charsets.UTF_8.name(); + private static final Charset UTF_8 = Charset.forName("UTF-8"); + + protected String charset = UTF_8.name(); private CharBuf fileInputBuf; diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Byt.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Byt.java deleted file mode 100644 index 289b6e593dc..00000000000 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Byt.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package groovy.json.internal; - -/** - * @author Richard Hightower - */ -public class Byt { - - public static void charTo(byte[] b, char val) { - b[1] = (byte) (val); - b[0] = (byte) (val >>> 8); - } -} diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java index 560a47cc6fc..feaa6147c11 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/CharBuf.java @@ -485,7 +485,8 @@ private CharBuf doAddJsonEscapedString(char[] charArray) { _location++; } } else { - Byt.charTo(_charTo, c); + _charTo[1] = (byte) (c); + _charTo[0] = (byte) (c >>> 8); for (int charByte : _charTo) { ByteScanner.encodeByteIntoTwoAsciiCharBytes(charByte, _encoded); diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Charsets.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Charsets.java deleted file mode 100644 index f3bdbc21f94..00000000000 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Charsets.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package groovy.json.internal; - -import java.nio.charset.Charset; - -/** - * @author Rick Hightower - */ -public final class Charsets { - - public static final Charset US_ASCII = Charset.forName("US-ASCII"); - public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); - public static final Charset UTF_8 = Charset.forName("UTF-8"); -}