Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/protobuf.dart
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: protoc_plugin-v23.0.0
Choose a base ref
...
head repository: google/protobuf.dart
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: protoc_plugin-v24.0.0
Choose a head ref
  • 10 commits
  • 50 files changed
  • 1 contributor

Commits on Sep 30, 2025

  1. Sync a few small CLs: (#1060)

    - cl/660721933: moves some proto3 parsing functions to utils to allow reusing
      internally in a library when parsing an internal format.
    
    - cl/646759129: Update `CodedBufferReader` default depth limit to 100, to be
      consistent with the C++ and Java implementations.
    
    - cl/704280814: Update `CodedBufferReader` default size limit to max 32-bit
      signed integer to be consistent with the C++, Java, Objective-C
      implementations.
    
    - Also a minor change, not a CL: Type casts in `coded_buffer_writer.dart` was
      updated in this repo probably accidentally, as we never want to type cast
      with `as` in this repo. Revert it to the internal version which uses implicit
      casts.
    
    With this, about half of the protobuf files become identical with the internal
    version.
    osa1 authored Sep 30, 2025
    Configuration menu
    Copy the full SHA
    14bbd0b View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2025

  1. Fix a few extension field bugs (#1062)

    When an extension field set isn't initialized before freezing the message:
    
    - `addExtension` allows adding and modifying extensions.
    - `getExtension` returns non-frozen defaults that can be modified. 
    
    Fix this by initializing the extension field set as frozen when the parent
    message is frozen.
    
    Secondly, extension field set returns differently typed lists when it's frozen
    and not frozen. Fix this by always creating the list via the field's
    `FieldInfo`.
    
    Also refactor the code a little bit: `GeneratedMessage` by-passes a layer of
    abstraction and accesses unknown field sets directly. Instead make it call
    `FieldSet` always.
    
    New `FieldSet` methods are added as public (without an underscore in the name)
    to make it clear that they're a public interface (can be called from
    `GeneratedMessage`).
    
    (Ideally `FieldSet` should be a separate library, but that requires a lot of
    refactoring to split the parts into libraries.)
    
    Also remove duplicate "is repeated" and "ensure writable" checks when modifying
    extension fields.
    
    ---
    
    cl/819146715
    osa1 authored Oct 20, 2025
    Configuration menu
    Copy the full SHA
    78cf743 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2025

  1. Move PbList to its own library (#1063)

    A while ago we started converting parts to libraries to allow conditional
    compilation.
    
    This continues to move more parts to libraries, with `PbList`.
    
    Libraries allow specifying public and internally public interfaces of the types
    and makes it easier to define and maintain internal invariants.
    
    To avoid large (difficult to sync) diffs, I'm moving one part at a time.
    
    apitool reports no changes with this PR.
    osa1 authored Oct 21, 2025
    Configuration menu
    Copy the full SHA
    5a44489 View commit details
    Browse the repository at this point in the history
  2. More clearExtension tests: (#1064)

    Mutation testing discovered that removing the `_ensureWritable` line in
    `FieldSet.clearExtension` doesn't cause any test failures. Add a test that
    fails when the line is removed.
    osa1 authored Oct 21, 2025
    Configuration menu
    Copy the full SHA
    9b4c46f View commit details
    Browse the repository at this point in the history
  3. Move PbMap to its own library (#1066)

    Continuation to #1063.
    
    apitool reports no changes with this PR.
    
    Map decoding code moved from `pb_map.dart` to `coded_buffer.dart` to avoid
    accessing `CodedBufferReader` internals in `PbMap`. It's also more consistent
    to have all decoding code in `coded_buffer.dart`. We don't have repeated field
    decoding code in `pb_list.dart`, and `pb_list.dart` and `pb_map.dart` don't
    have decoders for other formats.
    
    Static members `_keyFieldNumber` and `_valueFieldNumber` are removed as they
    were duplicates of top-level members `mapKeyFieldNumber` and
    `mapValueFieldNumber`.
    
    `deepCopy` is exported as an internal extension to avoid expanding the public
    API without consideration.
    osa1 authored Oct 21, 2025
    Configuration menu
    Copy the full SHA
    27730db View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2025

  1. More field validation tests (#1068)

    For {extension,non-extension} {singular,repeated} fields, check range and type
    checks.
    
    All fields with range checks are tested. For type and nullability checks we
    only use a message and a `bool` field, as there are too many types of fields
    and most of them use the same validation function.
    
    Fields with range checks are not tested for type and nullability checks. To
    check whether a value is within range we have to use as a non-null `int` or
    `double`, so if the value being checked doesn't have the right type the range
    check function will throw anyway.
    
    This reveals two inconsistencies in the library:
    
    - When type of a non-repeated extension value is not right we throw an argument
      error instead of a type error.
    
    - `setExtension` takes an `Object` (not nullable) as an argument but
      `addExtension` takes `Object?` (nullable).
    
    I tested accordingly instead of trying to fix the inconsistencies as fixing
    them will break downstream.
    osa1 authored Oct 23, 2025
    Configuration menu
    Copy the full SHA
    a77f9a6 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2025

  1. Avoid redundant nullability checks when updating repeated fields (#1069)

    Since sound null safety we no longer need to manually check for nulls when
    setting fields, as we don't use nullable types for field values.
    
    Fixes #978.
    osa1 authored Oct 24, 2025
    Configuration menu
    Copy the full SHA
    7db0784 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2025

  1. Configuration menu
    Copy the full SHA
    4b488e0 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2025

  1. Don't generate createRepeated members (#1074)

    `createRepeated` members are not that useful, because `PbList` doesn't provide
    much over the standard library `List`, and `MyMessage.createRepeated()` can be
    replaced with `<MyMessage>[]`.
    
    To reduce generated code sizes and dependencies to `PbList`, remove the
    `createRepeated` members.
    osa1 authored Oct 30, 2025
    Configuration menu
    Copy the full SHA
    bed508e View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2025

  1. Don't iterate iterable arguments twice in PbList (#1070)

    Update `PbList` methods that update the list with an `Iterable` argument to
    avoid iterating the iterable twice: once for checking the element validity and
    once again for actually adding the values.
    
    Methods updated:
    
    - addAll
    - insertAll
    - replaceRange
    - setAll
    - setRange
    
    Exception handling behavior before this PR was undefined (same as the standard
    library `List`), and it's slightly changed with this PR:
    
    - addAll: previously if the iterator throws the list was left unchanged, now
      the elements until the exception will be added.
    
    - Other methods: exception behaviors are now the same as the standard library
      `List` methods.
    
      It's hard to tell whether the previous behavior was the same or different
      with the standard library `List` methods, as the exception behavior of those
      are undefined.
    
    To avoid allocating new iterators when a check function is not available, we
    have conditionals in each of these methods and call the standard library `List`
    methods directly when there isn't a check function.
    
    To avoid increasing number of cases needed to be tested, we don't special case
    iterable types like `PbList` and `List` in these methods. When the check
    function is available we simply `map` them with the check function. Otherwise
    call the same method on `wrappedList` directly.
    
    Fixes #730.
    osa1 authored Nov 3, 2025
    Configuration menu
    Copy the full SHA
    4dfedaf View commit details
    Browse the repository at this point in the history
Loading