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.mockito.internal.util;
2
3
4public class Timer {
5
6 private final long durationMillis;
7 private long startTime = -1;
8
9 public Timer(long durationMillis) {
10 this.durationMillis = durationMillis;
11 }
12
13 /**
14 * Informs whether the timer is still counting down.
15 */
16 public boolean isCounting() {
…lines 17–20 unchanged (4 lines)
21 /**
22 * Starts the timer count down.
23 */
24 public void start() {
25 startTime = System.currentTimeMillis();
26 }
27
28}
29

After

1package org.mockito.internal.util;
2
3import org.mockito.exceptions.Reporter;
4
5public class Timer {
6
7 private final long durationMillis;
8 private long startTime = -1;
9
10 public Timer(long durationMillis) {
11 validateInput(durationMillis);
12 this.durationMillis = durationMillis;
13 }
14
15 /**
16 * Informs whether the timer is still counting down.
17 */
…lines 18–23 unchanged (6 lines)
24 * Starts the timer count down.
25 */
26 public void start() {
27 startTime = System.currentTimeMillis();
28 }
29
30 private void validateInput(long durationMillis) {
31 if (durationMillis < 0) {
32 new Reporter().cannotCreateTimerWithNegativeDurationTime(durationMillis);
33 }
34 }
35}
36

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "util"
; ";"
class_declaration
modifiers
public "public"
class "class"
identifier "Timer"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
integral_type
long "long"
variable_declarator
identifier "durationMillis"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "startTime"
= "="
unary_expression
- "-"
decimal_integer_literal "1"
; ";"
constructor_declaration
modifiers
public "public"
identifier "Timer"
formal_parameters
( "("
formal_parameter
integral_type
long "long"
identifier "durationMillis"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "durationMillis"
= "="
identifier "durationMillis"
; ";"
} "}"
block_comment "/**\n * Informs whether the timer is still counting down."...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Starts the timer count down.\n */"
method_declaration (+23 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "util"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "exceptions"
. "."
identifier "Reporter"
; ";"
class_declaration
modifiers
public "public"
class "class"
identifier "Timer"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
integral_type
long "long"
variable_declarator
identifier "durationMillis"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "startTime"
= "="
unary_expression
- "-"
decimal_integer_literal "1"
; ";"
constructor_declaration
modifiers
public "public"
identifier "Timer"
formal_parameters
( "("
formal_parameter
integral_type
long "long"
identifier "durationMillis"
) ")"
constructor_body
{ "{"
expression_statement
method_invocation
identifier "validateInput"
argument_list
( "("
identifier "durationMillis"
) ")"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "durationMillis"
= "="
identifier "durationMillis"
; ";"
} "}"
block_comment "/**\n * Informs whether the timer is still counting down."...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Starts the timer count down.\n */"
method_declaration (+23 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "validateInput"
formal_parameters
( "("
formal_parameter
integral_type
long "long"
identifier "durationMillis"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "durationMillis"
< "<"
decimal_integer_literal "0"
) ")"
block
{ "{"
expression_statement
method_invocation
object_creation_expression
new "new"
type_identifier "Reporter"
argument_list
( "("
) ")"
. "."
identifier "cannotCreateTimerWithNegativeDurationTime"
argument_list
( "("
identifier "durationMillis"
) ")"
; ";"
} "}"
} "}"
} "}"