Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–488 unchanged (488 lines)
489 * @param value a finite value. May not be {@link Double#isNaN() NaNs} or
490 * {@link Double#isInfinite() infinities}.
491 * @return this writer.
492 */
493 public JsonWriter value(double value) throws IOException {
494 writeDeferredName();
495 if (Double.isNaN(value) || Double.isInfinite(value)) {
496 throw new IllegalArgumentException("Numeric values must be finite, but was " + value);
497 }
498 beforeValue();
499 out.append(Double.toString(value));
500 return this;
501 }
…lines 502–660 unchanged (159 lines)

After

…lines 1–488 unchanged (488 lines)
489 * @param value a finite value. May not be {@link Double#isNaN() NaNs} or
490 * {@link Double#isInfinite() infinities}.
491 * @return this writer.
492 */
493 public JsonWriter value(double value) throws IOException {
494 writeDeferredName();
495 if (!lenient && (Double.isNaN(value) || Double.isInfinite(value))) {
496 throw new IllegalArgumentException("Numeric values must be finite, but was " + value);
497 }
498 beforeValue();
499 out.append(Double.toString(value));
500 return this;
501 }
…lines 502–660 unchanged (159 lines)

Before

program
block_comment "/*\n * Copyright (C) 2010 Google Inc.\n *\n * Licensed under th"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Closeable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Flushable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Writer"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "DANGLING_NAME"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_ARRAY"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_DOCUMENT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_OBJECT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_ARRAY"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_DOCUMENT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_OBJECT"
; ";"
block_comment "/**\n * Writes a JSON (<a href=\"http://www.ietf.org/rfc/rfc71"...
class_declaration
modifiers
public "public"
class "class"
identifier "JsonWriter"
super_interfaces
implements "implements"
type_list
type_identifier "Closeable"
, ","
type_identifier "Flushable"
class_body
{ "{"
block_comment "/*\n * From RFC 7159, \"All Unicode characters may be placed"...
field_declaration
modifiers
private "private"
static "static"
final "final"
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "REPLACEMENT_CHARS"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "HTML_SAFE_REPLACEMENT_CHARS"
; ";"
static_initializer (+248 nodes collapsed)
block_comment "/** The output data, containing at most one top-level array "...
field_declaration
modifiers
private "private"
final "final"
type_identifier "Writer"
variable_declarator
identifier "out"
; ";"
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "stackSize"
= "="
decimal_integer_literal "0"
; ";"
block
{ "{"
expression_statement
method_invocation
identifier "push"
argument_list
( "("
identifier "EMPTY_DOCUMENT"
) ")"
; ";"
} "}"
block_comment "/**\n * A string containing a full set of spaces for a sing"...
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "indent"
; ";"
block_comment "/**\n * The name/value separator; either \":\" or \": \".\n */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "separator"
= "="
string_literal
" "\""
string_fragment ":"
" "\""
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "lenient"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "htmlSafe"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "deferredName"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "serializeNulls"
= "="
true "true"
; ";"
block_comment "/**\n * Creates a new instance that writes a JSON-encoded s"...
constructor_declaration (+47 nodes collapsed)
block_comment "/**\n * Sets the indentation string to be repeated for each"...
method_declaration (+79 nodes collapsed)
block_comment "/**\n * Configure this writer to relax its syntax rules. By"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if this writer has relaxed syntax rule"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isLenient"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "lenient"
; ";"
} "}"
block_comment "/**\n * Configure this writer to emit JSON that's safe for "...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if this writer writes JSON that's safe"...
method_declaration
modifiers
public "public"
final "final"
boolean_type "boolean"
identifier "isHtmlSafe"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "htmlSafe"
; ";"
} "}"
block_comment "/**\n * Sets whether object members are serialized when the"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if object members are serialized when "...
method_declaration
modifiers
public "public"
final "final"
boolean_type "boolean"
identifier "getSerializeNulls"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "serializeNulls"
; ";"
} "}"
block_comment "/**\n * Begins encoding a new array. Each call to this meth"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Ends encoding the current array.\n *\n * @return "...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Begins encoding a new object. Each call to this met"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Ends encoding the current object.\n *\n * @return"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Enters a new scope by appending any necessary white"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n * Closes the current scope by appending any necessary"...
method_declaration (+136 nodes collapsed)
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Returns the value on the top of the stack.\n */"
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Replace the value on the top of the stack with the "...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Encodes the property name.\n *\n * @param name th"...
method_declaration (+98 nodes collapsed)
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value the l"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Writes {@code value} directly to the writer without"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * Encodes {@code null}.\n *\n * @return this writer"...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value a fin"...
method_declaration
modifiers
public "public"
type_identifier "JsonWriter"
identifier "value"
formal_parameters
( "("
formal_parameter
floating_point_type
double "double"
identifier "value"
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
expression_statement
method_invocation
identifier "writeDeferredName"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "Double"
. "."
identifier "isNaN"
argument_list
( "("
identifier "value"
) ")"
|| "||"
method_invocation
identifier "Double"
. "."
identifier "isInfinite"
argument_list
( "("
identifier "value"
) ")"
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "IllegalArgumentException"
argument_list
( "("
binary_expression
string_literal
" "\""
string_fragment "Numeric values must be finite, but was "
" "\""
+ "+"
identifier "value"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "beforeValue"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "out"
. "."
identifier "append"
argument_list
( "("
method_invocation
identifier "Double"
. "."
identifier "toString"
argument_list
( "("
identifier "value"
) ")"
) ")"
; ";"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value a fin"...
method_declaration (+147 nodes collapsed)
block_comment "/**\n * Ensures all buffered data is written to the underly"...
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Flushes and closes this writer and the underlying {"...
method_declaration (+81 nodes collapsed)
method_declaration (+291 nodes collapsed)
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Inserts any necessary separators and whitespace bef"...
method_declaration (+91 nodes collapsed)
block_comment "/**\n * Inserts any necessary separators and whitespace bef"...
method_declaration (+178 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright (C) 2010 Google Inc.\n *\n * Licensed under th"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Closeable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Flushable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Writer"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "DANGLING_NAME"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_ARRAY"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_DOCUMENT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "EMPTY_OBJECT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_ARRAY"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_DOCUMENT"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "gson"
. "."
identifier "stream"
. "."
identifier "JsonScope"
. "."
identifier "NONEMPTY_OBJECT"
; ";"
block_comment "/**\n * Writes a JSON (<a href=\"http://www.ietf.org/rfc/rfc71"...
class_declaration
modifiers
public "public"
class "class"
identifier "JsonWriter"
super_interfaces
implements "implements"
type_list
type_identifier "Closeable"
, ","
type_identifier "Flushable"
class_body
{ "{"
block_comment "/*\n * From RFC 7159, \"All Unicode characters may be placed"...
field_declaration
modifiers
private "private"
static "static"
final "final"
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "REPLACEMENT_CHARS"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "HTML_SAFE_REPLACEMENT_CHARS"
; ";"
static_initializer (+248 nodes collapsed)
block_comment "/** The output data, containing at most one top-level array "...
field_declaration
modifiers
private "private"
final "final"
type_identifier "Writer"
variable_declarator
identifier "out"
; ";"
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "stackSize"
= "="
decimal_integer_literal "0"
; ";"
block
{ "{"
expression_statement
method_invocation
identifier "push"
argument_list
( "("
identifier "EMPTY_DOCUMENT"
) ")"
; ";"
} "}"
block_comment "/**\n * A string containing a full set of spaces for a sing"...
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "indent"
; ";"
block_comment "/**\n * The name/value separator; either \":\" or \": \".\n */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "separator"
= "="
string_literal
" "\""
string_fragment ":"
" "\""
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "lenient"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "htmlSafe"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "deferredName"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "serializeNulls"
= "="
true "true"
; ";"
block_comment "/**\n * Creates a new instance that writes a JSON-encoded s"...
constructor_declaration (+47 nodes collapsed)
block_comment "/**\n * Sets the indentation string to be repeated for each"...
method_declaration (+79 nodes collapsed)
block_comment "/**\n * Configure this writer to relax its syntax rules. By"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if this writer has relaxed syntax rule"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isLenient"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "lenient"
; ";"
} "}"
block_comment "/**\n * Configure this writer to emit JSON that's safe for "...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if this writer writes JSON that's safe"...
method_declaration
modifiers
public "public"
final "final"
boolean_type "boolean"
identifier "isHtmlSafe"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "htmlSafe"
; ";"
} "}"
block_comment "/**\n * Sets whether object members are serialized when the"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns true if object members are serialized when "...
method_declaration
modifiers
public "public"
final "final"
boolean_type "boolean"
identifier "getSerializeNulls"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "serializeNulls"
; ";"
} "}"
block_comment "/**\n * Begins encoding a new array. Each call to this meth"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Ends encoding the current array.\n *\n * @return "...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Begins encoding a new object. Each call to this met"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Ends encoding the current object.\n *\n * @return"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Enters a new scope by appending any necessary white"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n * Closes the current scope by appending any necessary"...
method_declaration (+136 nodes collapsed)
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Returns the value on the top of the stack.\n */"
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Replace the value on the top of the stack with the "...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Encodes the property name.\n *\n * @param name th"...
method_declaration (+98 nodes collapsed)
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value the l"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Writes {@code value} directly to the writer without"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * Encodes {@code null}.\n *\n * @return this writer"...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value a fin"...
method_declaration
modifiers
public "public"
type_identifier "JsonWriter"
identifier "value"
formal_parameters
( "("
formal_parameter
floating_point_type
double "double"
identifier "value"
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
expression_statement
method_invocation
identifier "writeDeferredName"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "lenient"
&& "&&"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "Double"
. "."
identifier "isNaN"
argument_list
( "("
identifier "value"
) ")"
|| "||"
method_invocation
identifier "Double"
. "."
identifier "isInfinite"
argument_list
( "("
identifier "value"
) ")"
) ")"
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "IllegalArgumentException"
argument_list
( "("
binary_expression
string_literal
" "\""
string_fragment "Numeric values must be finite, but was "
" "\""
+ "+"
identifier "value"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "beforeValue"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "out"
. "."
identifier "append"
argument_list
( "("
method_invocation
identifier "Double"
. "."
identifier "toString"
argument_list
( "("
identifier "value"
) ")"
) ")"
; ";"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * Encodes {@code value}.\n *\n * @return this write"...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Encodes {@code value}.\n *\n * @param value a fin"...
method_declaration (+147 nodes collapsed)
block_comment "/**\n * Ensures all buffered data is written to the underly"...
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Flushes and closes this writer and the underlying {"...
method_declaration (+81 nodes collapsed)
method_declaration (+291 nodes collapsed)
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Inserts any necessary separators and whitespace bef"...
method_declaration (+91 nodes collapsed)
block_comment "/**\n * Inserts any necessary separators and whitespace bef"...
method_declaration (+178 nodes collapsed)
} "}"