You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/02/26 21:55:33 UTC

[6/8] groovy git commit: GROOVY-8379: Rework groovy-json FastStringUtils (closes #667)

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonStringDecoder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonStringDecoder.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonStringDecoder.java
deleted file mode 100644
index cffcd34..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonStringDecoder.java
+++ /dev/null
@@ -1,38 +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 JsonStringDecoder {
-
-    public static String decode(char[] chars, int start, int to) {
-        if (!Chr.contains(chars, '\\', start, to - start)) {
-            return new String(chars, start, to - start);
-        }
-        return decodeForSure(chars, start, to);
-    }
-
-    public static String decodeForSure(char[] chars, int start, int to) {
-        CharBuf builder = CharBuf.create(to - start);
-        builder.decodeJsonString(chars, start, to);
-        return builder.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyMap.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyMap.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyMap.java
deleted file mode 100644
index 6d14ed1..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyMap.java
+++ /dev/null
@@ -1,205 +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.lang.reflect.Array;
-import java.util.AbstractMap;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-/**
- * This maps only builds once you ask for a key for the first time.
- * It is designed to not incur the overhead of creating a map unless needed.
- *
- * @author Rick Hightower
- */
-public class LazyMap extends AbstractMap<String, Object> {
-
-    static final String JDK_MAP_ALTHASHING_SYSPROP = System.getProperty("jdk.map.althashing.threshold");
-
-    /* Holds the actual map that will be lazily created. */
-    private Map<String, Object> map;
-    /* The size of the map. */
-    private int size;
-    /* The keys  stored in the map. */
-    private String[] keys;
-    /* The values stored in the map. */
-    private Object[] values;
-
-    public LazyMap() {
-        keys = new String[5];
-        values = new Object[5];
-    }
-
-    public LazyMap(int initialSize) {
-        keys = new String[initialSize];
-        values = new Object[initialSize];
-    }
-
-    public Object put(String key, Object value) {
-        if (map == null) {
-            for (int i = 0; i < size; i++) {
-                String curKey = keys[i];
-                if ((key == null && curKey == null)
-                     || (key != null && key.equals(curKey))) {
-                    Object val = values[i];
-                    keys[i] = key;
-                    values[i] = value;
-                    return val;
-                }
-            }
-            keys[size] = key;
-            values[size] = value;
-            size++;
-            if (size == keys.length) {
-                keys = grow(keys);
-                values = grow(values);
-            }
-            return null;
-        } else {
-            return map.put(key, value);
-        }
-    }
-
-    public Set<Entry<String, Object>> entrySet() {
-        buildIfNeeded();
-        return map.entrySet();
-    }
-
-    public int size() {
-        if (map == null) {
-            return size;
-        } else {
-            return map.size();
-        }
-    }
-
-    public boolean isEmpty() {
-        if (map == null) {
-            return size == 0;
-        } else {
-            return map.isEmpty();
-        }
-    }
-
-    public boolean containsValue(Object value) {
-        buildIfNeeded();
-        return map.containsValue(value);
-    }
-
-    public boolean containsKey(Object key) {
-        buildIfNeeded();
-        return map.containsKey(key);
-    }
-
-    public Object get(Object key) {
-        buildIfNeeded();
-        return map.get(key);
-    }
-
-    private void buildIfNeeded() {
-        if (map == null) {
-            // added to avoid hash collision attack
-            if (Sys.is1_8OrLater() || (Sys.is1_7() && JDK_MAP_ALTHASHING_SYSPROP != null)) {
-                map = new LinkedHashMap<String, Object>(size, 0.01f);
-            } else {
-                map = new TreeMap<String, Object>();
-            }
-
-            for (int index = 0; index < size; index++) {
-                map.put(keys[index], values[index]);
-            }
-            this.keys = null;
-            this.values = null;
-        }
-    }
-
-    public Object remove(Object key) {
-        buildIfNeeded();
-        return map.remove(key);
-    }
-
-    public void putAll(Map m) {
-        buildIfNeeded();
-        map.putAll(m);
-    }
-
-    public void clear() {
-        if (map == null) {
-            size = 0;
-        } else {
-            map.clear();
-        }
-    }
-
-    public Set<String> keySet() {
-        buildIfNeeded();
-        return map.keySet();
-    }
-
-    public Collection<Object> values() {
-        buildIfNeeded();
-        return map.values();
-    }
-
-    public boolean equals(Object o) {
-        buildIfNeeded();
-        return map.equals(o);
-    }
-
-    public int hashCode() {
-        buildIfNeeded();
-        return map.hashCode();
-    }
-
-    public String toString() {
-        buildIfNeeded();
-        return map.toString();
-    }
-
-    protected Object clone() throws CloneNotSupportedException {
-        if (map == null) {
-            return null;
-        } else {
-            if (map instanceof LinkedHashMap) {
-                return ((LinkedHashMap) map).clone();
-            } else {
-                return new LinkedHashMap(this);
-            }
-        }
-    }
-
-    public LazyMap clearAndCopy() {
-        LazyMap map = new LazyMap();
-        for (int index = 0; index < size; index++) {
-            map.put(keys[index], values[index]);
-        }
-        size = 0;
-        return map;
-    }
-
-    public static <V> V[] grow(V[] array) {
-        Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length * 2);
-        System.arraycopy(array, 0, newArray, 0, array.length);
-        return (V[]) newArray;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 364a76e..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/LazyValueMap.java
+++ /dev/null
@@ -1,247 +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.util.AbstractMap;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import static groovy.json.internal.Exceptions.die;
-
-/**
- * This class is important to the performance of the parser.
- * It stores Value objects in a map where they are evaluated lazily.
- * This is great for JSONPath types of application, and Object Serialization but not for maps that are going to be stored in a cache.
- * <p/>
- * This is because the Value construct is a type of index overlay that merely tracks where the token is located in the buffer,
- * and what if any thing we noted about it (like can be converted to a decimal number, etc.).
- * <p/>
- * To mitigate memory leaks this class along with CharSequenceValue implement two constructs, namely,
- * chop,  and lazyChop.
- * <p/>
- * A chop is when we convert backing buffer of a Value object into a smaller buffer.
- * A lazyChop is when we do a chop but only when a get operation is called.
- * <p/>
- * The lazyChop is performed on the tree that is touched by the JSONPath expression or its ilk.
- * <p/>
- * The chop operation can be done during parsing or lazily by storing the values in this construct.
- *
- * @author Rick Hightower (insane chipmonk)
- */
-public class LazyValueMap extends AbstractMap<String, Object> implements ValueMap<String, Object> {
-
-    /**
-     * holds the map that gets lazily created on first access.
-     */
-    private Map<String, Object> map = null;
-    /**
-     * holds the list of items that we are managing.
-     */
-    private Entry<String, Value>[] items;
-    /**
-     * Holds the current number mapping managed by this map.
-     */
-    private int len = 0;
-    /**
-     * Holds whether or not we ae in lazy chop mode or not.
-     */
-    private final boolean lazyChop;
-
-    /**
-     * Keep track if this map has already been chopped so we don't waste time trying to chop it again.
-     */
-    boolean mapChopped = false;
-
-    public LazyValueMap(boolean lazyChop) {
-        this.items = new Entry[5];
-        this.lazyChop = lazyChop;
-    }
-
-    public LazyValueMap(boolean lazyChop, int initialSize) {
-        this.items = new Entry[initialSize];
-        this.lazyChop = lazyChop;
-    }
-
-    /**
-     * Adds a new MapItemValue to the mapping.
-     *
-     * @param miv miv we are adding.
-     */
-    public final void add(MapItemValue miv) {
-        if (len >= items.length) {
-            items = LazyMap.grow(items);
-        }
-        items[len] = miv;
-        len++;
-    }
-
-    /**
-     * Gets the item by key from the mapping.
-     *
-     * @param key to lookup
-     * @return the item for the given key
-     */
-    public final Object get(Object key) {
-        Object object = null;
-
-        /* if the map is null, then we create it. */
-        if (map == null) {
-            buildMap();
-        }
-        object = map.get(key);
-
-        lazyChopIfNeeded(object);
-        return object;
-    }
-
-    /**
-     * If in lazy chop mode, and the object is a Lazy Value Map or a ValueList
-     * then we force a chop operation for each of its items.
-     */
-    private void lazyChopIfNeeded(Object object) {
-        if (lazyChop) {
-            if (object instanceof LazyValueMap) {
-                LazyValueMap m = (LazyValueMap) object;
-                m.chopMap();
-            } else if (object instanceof ValueList) {
-                ValueList list = (ValueList) object;
-                list.chopList();
-            }
-        }
-    }
-
-    /**
-     * Chop this map.
-     */
-    public final void chopMap() {
-        /* if it has been chopped then you have to return. */
-        if (mapChopped) {
-            return;
-        }
-        mapChopped = true;
-
-        /* If the internal map was not create yet, don't. We can chop the value w/o creating the internal map.*/
-        if (this.map == null) {
-            for (int index = 0; index < len; index++) {
-                MapItemValue entry = (MapItemValue) items[index];
-
-                Value value = entry.getValue();
-                if (value == null) continue;
-                if (value.isContainer()) {
-                    chopContainer(value);
-                } else {
-                    value.chop();
-                }
-            }
-        } else {
-            /* Iterate through the map and do the same thing. Make sure children and children of children are chopped.  */
-            for (Map.Entry<String, Object> entry : map.entrySet()) {
-
-                Object object = entry.getValue();
-                if (object instanceof Value) {
-                    Value value = (Value) object;
-                    if (value.isContainer()) {
-                        chopContainer(value);
-                    } else {
-                        value.chop();
-                    }
-                } else if (object instanceof LazyValueMap) {
-                    LazyValueMap m = (LazyValueMap) object;
-                    m.chopMap();
-                } else if (object instanceof ValueList) {
-                    ValueList list = (ValueList) object;
-                    list.chopList();
-                }
-            }
-        }
-    }
-
-    /* We need to chop up this child container. */
-    private static void chopContainer(Value value) {
-        Object obj = value.toValue();
-        if (obj instanceof LazyValueMap) {
-            LazyValueMap map = (LazyValueMap) obj;
-            map.chopMap();
-        } else if (obj instanceof ValueList) {
-            ValueList list = (ValueList) obj;
-            list.chopList();
-        }
-    }
-
-    public Value put(String key, Object value) {
-        die("Not that kind of map");
-        return null;
-    }
-
-    public Set<Entry<String, Object>> entrySet() {
-        if (map == null) {
-            buildMap();
-        }
-        return map.entrySet();
-    }
-
-    private void buildMap() {
-        // added to avoid hash collision attack
-        if (Sys.is1_8OrLater() || (Sys.is1_7() && LazyMap.JDK_MAP_ALTHASHING_SYSPROP != null)) {
-            map = new HashMap<String, Object>(items.length);
-        } else {
-            map = new TreeMap<String, Object>();
-        }
-
-        for (Entry<String, Value> miv : items) {
-            if (miv == null) {
-                break;
-            }
-            map.put(miv.getKey(), miv.getValue().toValue());
-        }
-
-        len = 0;
-        items = null;
-    }
-
-    public Collection<Object> values() {
-        if (map == null) buildMap();
-        return map.values();
-    }
-
-    public int size() {
-        if (map == null) buildMap();
-        return map.size();
-    }
-
-    public String toString() {
-        if (map == null) buildMap();
-        return map.toString();
-    }
-
-    public int len() {
-        return len;
-    }
-
-    public boolean hydrated() {
-        return map != null;
-    }
-
-    public Entry<String, Value>[] items() {
-        return items;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/MapItemValue.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/MapItemValue.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/MapItemValue.java
deleted file mode 100644
index 0047ae7..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/MapItemValue.java
+++ /dev/null
@@ -1,80 +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.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static groovy.json.internal.Exceptions.die;
-
-/**
- * This holds a mapping from value key to value value to maximize laziness.
- *
- * @author Rick Hightower
- */
-public class MapItemValue implements Map.Entry<String, Value> {
-
-    final Value name;
-    final Value value;
-
-    private String key = null;
-
-    private static final boolean internKeys = Boolean.parseBoolean(System.getProperty("groovy.json.implementation.internKeys", "false"));
-
-    protected static ConcurrentHashMap<String, String> internedKeysCache;
-
-    static {
-        if (internKeys) {
-            internedKeysCache = new ConcurrentHashMap<String, String>();
-        }
-    }
-
-    public MapItemValue(Value name, Value value) {
-        this.name = name;
-        this.value = value;
-    }
-
-    public String getKey() {
-        if (key == null) {
-            if (internKeys) {
-                key = name.toString();
-
-                String keyPrime = internedKeysCache.get(key);
-                if (keyPrime == null) {
-                    key = key.intern();
-                    internedKeysCache.put(key, key);
-                } else {
-                    key = keyPrime;
-                }
-            } else {
-                key = name.toString();
-            }
-        }
-        return key;
-    }
-
-    public Value getValue() {
-        return value;
-    }
-
-    public Value setValue(Value value) {
-        die("not that kind of Entry");
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 800431a..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/NumberValue.java
+++ /dev/null
@@ -1,216 +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 groovy.json.JsonException;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.Date;
-
-import static groovy.json.internal.CharScanner.isInteger;
-import static groovy.json.internal.CharScanner.parseIntFromTo;
-import static groovy.json.internal.CharScanner.parseLongFromTo;
-import static groovy.json.internal.Exceptions.die;
-import static groovy.json.internal.Exceptions.sputs;
-
-/**
- * @author Rick Hightower
- */
-public class NumberValue extends java.lang.Number implements Value {
-
-    private char[] buffer;
-    private boolean chopped;
-    private int startIndex;
-    private int endIndex;
-    private final Type type;
-    private Object value;
-
-    public NumberValue(Type type) {
-        this.type = type;
-    }
-
-    public NumberValue() {
-        this.type = null;
-    }
-
-    public NumberValue(boolean chop, Type type, int startIndex, int endIndex, char[] buffer) {
-        this.type = type;
-
-        try {
-            if (chop) {
-                this.buffer = ArrayUtils.copyRange(buffer, startIndex, endIndex);
-                this.startIndex = 0;
-                this.endIndex = this.buffer.length;
-                chopped = true;
-            } else {
-                this.startIndex = startIndex;
-                this.endIndex = endIndex;
-                this.buffer = buffer;
-            }
-        } catch (Exception ex) {
-            Exceptions.handle(sputs("exception", ex, "start", startIndex, "end", endIndex), ex);
-        }
-
-        // Check for a single minus now, rather than finding out later during lazy parsing.
-        if (this.endIndex - this.startIndex == 1 && this.buffer[this.startIndex] == '-') {
-            die("A single minus is not a valid number");
-        }
-
-    }
-
-    public String toString() {
-        if (startIndex == 0 && endIndex == buffer.length) {
-            return FastStringUtils.noCopyStringFromChars(buffer);
-        } else {
-            return new String(buffer, startIndex, (endIndex - startIndex));
-        }
-    }
-
-    public final Object toValue() {
-        return value != null ? value : (value = doToValue());
-    }
-
-    public <T extends Enum> T toEnum(Class<T> cls) {
-        return toEnum(cls, intValue());
-    }
-
-    public static <T extends Enum> T toEnum(Class<T> cls, int value) {
-        T[] enumConstants = cls.getEnumConstants();
-        for (T e : enumConstants) {
-            if (e.ordinal() == value) {
-                return e;
-            }
-        }
-        die("Can't convert ordinal value " + value + " into enum of type " + cls);
-        return null;
-    }
-
-    public boolean isContainer() {
-        return false;
-    }
-
-    private Object doToValue() {
-        switch (type) {
-            case DOUBLE:
-                return bigDecimalValue();
-            case INTEGER:
-                if (isInteger(buffer, startIndex, endIndex - startIndex)) {
-                    return intValue();
-                } else {
-                    return longValue();
-                }
-        }
-        die();
-        return null;
-    }
-
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof Value)) return false;
-
-        NumberValue value1 = (NumberValue) o;
-
-        if (endIndex != value1.endIndex) return false;
-        if (startIndex != value1.startIndex) return false;
-        if (!Arrays.equals(buffer, value1.buffer)) return false;
-        if (type != value1.type) return false;
-        return value != null ? value.equals(value1.value) : value1.value == null;
-
-    }
-
-    public int hashCode() {
-        int result = type != null ? type.hashCode() : 0;
-        result = 31 * result + (buffer != null ? Arrays.hashCode(buffer) : 0);
-        result = 31 * result + startIndex;
-        result = 31 * result + endIndex;
-        result = 31 * result + (value != null ? value.hashCode() : 0);
-        return result;
-    }
-
-    public BigDecimal bigDecimalValue() {
-        try {
-            return new BigDecimal(buffer, startIndex, endIndex - startIndex);
-        } catch (NumberFormatException e) {
-            throw new JsonException("unable to parse " + new String(buffer, startIndex, endIndex - startIndex), e);
-        }
-    }
-
-    public BigInteger bigIntegerValue() {
-        return new BigInteger(toString());
-    }
-
-    public String stringValue() {
-        return toString();
-    }
-
-    public String stringValueEncoded() {
-        return toString();
-    }
-
-    public Date dateValue() {
-        return new Date(Dates.utc(longValue()));
-    }
-
-    public int intValue() {
-        return parseIntFromTo(buffer, startIndex, endIndex);
-    }
-
-    public long longValue() {
-        if (isInteger(buffer, startIndex, endIndex - startIndex)) {
-            return parseIntFromTo(buffer, startIndex, endIndex);
-        } else {
-            return parseLongFromTo(buffer, startIndex, endIndex);
-        }
-    }
-
-    public byte byteValue() {
-        return (byte) intValue();
-    }
-
-    public short shortValue() {
-        return (short) intValue();
-    }
-
-    public double doubleValue() {
-        return CharScanner.parseDouble(this.buffer, startIndex, endIndex);
-    }
-
-    public boolean booleanValue() {
-        return Boolean.parseBoolean(toString());
-    }
-
-    public float floatValue() {
-        return CharScanner.parseFloat(this.buffer, startIndex, endIndex);
-    }
-
-    public final void chop() {
-        if (!chopped) {
-            this.chopped = true;
-            this.buffer = ArrayUtils.copyRange(buffer, startIndex, endIndex);
-            this.startIndex = 0;
-            this.endIndex = this.buffer.length;
-        }
-    }
-
-    public char charValue() {
-        return buffer[startIndex];
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 22976bd..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ReaderCharacterSource.java
+++ /dev/null
@@ -1,264 +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.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-
-/**
- * @author Richard Hightower
- */
-public class ReaderCharacterSource implements CharacterSource {
-
-    private static final int MAX_TOKEN_SIZE = 5;
-
-    private final Reader reader;
-    private final int readAheadSize;
-    private int ch = -2;
-
-    private boolean foundEscape;
-
-    private final char[] readBuf;
-
-    private int index;
-
-    private int length;
-
-    boolean more = true;
-    private boolean done = false;
-
-    public ReaderCharacterSource(final Reader reader, final int readAheadSize) {
-        this.reader = reader;
-        this.readBuf = new char[readAheadSize + MAX_TOKEN_SIZE];
-        this.readAheadSize = readAheadSize;
-    }
-
-    public ReaderCharacterSource(final Reader reader) {
-        this.reader = reader;
-        this.readAheadSize = 10000;
-        this.readBuf = new char[readAheadSize + MAX_TOKEN_SIZE];
-    }
-
-    public ReaderCharacterSource(final String string) {
-        this(new StringReader(string));
-    }
-
-    private void readForToken() {
-        try {
-            length += reader.read(readBuf, readBuf.length - MAX_TOKEN_SIZE, MAX_TOKEN_SIZE);
-        } catch (IOException e) {
-            Exceptions.handle(e);
-        }
-    }
-
-    private void ensureBuffer() {
-        try {
-            if (index >= length && !done) {
-                readNextBuffer();
-            } else {
-                more = !(done && index >= length);
-            }
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("ensureBuffer issue", readBuf, index, ch);
-            Exceptions.handle(str, ex);
-        }
-    }
-
-    private void readNextBuffer() throws IOException {
-        length = reader.read(readBuf, 0, readAheadSize);
-
-        index = 0;
-        if (length == -1) {
-            ch = -1;
-            length = 0;
-            more = false;
-            done = true;
-        } else {
-            more = true;
-        }
-    }
-
-    public final int nextChar() {
-        ensureBuffer();
-        return ch = readBuf[index++];
-    }
-
-    public final int currentChar() {
-        ensureBuffer();
-        return readBuf[index];
-    }
-
-    public final boolean hasChar() {
-        ensureBuffer();
-        return more;
-    }
-
-    public final boolean consumeIfMatch(char[] match) {
-        try {
-            char[] _chars = readBuf;
-            int i = 0;
-            int idx = index;
-            boolean ok = true;
-
-            if (idx + match.length > length) {
-                readForToken();
-            }
-
-            for (; i < match.length; i++, idx++) {
-                ok &= (match[i] == _chars[idx]);
-                if (!ok) break;
-            }
-
-            if (ok) {
-                index = idx;
-                return true;
-            } else {
-                return false;
-            }
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("consumeIfMatch issue", readBuf, index, ch);
-            return Exceptions.handle(boolean.class, str, ex);
-        }
-    }
-
-    public final int location() {
-        return index;
-    }
-
-    public final int safeNextChar() {
-        try {
-            ensureBuffer();
-            return index + 1 < readBuf.length ? readBuf[index++] : -1;
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("safeNextChar issue", readBuf, index, ch);
-            return Exceptions.handle(int.class, str, ex);
-        }
-    }
-
-    private static final char[] EMPTY_CHARS = new char[0];
-
-    public char[] findNextChar(int match, int esc) {
-        try {
-            ensureBuffer();
-
-            foundEscape = false;
-            if (readBuf[index] == '"') {
-                index++;
-                return EMPTY_CHARS;
-            }
-
-            int start = index;
-
-            char[] results = null;
-            boolean foundEnd = false;
-            boolean wasEscaped = false;
-            while (!foundEnd) {
-                for (; index < length; index++) {
-                    ch = readBuf[index];
-                    if (wasEscaped) {
-                        wasEscaped = false;
-                    } else if (ch == match) {
-                        foundEnd = true;
-                        break;
-                    } else if (ch == esc) {
-                        foundEscape = true;
-                        wasEscaped = true;
-                    }
-                }
-
-                if (results != null) {
-                    results = Chr.add(results, ArrayUtils.copyRange(readBuf, start, index));
-                }
-                else {
-                    results = ArrayUtils.copyRange(readBuf, start, index);
-                }
-
-                ensureBuffer();
-
-                // Reset start if new buffer
-                if (index == 0) {
-                    start = 0;
-                }
-
-                // Exit early if we run out of data
-                if (done) {
-                    break;
-                }
-            }
-
-            // done will only be true if we ran out of data without seeing the match character
-            if (done) {
-                return Exceptions.die(char[].class, "Unable to find close char " + (char)match + ": " + new String(results));
-            } else {
-                index++;
-                return results;
-            }
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("findNextChar issue", readBuf, index, ch);
-            return Exceptions.handle(char[].class, str, ex);
-        }
-    }
-
-    public boolean hadEscape() {
-        return foundEscape;
-    }
-
-    public void skipWhiteSpace() {
-        try {
-            index = CharScanner.skipWhiteSpace(readBuf, index, length);
-            if (index >= length && more) {
-                ensureBuffer();
-
-                skipWhiteSpace();
-            }
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("skipWhiteSpace issue", readBuf, index, ch);
-            Exceptions.handle(str, ex);
-        }
-    }
-
-    public char[] readNumber() {
-        try {
-            ensureBuffer();
-
-            char[] results = CharScanner.readNumber(readBuf, index, length);
-            index += results.length;
-
-            if (index >= length && more) {
-                ensureBuffer();
-                if (length != 0) {
-                    char results2[] = readNumber();
-                    return Chr.add(results, results2);
-                } else {
-                    return results;
-                }
-            } else {
-                return results;
-            }
-        } catch (Exception ex) {
-            String str = CharScanner.errorDetails("readNumber issue", readBuf, index, ch);
-            return Exceptions.handle(char[].class, str, ex);
-        }
-    }
-
-    public String errorDetails(String message) {
-        return CharScanner.errorDetails(message, readBuf, index, ch);
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
deleted file mode 100644
index 92bb400..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java
+++ /dev/null
@@ -1,72 +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 org.codehaus.groovy.runtime.memoize.CommonCache;
-import org.codehaus.groovy.runtime.memoize.EvictableCache;
-
-/**
- * @author Richard Hightower
- */
-public class SimpleCache<K, V> implements Cache<K, V> {
-    private EvictableCache<K, V> cache;
-
-    public SimpleCache(final int limit, CacheType type) {
-        if (type.equals(CacheType.LRU)) {
-            cache = new CommonCache<K, V>(limit);
-        } else {
-            cache = new CommonCache<K, V>(CommonCache.DEFAULT_INITIAL_CAPACITY, limit, EvictableCache.EvictionStrategy.FIFO);
-        }
-    }
-
-    public SimpleCache(final int limit) {
-        this(limit, CacheType.LRU);
-    }
-
-    public void put(K key, V value) {
-        cache.put(key, value);
-    }
-
-    public V get(K key) {
-        return cache.get(key);
-    }
-
-    //For testing only
-
-    public V getSilent(K key) {
-        V value = cache.get(key);
-        if (value != null) {
-            cache.remove(key);
-            cache.put(key, value);
-        }
-        return value;
-    }
-
-    public void remove(K key) {
-        cache.remove(key);
-    }
-
-    public int size() {
-        return cache.size();
-    }
-
-    public String toString() {
-        return cache.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
deleted file mode 100644
index 4d8c3ed..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Sys.java
+++ /dev/null
@@ -1,84 +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.math.BigDecimal;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-class Sys {
-
-    private static final boolean is1_8OrLater;
-    private static final boolean is1_7;
-    private static final boolean is1_8;
-
-    static {
-        BigDecimal v = new BigDecimal("-1");
-        String sversion = System.getProperty("java.version");
-        if (sversion.indexOf("_") != -1) {
-            final String[] split = sversion.split("_");
-            try {
-                String ver = split[0];
-
-                if (ver.startsWith("1.7")) {
-                    v = new BigDecimal("1.7");
-                }
-
-                if (ver.startsWith("1.8")) {
-                    v = new BigDecimal("1.8");
-                }
-
-                if (ver.startsWith("1.9")) {
-                    v = new BigDecimal("1.9");
-                }
-            } catch (Exception ex) {
-                ex.printStackTrace();
-                System.err.println("Unable to determine build number or version");
-            }
-        } else if ("1.8.0".equals(sversion)) {
-            v = new BigDecimal("1.8");
-        } else {
-            Pattern p = Pattern.compile("^([1-9]\\.[0-9]+)");
-            Matcher matcher = p.matcher(sversion);
-            if (matcher.find()) {
-                v = new BigDecimal(matcher.group(0));
-            }
-        }
-
-        is1_8OrLater = v.compareTo(new BigDecimal("1.8")) >= 0;
-        is1_7 = v.compareTo(new BigDecimal("1.7")) == 0;
-        is1_8 = v.compareTo(new BigDecimal("1.8")) == 0;
-    }
-
-    public static boolean is1_7OrLater() {
-        return true;
-    }
-
-    public static boolean is1_8OrLater() {
-        return is1_8OrLater;
-    }
-
-    public static boolean is1_7() {
-        return is1_7;
-    }
-
-    public static boolean is1_8() {
-        return is1_8;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/Type.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/Type.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/Type.java
deleted file mode 100644
index b37d4eb..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Type.java
+++ /dev/null
@@ -1,28 +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 enum Type {
-
-    INTEGER, STRING, DOUBLE, TRUE, FALSE, NULL, MAP, LIST
-
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 095609b..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/Value.java
+++ /dev/null
@@ -1,63 +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.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-
-/**
- * @author Rick Hightower
- */
-public interface Value {
-
-    byte byteValue();
-
-    short shortValue();
-
-    int intValue();
-
-    long longValue();
-
-    BigDecimal bigDecimalValue();
-
-    BigInteger bigIntegerValue();
-
-    float floatValue();
-
-    double doubleValue();
-
-    boolean booleanValue();
-
-    Date dateValue();
-
-    String stringValue();
-
-    String stringValueEncoded();
-
-    Object toValue();
-
-    <T extends Enum> T toEnum(Class<T> cls);
-
-    boolean isContainer(); //either a map or a collection
-
-    void chop();
-
-    char charValue();
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueContainer.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueContainer.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueContainer.java
deleted file mode 100644
index a173ea5..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueContainer.java
+++ /dev/null
@@ -1,174 +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.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import static groovy.json.internal.Exceptions.die;
-import static groovy.json.internal.Exceptions.sputs;
-
-/**
- * @author Rick Hightower
- */
-public class ValueContainer implements CharSequence, Value {
-
-    public static final Value TRUE = new ValueContainer(Type.TRUE);
-    public static final Value FALSE = new ValueContainer(Type.FALSE);
-    public static final Value NULL = new ValueContainer(Type.NULL);
-
-    public Object value;
-
-    public Type type;
-    private boolean container;
-
-    public boolean decodeStrings;
-
-    public ValueContainer(Object value, Type type, boolean decodeStrings) {
-        this.value = value;
-        this.type = type;
-        this.decodeStrings = decodeStrings;
-    }
-
-    public ValueContainer(Type type) {
-        this.type = type;
-    }
-
-    public ValueContainer(Map<String, Object> map) {
-        this.value = map;
-        this.type = Type.MAP;
-        this.container = true;
-    }
-
-    public ValueContainer(List<Object> list) {
-        this.value = list;
-        this.type = Type.LIST;
-        this.container = true;
-    }
-
-    public int intValue() {
-        return die(int.class, sputs("intValue not supported for type ", type));
-    }
-
-    public long longValue() {
-        return die(int.class, sputs("intValue not supported for type ", type));
-    }
-
-    public boolean booleanValue() {
-        switch (type) {
-            case FALSE:
-                return false;
-            case TRUE:
-                return true;
-        }
-        die();
-        return false;
-    }
-
-    public String stringValue() {
-        if (type == Type.NULL) {
-            return null;
-        } else {
-            return type.toString();
-        }
-    }
-
-    public String stringValueEncoded() {
-        return toString();
-    }
-
-    public String toString() {
-        return type.toString();
-    }
-
-    public Object toValue() {
-        if (value != null) {
-            return value;
-        }
-        switch (type) {
-            case FALSE:
-                return (value = false);
-
-            case TRUE:
-                return (value = true);
-            case NULL:
-                return null;
-        }
-        die();
-        return null;
-    }
-
-    public <T extends Enum> T toEnum(Class<T> cls) {
-        return (T) value;
-    }
-
-    public boolean isContainer() {
-        return container;
-    }
-
-    public void chop() {
-    }
-
-    public char charValue() {
-        return 0;
-    }
-
-    public int length() {
-        return 0;
-    }
-
-    public char charAt(int index) {
-        return '0';
-    }
-
-    public CharSequence subSequence(int start, int end) {
-        return "";
-    }
-
-    public Date dateValue() {
-        return null;
-    }
-
-    public byte byteValue() {
-        return 0;
-    }
-
-    public short shortValue() {
-        return 0;
-    }
-
-    public BigDecimal bigDecimalValue() {
-        return null;
-    }
-
-    public BigInteger bigIntegerValue() {
-        return null;
-    }
-
-    public double doubleValue() {
-        return 0;
-    }
-
-    public float floatValue() {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueList.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueList.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueList.java
deleted file mode 100644
index 0320791..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueList.java
+++ /dev/null
@@ -1,123 +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.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Rick Hightower
- */
-public class ValueList extends AbstractList<Object> {
-
-    List<Object> list = new ArrayList<Object>(5);
-
-    private final boolean lazyChop;
-    boolean converted = false;
-
-    public ValueList(boolean lazyChop) {
-        this.lazyChop = lazyChop;
-    }
-
-    public Object get(int index) {
-        Object obj = list.get(index);
-
-        if (obj instanceof Value) {
-            obj = convert((Value) obj);
-            list.set(index, obj);
-        }
-
-        chopIfNeeded(obj);
-        return obj;
-    }
-
-    private static Object convert(Value value) {
-        return value.toValue();
-    }
-
-    public int size() {
-        return list.size();
-    }
-
-    public Iterator<Object> iterator() {
-        convertAllIfNeeded();
-        return list.iterator();
-    }
-
-    private void convertAllIfNeeded() {
-        if (!converted) {
-            converted = true;
-            for (int index = 0; index < list.size(); index++) {
-                this.get(index);
-            }
-        }
-    }
-
-    public void clear() {
-        list.clear();
-    }
-
-    public boolean add(Object obj) {
-        return list.add(obj);
-    }
-
-    public void chopList() {
-        for (Object obj : list) {
-            if (obj == null) continue;
-
-            if (obj instanceof Value) {
-                Value value = (Value) obj;
-                if (value.isContainer()) {
-                    chopContainer(value);
-                } else {
-                    value.chop();
-                }
-            }
-        }
-    }
-
-    private void chopIfNeeded(Object object) {
-        if (lazyChop) {
-            if (object instanceof LazyValueMap) {
-                LazyValueMap m = (LazyValueMap) object;
-                m.chopMap();
-            } else if (object instanceof ValueList) {
-                ValueList list = (ValueList) object;
-                list.chopList();
-            }
-        }
-    }
-
-    static void chopContainer(Value value) {
-        Object obj = value.toValue();
-        if (obj instanceof LazyValueMap) {
-            LazyValueMap map = (LazyValueMap) obj;
-            map.chopMap();
-        } else if (obj instanceof ValueList) {
-            ValueList list = (ValueList) obj;
-            list.chopList();
-        }
-    }
-
-    public List<Object> list() {
-        return this.list;
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMap.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMap.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMap.java
deleted file mode 100644
index f9d1482..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMap.java
+++ /dev/null
@@ -1,46 +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.util.Map;
-
-/**
- * @author Richard Hightower
- */
-public interface ValueMap<K, V> extends Map<K, V> {
-
-    /* add a map item value. */
-    void add(MapItemValue miv);
-
-    /**
-     * Return size w/o hydrating the map.
-     */
-    int len();
-
-    /**
-     * Has the map been hydrated.
-     */
-    boolean hydrated();
-
-    /**
-     * Give me the items in the map without hydrating the map.
-     * Realize that the array is likely larger than the length so array items can be null.
-     */
-    Entry<String, Value>[] items();
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 31a7b2c..0000000
--- a/subprojects/groovy-json/src/main/java/groovy/json/internal/ValueMapImpl.java
+++ /dev/null
@@ -1,147 +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.util.AbstractMap;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static groovy.json.internal.Exceptions.die;
-
-/**
- * This map is for object serialization mainly.
- * The idea is the final conversion of
- * the Value objects are delayed until the last possible moment, i.e., just before injected into a bean.
- *
- * @author Rick Hightower
- */
-public class ValueMapImpl extends AbstractMap<String, Value> implements ValueMap<String, Value> {
-
-    /**
-     * The internal map to hold the Value map.
-     */
-    private Map<String, Value> map = null;
-
-    /**
-     * The items held in the map.
-     */
-    private Entry<String, Value>[] items = new Entry[20];
-
-    /* The current length of the map. */
-    private int len = 0;
-
-    /**
-     * Add a MapItemValue to the map.
-     *
-     * @param miv map value item.
-     */
-
-    public void add(MapItemValue miv) {
-        if (len >= items.length) {
-            items = LazyMap.grow(items);
-        }
-        items[len] = miv;
-        len++;
-    }
-
-    public int len() {
-        return len;
-    }
-
-    public boolean hydrated() {
-        return map != null;
-    }
-
-    public Entry<String, Value>[] items() {
-        return items;
-    }
-
-    /**
-     * Get the items for the key.
-     *
-     * @param key
-     * @return the items for the given key
-     */
-
-    public Value get(Object key) {
-        /* If the length is under and we are asking for the key, then just look for the key. Don't build the map. */
-        if (map == null && items.length < 20) {
-            for (Object item : items) {
-                MapItemValue miv = (MapItemValue) item;
-                if (key.equals(miv.name.toValue())) {
-                    return miv.value;
-                }
-            }
-            return null;
-        } else {
-            if (map == null) buildIfNeededMap();
-            return map.get(key);
-        }
-    }
-
-    public Value put(String key, Value value) {
-        die("Not that kind of map");
-        return null;
-    }
-
-    /**
-     * If the map has not been built yet, then we just return a fake entry set.
-     */
-
-    public Set<Entry<String, Value>> entrySet() {
-        buildIfNeededMap();
-        return map.entrySet();
-    }
-
-    /**
-     * Build the map if requested to, it does this lazily.
-     */
-    private void buildIfNeededMap() {
-        if (map == null) {
-            map = new HashMap<String, Value>(items.length);
-
-            for (Entry<String, Value> miv : items) {
-                if (miv == null) {
-                    break;
-                }
-                map.put(miv.getKey(), miv.getValue());
-            }
-        }
-    }
-
-    /**
-     * Return a collection of values.
-     */
-    public Collection<Value> values() {
-        this.buildIfNeededMap();
-        return map.values();
-    }
-
-    /**
-     * Return the size of the map. Use the map if it has already been created.
-     *
-     * @return size
-     */
-    public int size() {
-        this.buildIfNeededMap();
-        return map.size();
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringService.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringService.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringService.java
new file mode 100644
index 0000000..3e96459
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringService.java
@@ -0,0 +1,36 @@
+/*
+ *  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 org.apache.groovy.json;
+
+import org.apache.groovy.json.FastStringService;
+
+/**
+ * Internal class for fast processing of Strings during JSON parsing - default version
+ */
+public class DefaultFastStringService implements FastStringService {
+    @Override
+    public char[] toCharArray(String string) {
+        return string.toCharArray();
+    }
+
+    @Override
+    public String noCopyStringFromChars(char[] chars) {
+        return new String(chars);
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringServiceFactory.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringServiceFactory.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringServiceFactory.java
new file mode 100644
index 0000000..46d8a34
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/DefaultFastStringServiceFactory.java
@@ -0,0 +1,26 @@
+/*
+ *  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 org.apache.groovy.json;
+
+public class DefaultFastStringServiceFactory implements FastStringServiceFactory {
+    @Override
+    public FastStringService getService() {
+        return new DefaultFastStringService();
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringService.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringService.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringService.java
new file mode 100644
index 0000000..4381383
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringService.java
@@ -0,0 +1,33 @@
+/*
+ *  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 org.apache.groovy.json;
+
+public interface FastStringService {
+    /**
+     * @param string string to grab array from.
+     * @return char array from string
+     */
+    char[] toCharArray(String string);
+
+    /**
+     * @param chars to shove array into.
+     * @return new string with chars copied into it
+     */
+    String noCopyStringFromChars(char[] chars);
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringServiceFactory.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringServiceFactory.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringServiceFactory.java
new file mode 100644
index 0000000..6568793
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/FastStringServiceFactory.java
@@ -0,0 +1,28 @@
+/*
+ *  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 org.apache.groovy.json;
+
+/**
+ * Factory method to create the service. Should return null if the particular implementation
+ * isn't suitable because of the JDK environment (e.g. JVM version) or config settings otherwise
+ * disable the service.
+ */
+public interface FastStringServiceFactory {
+    FastStringService getService();
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ArrayUtils.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ArrayUtils.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ArrayUtils.java
new file mode 100644
index 0000000..4894f08
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ArrayUtils.java
@@ -0,0 +1,32 @@
+/*
+ *  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 org.apache.groovy.json.internal;
+
+/**
+ * @author Richard Hightower
+ */
+public class ArrayUtils {
+
+    public static char[] copyRange(char[] source, int startIndex, int endIndex) {
+        int len = endIndex - startIndex;
+        char[] copy = new char[len];
+        System.arraycopy(source, startIndex, copy, 0, Math.min(source.length - startIndex, len));
+        return copy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/BaseJsonParser.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/BaseJsonParser.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/BaseJsonParser.java
new file mode 100644
index 0000000..c2e58b2
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/BaseJsonParser.java
@@ -0,0 +1,228 @@
+/*
+ *  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 org.apache.groovy.json.internal;
+
+import groovy.json.JsonException;
+import groovy.json.JsonParser;
+import org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport;
+import org.codehaus.groovy.runtime.ResourceGroovyMethods;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Base JSON parser.
+ * Scaled down version of Boon JsonParser with features
+ * removed that are JDK 1.7 dependent or Groovy duplicated functionality.
+ *
+ * @author Rick Hightower
+ */
+public abstract class BaseJsonParser implements JsonParser {
+
+    protected static final int COLON = ':';
+    protected static final int COMMA = ',';
+    protected static final int CLOSED_CURLY = '}';
+    protected static final int CLOSED_BRACKET = ']';
+
+    protected static final int LETTER_E = 'e';
+    protected static final int LETTER_BIG_E = 'E';
+
+    protected static final int MINUS = '-';
+    protected static final int PLUS = '+';
+
+    protected static final int DECIMAL_POINT = '.';
+
+    protected static final int ALPHA_0 = '0';
+    protected static final int ALPHA_1 = '1';
+    protected static final int ALPHA_2 = '2';
+    protected static final int ALPHA_3 = '3';
+    protected static final int ALPHA_4 = '4';
+    protected static final int ALPHA_5 = '5';
+    protected static final int ALPHA_6 = '6';
+    protected static final int ALPHA_7 = '7';
+    protected static final int ALPHA_8 = '8';
+    protected static final int ALPHA_9 = '9';
+
+    protected static final int DOUBLE_QUOTE = '"';
+
+    protected static final int ESCAPE = '\\';
+
+    protected static final boolean internKeys = Boolean.parseBoolean(System.getProperty("groovy.json.internKeys", "false"));
+    protected static ConcurrentHashMap<String, String> internedKeysCache;
+
+    private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+    protected String charset = UTF_8.name();
+
+    private CharBuf fileInputBuf;
+
+    protected int bufSize = 256;
+
+    static {
+        if (internKeys) {
+            internedKeysCache = new ConcurrentHashMap<String, String>();
+        }
+    }
+
+    protected String charDescription(int c) {
+        String charString;
+        if (c == ' ') {
+            charString = "[SPACE]";
+        } else if (c == '\t') {
+            charString = "[TAB]";
+
+        } else if (c == '\n') {
+            charString = "[NEWLINE]";
+
+        } else {
+            charString = "'" + (char) c + "'";
+        }
+
+        charString = charString + " with an int value of " + ((int) c);
+        return charString;
+    }
+
+    public void setCharset(String charset) {
+        this.charset = charset;
+    }
+
+    public Object parse(String jsonString) {
+        return parse(FastStringUtils.toCharArray(jsonString));
+    }
+
+    public Object parse(byte[] bytes) {
+        return parse(bytes, charset);
+    }
+
+    public Object parse(byte[] bytes, String charset) {
+        try {
+            return parse(new String(bytes, charset));
+        } catch (UnsupportedEncodingException e) {
+            return Exceptions.handle(Object.class, e);
+        }
+    }
+
+    public Object parse(CharSequence charSequence) {
+        return parse(FastStringUtils.toCharArray(charSequence));
+    }
+
+    public Object parse(Reader reader) {
+        fileInputBuf = IO.read(reader, fileInputBuf, bufSize);
+        return parse(fileInputBuf.readForRecycle());
+    }
+
+    public Object parse(InputStream input) {
+        return parse(input, charset);
+    }
+
+    public Object parse(InputStream input, String charset) {
+        try {
+            return parse(new InputStreamReader(input, charset));
+        } catch (UnsupportedEncodingException e) {
+            return Exceptions.handle(Object.class, e);
+        }
+    }
+
+    public Object parse(File file, String charset) {
+        Reader reader = null;
+        try {
+            if (charset == null || charset.length() == 0) {
+                reader = ResourceGroovyMethods.newReader(file);
+            } else {
+                reader = ResourceGroovyMethods.newReader(file, charset);
+            }
+            return parse(reader);
+        } catch (IOException ioe) {
+            throw new JsonException("Unable to process file: " + file.getPath(), ioe);
+        } finally {
+            if (reader != null) {
+                DefaultGroovyMethodsSupport.closeWithWarning(reader);
+            }
+        }
+    }
+
+    protected static boolean isDecimalChar(int currentChar) {
+        switch (currentChar) {
+            case MINUS:
+            case PLUS:
+            case LETTER_E:
+            case LETTER_BIG_E:
+            case DECIMAL_POINT:
+                return true;
+        }
+        return false;
+    }
+
+    protected static boolean isDelimiter(int c) {
+        return c == COMMA || c == CLOSED_CURLY || c == CLOSED_BRACKET;
+    }
+
+    protected static final boolean isNumberDigit(int c) {
+        return c >= ALPHA_0 && c <= ALPHA_9;
+    }
+
+    protected static final boolean isDoubleQuote(int c) {
+        return c == DOUBLE_QUOTE;
+    }
+
+    protected static final boolean isEscape(int c) {
+        return c == ESCAPE;
+    }
+
+    protected static boolean hasEscapeChar(char[] array, int index, int[] indexHolder) {
+        char currentChar;
+        for (; index < array.length; index++) {
+            currentChar = array[index];
+            if (isDoubleQuote(currentChar)) {
+                indexHolder[0] = index;
+                return false;
+            } else if (isEscape(currentChar)) {
+                indexHolder[0] = index;
+                return true;
+            }
+        }
+
+        indexHolder[0] = index;
+        return false;
+    }
+
+    int[] indexHolder = new int[1];
+
+    protected static int findEndQuote(final char[] array, int index) {
+        char currentChar;
+        boolean escape = false;
+
+        for (; index < array.length; index++) {
+            currentChar = array[index];
+            if (isDoubleQuote(currentChar)) {
+                if (!escape) {
+                    break;
+                }
+            }
+            escape = isEscape(currentChar) && !escape;
+        }
+        return index;
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ByteScanner.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ByteScanner.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ByteScanner.java
new file mode 100644
index 0000000..8ddfb96
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/ByteScanner.java
@@ -0,0 +1,70 @@
+/*
+ *  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 org.apache.groovy.json.internal;
+
+import static org.apache.groovy.json.internal.Exceptions.die;
+
+/**
+ * @author Richard Hightower
+ */
+public class ByteScanner {
+
+    /**
+     * Turns a single nibble into an ascii HEX digit.
+     *
+     * @param nibble the nibble to serializeObject.
+     * @return the encoded nibble (1/2 byte).
+     */
+    protected static int encodeNibbleToHexAsciiCharByte(final int nibble) {
+        switch (nibble) {
+            case 0x00:
+            case 0x01:
+            case 0x02:
+            case 0x03:
+            case 0x04:
+            case 0x05:
+            case 0x06:
+            case 0x07:
+            case 0x08:
+            case 0x09:
+                return nibble + 0x30; // 0x30('0') - 0x39('9')
+            case 0x0A:
+            case 0x0B:
+            case 0x0C:
+            case 0x0D:
+            case 0x0E:
+            case 0x0F:
+                return nibble + 0x57; // 0x41('a') - 0x46('f')
+            default:
+                die("illegal nibble: " + nibble);
+                return -1;
+        }
+    }
+
+    /**
+     * Turn a single bytes into two hex character representation.
+     *
+     * @param decoded the byte to serializeObject.
+     * @param encoded the array to which each encoded nibbles are now ascii hex representations.
+     */
+    public static void encodeByteIntoTwoAsciiCharBytes(final int decoded, final byte[] encoded) {
+        encoded[0] = (byte) encodeNibbleToHexAsciiCharByte((decoded >> 4) & 0x0F);
+        encoded[1] = (byte) encodeNibbleToHexAsciiCharByte(decoded & 0x0F);
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/Cache.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/Cache.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/Cache.java
new file mode 100644
index 0000000..f5cfaaa
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/Cache.java
@@ -0,0 +1,40 @@
+/*
+ *  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 org.apache.groovy.json.internal;
+
+/**
+ * Cache
+ *
+ * @param <KEY>   key
+ * @param <VALUE> value
+ * @author Rick Hightower
+ */
+public interface Cache<KEY, VALUE> {
+
+    void put(KEY key, VALUE value);
+
+    VALUE get(KEY key);
+
+    VALUE getSilent(KEY key);
+
+    void remove(KEY key);
+
+    int size();
+}
+

http://git-wip-us.apache.org/repos/asf/groovy/blob/63bd67ba/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/CacheType.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/CacheType.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/CacheType.java
new file mode 100644
index 0000000..8d25bff
--- /dev/null
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/CacheType.java
@@ -0,0 +1,30 @@
+/*
+ *  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 org.apache.groovy.json.internal;
+
+/**
+ * @author Rick Hightower
+ */
+public enum CacheType {
+
+    LRU,
+    LFU,
+    FIFO
+}
+