first commit, reading primitives, testfiles

This commit is contained in:
Sander Hautvast 2020-07-07 16:56:03 +02:00
commit e1874de683
334 changed files with 1245 additions and 0 deletions

17
.gitignore vendored Normal file
View file

@ -0,0 +1,17 @@
# Created by .ignore support plugin (hsz.mobi)
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
*.iml
out/
.idea/

View file

@ -0,0 +1,68 @@
package nl.sander.jsontoy2;
import java.nio.ByteBuffer;
import java.nio.charset.*;
/**
* storage like ArrayList, with specialized array
*/
public class ByteBuf {
private ByteBuffer data;
public ByteBuf() {
this(64);
}
public ByteBuf(final int initialSize) {
data = ByteBuffer.allocate(initialSize);
}
public String toString() {
data.flip();
CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder(); // decode is not threadsafe, might put it in threadlocal
// but I don't think this (newDecoder()+config) is expensive
decoder.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE)
;
try {
return decoder.decode(data).toString();
} catch (CharacterCodingException e) {
throw new JsonReadException(e);
}
}
public void clear() {
data.clear();
}
public void add(final byte c) {
if (data.remaining() == 0) {
enlarge(1);
}
data.put(c);
}
public void add(final byte[] c) {
if (data.remaining() < c.length) {
enlarge(c.length);
}
data.put(c);
}
private void enlarge(final int size) {
final int length1 = 2 * data.limit();
final int length2 = data.limit() + size;
ByteBuffer newData = ByteBuffer.allocate(Math.max(length1, length2));
data.flip();
newData.put(data);
data = newData;
}
public int length() {
return data.limit() - data.remaining();
}
}

View file

@ -0,0 +1,183 @@
package nl.sander.jsontoy2;
import java.io.*;
import java.nio.ByteBuffer;
public class IoReader {
private static final int HEX_RADIX = 16;
private final InputStream inputStream;
private final ByteBuf characterBuffer = new ByteBuf();
private final ByteBuf encodedCodePointBuffer = new ByteBuf(4);
private boolean escaping = false;
private boolean encoded = false;
private final ByteBuffer convertBuffer = ByteBuffer.allocate(4);
private byte current;
private int linecount = 0;
protected IoReader(InputStream inputStream) {
this.inputStream = inputStream;
advance();
}
protected IoReader(String jsonString) {
this.inputStream = new ByteArrayInputStream(jsonString.getBytes());
advance();
}
public Integer readInteger() {
String value = readNumeric();
return Double.valueOf(value).intValue();
}
public Long readLong() {
String value = readNumeric();
return Long.parseLong(value);
}
public Float readFloat() {
String value = readNumeric();
return Float.parseFloat(value);
}
public Double readDouble() {
String value = readNumeric();
return Double.parseDouble(value);
}
public Short readShort() {
String value = readNumeric();
return Short.parseShort(value);
}
public Byte readByte() {
String value = readNumeric();
return Byte.parseByte(value);
}
public Character readCharacter() {
eat('\"');
char currentChar = (char) current;
eat('\"');
return currentChar;
}
public Boolean readBoolean() {
characterBuffer.clear();
while (Character.isAlphabetic(current)) {
characterBuffer.add(current);
advance();
}
return characterBuffer.toString().equalsIgnoreCase("TRUE");
}
boolean isNumeric(int c) {
return Character.isDigit(c) || c == '.' || c == 'e' || c == '-' || c == '+';
}
private String readNumeric() {
characterBuffer.clear();
if (current == '-') {
characterBuffer.add(current);
advance();
}
while (current > -1 && isNumeric(current)) {
characterBuffer.add(current);
advance();
}
return characterBuffer.toString();
}
public String readString() {
eat('\"');
characterBuffer.clear();
boolean endOfString = false;
while (current > -1 && !endOfString) {
if (current == '\\' && !escaping) {
escaping = true;
} else {
if (!escaping) {
// regular character
if (current != '\"') {
characterBuffer.add(current);
} else {
endOfString = true;
}
} else {
// json encoded string
if (current == 'u') {
encoded = true;
} else if (current == 'n') {
linecount++;
characterBuffer.add("\n".getBytes());
escaping = false;
} else if (current == '\"') {
characterBuffer.add("\"".getBytes());
escaping = false;
} else if (current == '\'') {
throw new JsonReadException("illegal escaped quote in line " + linecount);
} else {
if (encoded) {
// load next 4 characters in special buffer
encodedCodePointBuffer.add(current);
if (encodedCodePointBuffer.length() == 4) {
byte[] bytes = parseCodePoint();
characterBuffer.add(bytes);
encoded = false;
escaping = false;
}
}
}
}
}
advance();
}
if (current != -1) {
advance();
}
return characterBuffer.toString();
}
private byte[] parseCodePoint() {
String hex = encodedCodePointBuffer.toString();
int codepoint = Integer.parseInt(hex, HEX_RADIX);
convertBuffer.clear();
encodedCodePointBuffer.clear();
return convertBuffer.putInt(codepoint).array();
}
void advance() {
try {
current = (byte)inputStream.read();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
void skipWhitespace() {
try {
while (current > -1 && Character.isWhitespace(current)) {
current = (byte)inputStream.read();
}
if (current == -1) {
throw new JsonReadException("end of source reached");
}
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
String eat(char until) {
characterBuffer.clear();
while (current > -1 && (current != until | Character.isWhitespace(current))) {
characterBuffer.add(current);
advance();
}
advance();
return characterBuffer.toString();
}
}

View file

@ -0,0 +1,7 @@
package nl.sander.jsontoy2;
import java.io.Reader;
public interface JsonObjectReader<T> {
T read(IoReader ioReader);
}

View file

@ -0,0 +1,12 @@
package nl.sander.jsontoy2;
public class JsonReadException extends RuntimeException {
public JsonReadException(String message) {
super(message);
}
public JsonReadException(Throwable e) {
super(e);
}
}

View file

@ -0,0 +1,60 @@
package nl.sander.jsontoy2;
import nl.sander.jsontoy2.readers.*;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* public facade
*/
public class JsonReader {
private static final ConcurrentMap<Class<?>, JsonObjectReader<?>> readers = new ConcurrentHashMap<>();
public static <T> T read(Class<T> type, InputStream reader) {
return read(type, new IoReader(reader));
}
public static <T> T read(Class<T> type, String jsonString) {
return read(type, new IoReader(jsonString));
}
@SuppressWarnings("unchecked")
public static <T> T read(Class<T> type, IoReader ioReader) {
return (T) getReader(type).read(ioReader);
// class.cast() does not work for primitives;
}
private static <T> JsonObjectReader<?> getReader(Class<T> type) {
return readers.get(type);
}
public static <T> void register(Class<T> type, JsonObjectReader<T> objectReader) {
readers.put(type, objectReader);
}
static {
register(Boolean.class, new BooleanReader());
register(boolean.class, new BooleanReader());
register(Integer.class, new IntegerReader());
register(int.class, new IntegerReader());
register(Long.class, new LongReader());
register(long.class, new LongReader());
register(Byte.class, new ByteReader());
register(byte.class, new ByteReader());
register(Short.class, new ShortReader());
register(short.class, new ShortReader());
register(Double.class, new DoubleReader());
register(double.class, new DoubleReader());
register(Float.class, new FloatReader());
register(float.class, new FloatReader());
register(Date.class, new DateReader());
register(Character.class, new CharReader());
register(char.class, new CharReader());
register(String.class, new StringReader());
register(LocalDateTime.class, new LocalDateTimeReader());
}
}

View file

@ -0,0 +1,37 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
import java.util.function.Function;
import java.util.function.Supplier;
public abstract class AbstractDatesReader<T> {
private static final ZoneId zone = ZoneId.systemDefault();
public static final DateTimeFormatter formatter = new DateTimeFormatterBuilder()
// date and time
.appendPattern("yyyy-MM-dd'T'HH:mm:ss.SSS")
// optional offset - prints +0000 when it's zero (instead of Z)
.optionalStart().appendOffset("+HHMM", "+0000").optionalEnd()
// optional zone id (so it parses "Z")
.optionalStart()
.appendZoneId()
// add default value for offset seconds when field is not present
.parseDefaulting(ChronoField.OFFSET_SECONDS, 0)
.optionalEnd()
// create formatter using the "UTC-cloned" zone
.toFormatter().withZone(zone);
protected ZonedDateTime getZonedDateTime(Supplier<String> supplier) {
return formatter.parse(supplier.get(), ZonedDateTime::from);
}
}

View file

@ -0,0 +1,10 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
public class BooleanReader implements nl.sander.jsontoy2.JsonObjectReader<Boolean> {
@Override
public Boolean read(IoReader ioReader) {
return ioReader.readBoolean();
}
}

View file

@ -0,0 +1,11 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class ByteReader implements JsonObjectReader<Byte> {
@Override
public Byte read(IoReader ioReader) {
return ioReader.readByte();
}
}

View file

@ -0,0 +1,11 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class CharReader implements JsonObjectReader<Character> {
@Override
public Character read(IoReader ioReader) {
return ioReader.readCharacter();
}
}

View file

@ -0,0 +1,22 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
import java.util.Date;
public class DateReader extends AbstractDatesReader<Date> implements JsonObjectReader<Date> {
@Override
public Date read(IoReader ioReader) {
ZonedDateTime zdt = getZonedDateTime(ioReader::readString);
return Date.from(zdt.toInstant());
}
}

View file

@ -0,0 +1,14 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
import java.io.Reader;
public class DoubleReader implements JsonObjectReader<Double> {
@Override
public Double read(IoReader ioReader) {
return ioReader.readDouble();
}
}

View file

@ -0,0 +1,12 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class FloatReader implements JsonObjectReader<Float> {
@Override
public Float read(IoReader ioReader) {
return ioReader.readFloat();
}
}

View file

@ -0,0 +1,11 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class IntegerReader implements JsonObjectReader<Integer> {
@Override
public Integer read(IoReader ioReader) {
return ioReader.readInteger();
}
}

View file

@ -0,0 +1,17 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
public class LocalDateTimeReader extends AbstractDatesReader<LocalDateTime> implements JsonObjectReader<LocalDateTime> {
@Override
public LocalDateTime read(IoReader ioReader) {
ZonedDateTime zdt = getZonedDateTime(ioReader::readString);
return LocalDateTime.from(zdt);
}
}

View file

@ -0,0 +1,11 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class LongReader implements JsonObjectReader<Long> {
@Override
public Long read(IoReader ioReader) {
return ioReader.readLong();
}
}

View file

@ -0,0 +1,12 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class ShortReader implements JsonObjectReader<Short> {
@Override
public Short read(IoReader ioReader) {
return ioReader.readShort();
}
}

View file

@ -0,0 +1,12 @@
package nl.sander.jsontoy2.readers;
import nl.sander.jsontoy2.IoReader;
import nl.sander.jsontoy2.JsonObjectReader;
public class StringReader implements JsonObjectReader<String> {
@Override
public String read(IoReader ioReader) {
return ioReader.readString();
}
}

View file

@ -0,0 +1,25 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
public class Booleans {
@Test
public void testTrue() {
assertEquals(true, JsonReader.read(Boolean.class, "true"));
}
@Test
public void testFalse() {
assertEquals(false, JsonReader.read(Boolean.class, "false"));
}
@Test
public void testPrimitiveFalse() {
boolean value = JsonReader.read(boolean.class, "false");
assertFalse(value);
}
}

View file

@ -0,0 +1,58 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class ByteBufTest {
@Test
public void testAdd(){
ByteBuf c=new ByteBuf(1);
c.add("1".getBytes(StandardCharsets.UTF_8));
assertEquals("1", c.toString());
}
@Test
public void testExpansion(){
ByteBuf c=new ByteBuf(1);
c.add("1".getBytes());
c.add("2".getBytes());
assertEquals("12", c.toString());
}
@Test
public void testClear(){
ByteBuf c=new ByteBuf(1);
c.add("1".getBytes());
c.clear();
c.add("2".getBytes());
assertEquals("2", c.toString());
}
@Test
public void testLength(){
ByteBuf c=new ByteBuf(10);
c.add("1".getBytes());
c.clear();
c.add("2".getBytes());
assertEquals(1, c.length());
}
@Test
public void testUtf(){
ByteBuf c=new ByteBuf(1);
c.add("".getBytes(StandardCharsets.UTF_8));
assertEquals("", c.toString());
}
@Test
public void testIllegalUtf(){
ByteBuf c=new ByteBuf(1);
c.add(new byte[]{0,0,-40,0});
assertEquals("\u0000\u0000<EFBFBD>\u0000", c.toString());
}
}

View file

@ -0,0 +1,27 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Bytes {
@Test
public void testSimpleByte() {
assertEquals((byte) 0, JsonReader.read(Byte.class, "0"));
}
@Test
public void testSimplePrimitiveLong() {
assertEquals((byte) 1, JsonReader.read(Byte.class, "1"));
}
@Test
public void testSimpleNegativeLong() {
assertEquals((byte) -20, JsonReader.read(Byte.class, "-20"));
}
@Test
public void testSimpleNegativePrimitiveLong() {
assertEquals(Byte.MIN_VALUE, JsonReader.read(Byte.class, "-128"));
}
}

View file

@ -0,0 +1,24 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Chars {
@Test
public void testSimpleChar() {
assertEquals('a', JsonReader.read(Character.class, "\"a\""));
}
@Test
public void testSimplePrimitiveChar() {
assertEquals('A', JsonReader.read(char.class, "\"A\""));
}
@Test
public void testTooLongChar() {
assertEquals('A', JsonReader.read(char.class, "\"AB\""));
}
}

View file

@ -0,0 +1,36 @@
package nl.sander.jsontoy2;
import nl.sander.jsontoy2.readers.AbstractDatesReader;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Reader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.TimeZone;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Dates {
@Test
public void testDate() throws ParseException {
Date value = JsonReader.read(Date.class, "\"2012-04-23T18:25:43.511Z\"");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
Date expected = simpleDateFormat.parse("2012-04-23T18:25:43.511Z");
assertEquals(expected, value);
}
@Test
public void testLocalDateTime() {
LocalDateTime value = JsonReader.read(LocalDateTime.class, "\"2012-04-23T18:25:43.511Z\"");
LocalDateTime expected = LocalDateTime.parse("2012-04-23T18:25:43.511Z", AbstractDatesReader.formatter);
assertEquals(expected, value);
}
}

View file

@ -0,0 +1,47 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Doubles {
@Test
public void testSmallDouble() {
Double value = JsonReader.read(Double.class, "123.456e-289");
assertEquals(123.456e-289D, value);
}
@Test
public void testLargeDouble() {
Double value = JsonReader.read(Double.class, "999999999999999999999999999999999999999999999999999999.4e99");
assertEquals(999999999999999999999999999999999999999999999999999999.4e99D, value);
}
@Test
public void testNegativeDouble() {
Double value = JsonReader.read(Double.class, "-1.2e+9");
assertEquals(-1.2e+9D, value);
}
@Test
public void testNegativeDoubleOverflow() {
Double value = JsonReader.read(Double.class, "-1.2e+100000");
assertEquals(Double.NEGATIVE_INFINITY, value);
}
@Test
public void testNegativeFloatUnderflow() {
Double value = JsonReader.read(Double.class, "-1.2e-100000");
assertEquals(-0D, value);
}
@Test
public void testPositiveFloatUnderflow() {
Double value = JsonReader.read(Double.class, "1.2e-100000");
assertEquals(0D, value);
}
}

View file

@ -0,0 +1,47 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Floats {
@Test
public void testSmallFloat() {
Float value = JsonReader.read(Float.class, "123.456e-28");
assertEquals(123.456e-28F, value);
}
@Test
public void testLargeFloat() {
Float value = JsonReader.read(Float.class, "9999.4e29");
assertEquals(9999.4e29F, value);
}
@Test
public void testNegativeFloat() {
Float value = JsonReader.read(Float.class, "-1.2e+9");
assertEquals(-1.2e+9F, value);
}
@Test
public void testNegativeFloatOverflow() {
Float value = JsonReader.read(Float.class, "-1.2e+100000");
assertEquals(Float.NEGATIVE_INFINITY, value);
}
@Test
public void testNegativeFloatUnderflow() {
Float value = JsonReader.read(Float.class, "-1.2e-100000");
assertEquals(-0F, value);
}
@Test
public void testPositiveFloatUnderflow() {
Float value = JsonReader.read(Float.class, "1.2e-100000");
assertEquals(0F, value);
}
}

View file

@ -0,0 +1,40 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Ints {
@Test
public void testSimpleInt(){
assertEquals(1,JsonReader.read(Integer.class,"1"));
}
@Test
public void testSimplePrimitiveInt(){
assertEquals(1,JsonReader.read(int.class,"1"));
}
@Test
public void testSimpleNegativeInt(){
assertEquals(-20001,JsonReader.read(Integer.class,"-20001"));
}
@Test
public void testSimpleNegativePrimitiveInt(){
assertEquals(Integer.MIN_VALUE,JsonReader.read(int.class,"-2147483684"));
}
@Test
public void testNegativeScientificNotation() {
Integer value = JsonReader.read(Integer.class, "-1e+9");
assertEquals(-1000000000, value);
}
@Test
public void testPositiveScientificNotation() {
Integer value = JsonReader.read(Integer.class, "1e+9");
assertEquals(1000000000, value);
}
}

View file

@ -0,0 +1,27 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Longs {
@Test
public void testSimpleLong(){
assertEquals(0,JsonReader.read(Long.class,"0"));
}
@Test
public void testSimplePrimitiveLong(){
assertEquals(1,JsonReader.read(long.class,"1"));
}
@Test
public void testSimpleNegativeLong(){
assertEquals(-20001,JsonReader.read(Long.class,"-20001"));
}
@Test
public void testSimpleNegativePrimitiveLong(){
assertEquals(Long.MIN_VALUE,JsonReader.read(long.class,"-9223372036854775808"));
}
}

View file

@ -0,0 +1,28 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Shorts {
@Test
public void testSimpleShort() {
assertEquals((short) 1, JsonReader.read(Short.class, "1"));
}
@Test
public void testSimplePrimitiveShort() {
assertEquals((short) 1, JsonReader.read(short.class, "1"));
}
@Test
public void testSimpleNegativeShort() {
assertEquals((short) -100, JsonReader.read(Short.class, "-100"));
}
@Test
public void testSimpleNegativePrimitiveShort() {
assertEquals((short) -100, JsonReader.read(short.class, "-100"));
}
}

View file

@ -0,0 +1,54 @@
package nl.sander.jsontoy2;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class Strings {
@Test
public void regular() {
assertEquals("DADA", JsonReader.read(String.class, "\"DADA\""));
}
@Test
public void firstSurrogateButSecondMissing() throws NoSuchFieldException, IllegalAccessException {
String value = JsonReader.read(String.class, "\"\\uDADA\"");
assertEquals("\u0000\u0000<EFBFBD><EFBFBD>", value); // question mark
}
@Test
public void incompleteSurrogateAndEscapeValid() {
String value = JsonReader.read(String.class, "\"\\uD800\n\"");
assertEquals("\u0000\u0000<EFBFBD>\u0000\n", value);
}
@Test
public void firstValidSurrogateSecondInvalid() throws CharacterCodingException {
String value = JsonReader.read(String.class, "\"\\uD888\\u1334\"");
assertEquals("\u0000\u0000؈\u0000\u0000\u00134",value);
}
@Test
public void escapedDoubleQuote() {
String value = JsonReader.read(String.class, "\"\\\"\"");
assertEquals("\"", value);
}
@Test
public void escapedSingleQuote() {
assertThrows(JsonReadException.class, () -> JsonReader.read(String.class, "\"\\\'\""));
}
}

View file

@ -0,0 +1 @@
{"\uDFAA":0}

Binary file not shown.

View file

@ -0,0 +1 @@
["譌・ム淫"]

View file

@ -0,0 +1 @@
["<22><><EFBFBD>"]

View file

@ -0,0 +1 @@
["\uDd1ea"]

View file

@ -0,0 +1 @@
["\uD800\uD800\n"]

View file

@ -0,0 +1 @@
["\ud800"]

View file

@ -0,0 +1 @@
["\ud800abc"]

View file

@ -0,0 +1 @@
["<22>"]

View file

@ -0,0 +1 @@
["\uDd1e\uD834"]

View file

@ -0,0 +1 @@
["И"]

View file

@ -0,0 +1 @@
["\uDFAA"]

View file

@ -0,0 +1 @@
["<22>"]

View file

@ -0,0 +1 @@
["<22><><EFBFBD><EFBFBD>"]

View file

@ -0,0 +1 @@
["<22><>"]

View file

@ -0,0 +1 @@
["<22>ソソソソ"]

View file

@ -0,0 +1 @@
["<22>€€€€"]

View file

@ -0,0 +1 @@
["<22><>"]

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
[1 true]

View file

@ -0,0 +1 @@
[a

View file

@ -0,0 +1 @@
["": 1]

View file

@ -0,0 +1 @@
[""],

View file

@ -0,0 +1 @@
[,1]

View file

@ -0,0 +1 @@
[1,,2]

View file

@ -0,0 +1 @@
["x",,]

View file

@ -0,0 +1 @@
["x"]]

View file

@ -0,0 +1 @@
["",]

View file

@ -0,0 +1 @@
["x"

View file

@ -0,0 +1 @@
[x

View file

@ -0,0 +1 @@
[3[4]]

View file

@ -0,0 +1 @@
[<EFBFBD>]

View file

@ -0,0 +1 @@
[1:2]

View file

@ -0,0 +1 @@
[,]

View file

@ -0,0 +1 @@
[-]

View file

@ -0,0 +1 @@
[ , ""]

View file

@ -0,0 +1,3 @@
["a",
4
,1,

View file

@ -0,0 +1 @@
[1,]

View file

@ -0,0 +1 @@
[1,,]

View file

@ -0,0 +1 @@
[" a"\f]

View file

@ -0,0 +1 @@
[*]

View file

@ -0,0 +1 @@
[""

View file

@ -0,0 +1 @@
[1,

View file

@ -0,0 +1,3 @@
[1,
1
,1

View file

@ -0,0 +1 @@
[{}

View file

@ -0,0 +1 @@
[fals]

View file

@ -0,0 +1 @@
[nul]

View file

@ -0,0 +1 @@
[tru]

Binary file not shown.

View file

@ -0,0 +1 @@
[++1234]

View file

@ -0,0 +1 @@
[+1]

View file

@ -0,0 +1 @@
[+Inf]

View file

@ -0,0 +1 @@
[-01]

View file

@ -0,0 +1 @@
[-1.0.]

View file

@ -0,0 +1 @@
[-2.]

View file

@ -0,0 +1 @@
[-NaN]

View file

@ -0,0 +1 @@
[.-1]

View file

@ -0,0 +1 @@
[.2e-3]

View file

@ -0,0 +1 @@
[0.1.2]

View file

@ -0,0 +1 @@
[0.3e+]

View file

@ -0,0 +1 @@
[0.3e]

View file

@ -0,0 +1 @@
[0.e1]

View file

@ -0,0 +1 @@
[0E+]

View file

@ -0,0 +1 @@
[0E]

View file

@ -0,0 +1 @@
[0e+]

View file

@ -0,0 +1 @@
[0e]

View file

@ -0,0 +1 @@
[1.0e+]

View file

@ -0,0 +1 @@
[1.0e-]

Some files were not shown because too many files have changed in this diff Show more