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–47 unchanged (47 lines)
48 static <T> T checkNotNull(T obj, String message) {
49 if (obj == null) {
50 throw new NullPointerException(message);
51 }
52 return obj;
53 }
54
55 /**
56 * Helper called by generated code to construct default values for string fields.
57 *
58 * <p>The protocol compiler does not actually contain a UTF-8 decoder -- it just pushes
59 * UTF-8-encoded text around without touching it. The one place where this presents a problem is
60 * when generating Java string literals. Unicode characters in the string literal would normally
…lines 61–705 unchanged (645 lines)

After

…lines 1–48 unchanged (48 lines)
49 if (obj == null) {
50 throw new NullPointerException(message);
51 }
52 return obj;
53 }
54
55 /**
56 * Throws an {@link IllegalArgumentException} for unrecognized enum values.
57 *
58 * <p>Used from Enum.getNumber().
59 *
60 * @return nothing, but typed as int, so we can "return" the result of this method directly from
61 * Enum.getNumber(), generating smaller dex code for every enum.
62 */
63 @DoNotInline
64 public static int throwCannotGetNumberOfUnrecognized() {
65 throw new IllegalArgumentException("Can't get the number of an unknown enum value.");
66 }
67
68 /**
69 * Helper called by generated code to construct default values for string fields.
70 *
71 * <p>The protocol compiler does not actually contain a UTF-8 decoder -- it just pushes
72 * UTF-8-encoded text around without touching it. The one place where this presents a problem is
…lines 73–718 unchanged (646 lines)

Before

program
line_comment "// Protocol Buffers - Google's data interchange format"
line_comment "// Copyright 2008 Google Inc. All rights reserved."
line_comment "//"
line_comment "// Use of this source code is governed by a BSD-style"
line_comment "// license that can be found in the LICENSE file or at"
line_comment "// https://developers.google.com/open-source/licenses/bsd"
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "protobuf"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "StandardCharsets"
. "."
identifier "ISO_8859_1"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "StandardCharsets"
. "."
identifier "UTF_8"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "Buffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "ByteBuffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "RandomAccess"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * The classes contained within are used internally by t"...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "Internal"
class_body
{ "{"
constructor_declaration
modifiers
private "private"
identifier "Internal"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
block_comment "/** Throws an appropriate {@link NullPointerException} if th"...
method_declaration (+47 nodes collapsed)
block_comment "/** Throws an appropriate {@link NullPointerException} if th"...
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+34 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Create a new ByteBuffer and copy all the content of"...
method_declaration (+100 nodes collapsed)
block_comment "/**\n * Helper called by generated code to determine if a b"...
method_declaration (+25 nodes collapsed)
block_comment "/** Like {@link #isValidUtf8(ByteString)} but for byte array"...
method_declaration (+31 nodes collapsed)
block_comment "/** Helper method to get the UTF-8 bytes of a string. */"
method_declaration (+31 nodes collapsed)
block_comment "/** Helper method to convert a byte array to a string using "...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * Interface for an enum value or value descriptor, to"...
interface_declaration
modifiers
public "public"
interface "interface"
identifier "EnumLite"
interface_body
{ "{"
method_declaration
integral_type
int "int"
identifier "getNumber"
formal_parameters
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Interface for an object which maps integers to {@li"...
interface_declaration (+27 nodes collapsed)
block_comment "/** Interface for an object which verifies integers are in r"...
interface_declaration
modifiers
public "public"
interface "interface"
identifier "EnumVerifier"
interface_body
{ "{"
method_declaration
boolean_type "boolean"
identifier "isInRange"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "number"
) ")"
; ";"
} "}"
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+26 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+64 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+138 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+71 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+43 nodes collapsed)
block_comment "/** Helper method for implementing {@link LiteralByteString#"...
method_declaration (+67 nodes collapsed)
block_comment "/** Helper method for continuously hashing bytes. */"
method_declaration (+81 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+106 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+126 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+61 nodes collapsed)
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "DEFAULT_BUFFER_SIZE"
= "="
decimal_integer_literal "4096"
; ";"
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+274 nodes collapsed)
method_declaration (+104 nodes collapsed)
block_comment "/** An empty byte array constant used in generated code. */"
field_declaration (+23 nodes collapsed)
block_comment "/** An empty byte array constant used in generated code. */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "ByteBuffer"
variable_declarator
identifier "EMPTY_BYTE_BUFFER"
= "="
method_invocation
identifier "ByteBuffer"
. "."
identifier "wrap"
argument_list
( "("
identifier "EMPTY_BYTE_ARRAY"
) ")"
; ";"
block_comment "/** An empty coded input stream constant used in generated c"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "CodedInputStream"
variable_declarator
identifier "EMPTY_CODED_INPUT_STREAM"
= "="
method_invocation
identifier "CodedInputStream"
. "."
identifier "newInstance"
argument_list
( "("
identifier "EMPTY_BYTE_ARRAY"
) ")"
; ";"
block_comment "/** Helper method to merge two MessageLite instances. */"
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Provides an immutable view of {@code List<T>} aroun"...
class_declaration (+169 nodes collapsed)
block_comment "/**\n * Provides an immutable view of {@code List<T>} aroun"...
class_declaration (+188 nodes collapsed)
block_comment "/** Wrap around a {@code Map<K, RealValue>} and provide a {@"...
class_declaration (+1148 nodes collapsed)
block_comment "/**\n * Extends {@link List} to add the capability to make "...
interface_declaration (+58 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+77 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
} "}"

After

program
line_comment "// Protocol Buffers - Google's data interchange format"
line_comment "// Copyright 2008 Google Inc. All rights reserved."
line_comment "//"
line_comment "// Use of this source code is governed by a BSD-style"
line_comment "// license that can be found in the LICENSE file or at"
line_comment "// https://developers.google.com/open-source/licenses/bsd"
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "protobuf"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "StandardCharsets"
. "."
identifier "ISO_8859_1"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "StandardCharsets"
. "."
identifier "UTF_8"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "Buffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "ByteBuffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "AbstractSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "RandomAccess"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * The classes contained within are used internally by t"...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "Internal"
class_body
{ "{"
constructor_declaration
modifiers
private "private"
identifier "Internal"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
block_comment "/** Throws an appropriate {@link NullPointerException} if th"...
method_declaration (+47 nodes collapsed)
block_comment "/** Throws an appropriate {@link NullPointerException} if th"...
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Throws an {@link IllegalArgumentException} for unre"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "DoNotInline"
public "public"
static "static"
integral_type
int "int"
identifier "throwCannotGetNumberOfUnrecognized"
formal_parameters
( "("
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "IllegalArgumentException"
argument_list
( "("
string_literal
" "\""
string_fragment "Can't get the number of an unknown enum value."
" "\""
) ")"
; ";"
} "}"
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+34 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Helper called by generated code to construct defaul"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Create a new ByteBuffer and copy all the content of"...
method_declaration (+100 nodes collapsed)
block_comment "/**\n * Helper called by generated code to determine if a b"...
method_declaration (+25 nodes collapsed)
block_comment "/** Like {@link #isValidUtf8(ByteString)} but for byte array"...
method_declaration (+31 nodes collapsed)
block_comment "/** Helper method to get the UTF-8 bytes of a string. */"
method_declaration (+31 nodes collapsed)
block_comment "/** Helper method to convert a byte array to a string using "...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * Interface for an enum value or value descriptor, to"...
interface_declaration
modifiers
public "public"
interface "interface"
identifier "EnumLite"
interface_body
{ "{"
method_declaration
integral_type
int "int"
identifier "getNumber"
formal_parameters
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Interface for an object which maps integers to {@li"...
interface_declaration (+27 nodes collapsed)
block_comment "/** Interface for an object which verifies integers are in r"...
interface_declaration
modifiers
public "public"
interface "interface"
identifier "EnumVerifier"
interface_body
{ "{"
method_declaration
boolean_type "boolean"
identifier "isInRange"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "number"
) ")"
; ";"
} "}"
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Helper method for implementing {@link Message#hashC"...
method_declaration (+26 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+64 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+138 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+71 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+43 nodes collapsed)
block_comment "/** Helper method for implementing {@link LiteralByteString#"...
method_declaration (+67 nodes collapsed)
block_comment "/** Helper method for continuously hashing bytes. */"
method_declaration (+81 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+106 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#equals(Obj"...
method_declaration (+126 nodes collapsed)
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+61 nodes collapsed)
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "DEFAULT_BUFFER_SIZE"
= "="
decimal_integer_literal "4096"
; ";"
block_comment "/** Helper method for implementing {@link Message#hashCode()"...
method_declaration (+274 nodes collapsed)
method_declaration (+104 nodes collapsed)
block_comment "/** An empty byte array constant used in generated code. */"
field_declaration (+23 nodes collapsed)
block_comment "/** An empty byte array constant used in generated code. */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "ByteBuffer"
variable_declarator
identifier "EMPTY_BYTE_BUFFER"
= "="
method_invocation
identifier "ByteBuffer"
. "."
identifier "wrap"
argument_list
( "("
identifier "EMPTY_BYTE_ARRAY"
) ")"
; ";"
block_comment "/** An empty coded input stream constant used in generated c"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "CodedInputStream"
variable_declarator
identifier "EMPTY_CODED_INPUT_STREAM"
= "="
method_invocation
identifier "CodedInputStream"
. "."
identifier "newInstance"
argument_list
( "("
identifier "EMPTY_BYTE_ARRAY"
) ")"
; ";"
block_comment "/** Helper method to merge two MessageLite instances. */"
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Provides an immutable view of {@code List<T>} aroun"...
class_declaration (+169 nodes collapsed)
block_comment "/**\n * Provides an immutable view of {@code List<T>} aroun"...
class_declaration (+188 nodes collapsed)
block_comment "/** Wrap around a {@code Map<K, RealValue>} and provide a {@"...
class_declaration (+1148 nodes collapsed)
block_comment "/**\n * Extends {@link List} to add the capability to make "...
interface_declaration (+58 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+77 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
block_comment "/**\n * A {@link java.util.List} implementation that avoids"...
interface_declaration (+81 nodes collapsed)
} "}"