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

1package org.jsoup.nodes;
2
3import org.jsoup.helper.Validate;
4
5import java.util.List;
6
7abstract class LeafNode extends Node {
8
9 Object value; // either a string value, or an attribute map (in the rare case multiple attributes are set)
10
11 protected final boolean hasAttributes() {
12 return value instanceof Attributes;
13 }
14
…lines 15–87 unchanged (73 lines)
88 public int childNodeSize() {
89 return 0;
90 }
91
92 @Override
93 protected List<Node> ensureChildNodes() {
94 throw new UnsupportedOperationException("Leaf Nodes do not have child nodes.");
95 }
96}
97

After

1package org.jsoup.nodes;
2
3import org.jsoup.helper.Validate;
4
5import java.util.Collections;
6import java.util.List;
7
8abstract class LeafNode extends Node {
9 private static final List<Node> EmptyNodes = Collections.emptyList();
10
11 Object value; // either a string value, or an attribute map (in the rare case multiple attributes are set)
12
13 protected final boolean hasAttributes() {
14 return value instanceof Attributes;
15 }
…lines 16–89 unchanged (74 lines)
90 public int childNodeSize() {
91 return 0;
92 }
93
94 @Override
95 protected List<Node> ensureChildNodes() {
96 return EmptyNodes;
97 }
98}
99

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "LeafNode"
superclass
extends "extends"
type_identifier "Node"
class_body
{ "{"
field_declaration
type_identifier "Object"
variable_declarator
identifier "value"
; ";"
line_comment "// either a string value, or an attribute map (in the rare c"...
method_declaration
modifiers
protected "protected"
final "final"
boolean_type "boolean"
identifier "hasAttributes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
instanceof_expression
identifier "value"
instanceof "instanceof"
type_identifier "Attributes"
; ";"
} "}"
method_declaration (+30 nodes collapsed)
method_declaration (+80 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration (+26 nodes collapsed)
method_declaration (+77 nodes collapsed)
method_declaration (+86 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
void_type "void"
identifier "doSetBaseUri"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "baseUri"
) ")"
block
{ "{"
line_comment "// noop"
} "}"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
integral_type
int "int"
identifier "childNodeSize"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "0"
; ";"
} "}"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
identifier "ensureChildNodes"
formal_parameters
( "("
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "UnsupportedOperationException"
argument_list
( "("
string_literal
" "\""
string_fragment "Leaf Nodes do not have child nodes."
" "\""
) ")"
; ";"
} "}"
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "LeafNode"
superclass
extends "extends"
type_identifier "Node"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "EmptyNodes"
= "="
method_invocation
identifier "Collections"
. "."
identifier "emptyList"
argument_list
( "("
) ")"
; ";"
field_declaration
type_identifier "Object"
variable_declarator
identifier "value"
; ";"
line_comment "// either a string value, or an attribute map (in the rare c"...
method_declaration
modifiers
protected "protected"
final "final"
boolean_type "boolean"
identifier "hasAttributes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
instanceof_expression
identifier "value"
instanceof "instanceof"
type_identifier "Attributes"
; ";"
} "}"
method_declaration (+30 nodes collapsed)
method_declaration (+80 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration (+26 nodes collapsed)
method_declaration (+77 nodes collapsed)
method_declaration (+86 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
void_type "void"
identifier "doSetBaseUri"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "baseUri"
) ")"
block
{ "{"
line_comment "// noop"
} "}"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
integral_type
int "int"
identifier "childNodeSize"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "0"
; ";"
} "}"
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
protected "protected"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
identifier "ensureChildNodes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "EmptyNodes"
; ";"
} "}"
} "}"