From 3ea99b8e762b2e015d65dcb5582953bc5e605c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20A=C4=9Facan?= Date: Wed, 29 Oct 2025 08:18:40 +0000 Subject: [PATCH 1/3] Hide PbList and PbMap constructors, remove createRepeated --- protobuf/CHANGELOG.md | 9 +- protobuf/lib/src/protobuf/field_info.dart | 12 +- protobuf/lib/src/protobuf/field_set.dart | 2 +- protobuf/lib/src/protobuf/pb_list.dart | 21 +- protobuf/lib/src/protobuf/pb_map.dart | 18 +- protobuf/test/list_test.dart | 179 +----------------- protobuf/test/mock_util.dart | 3 + protoc_plugin/CHANGELOG.md | 7 + protoc_plugin/lib/names.dart | 1 - .../lib/src/gen/dart_options.pb.dart | 2 - .../lib/src/gen/google/api/client.pb.dart | 26 --- .../lib/src/gen/google/api/http.pb.dart | 4 - .../lib/src/gen/google/api/routing.pb.dart | 3 - .../google/protobuf/compiler/plugin.pb.dart | 7 - .../gen/google/protobuf/descriptor.pb.dart | 66 ------- .../src/gen/google/protobuf/duration.pb.dart | 1 - .../google/protobuf/unittest_features.pb.dart | 5 - protoc_plugin/lib/src/message_generator.dart | 4 - .../test/goldens/deprecations.pb.dart | 3 - .../test/goldens/doc_comments.pb.dart | 3 - .../test/goldens/grpc_service.pb.dart | 1 - protoc_plugin/test/goldens/imports.pb.dart | 1 - protoc_plugin/test/goldens/int64.pb.dart | 1 - .../test/goldens/messageGenerator.pb.dart | 1 - .../goldens/messageGenerator.pb.dart.meta | 64 +++---- protoc_plugin/test/goldens/oneMessage.pb.dart | 1 - .../test/goldens/oneMessage.pb.dart.meta | 48 ++--- protoc_plugin/test/goldens/service.pb.dart | 1 - 28 files changed, 113 insertions(+), 381 deletions(-) diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md index a376c83b..07d0f012 100644 --- a/protobuf/CHANGELOG.md +++ b/protobuf/CHANGELOG.md @@ -1,4 +1,4 @@ -## 5.1.0-wip +## 6.0.0-wip * Update default size limit of `CodedBufferReader` from 67,108,864 bytes to 2,147,483,647 bytes, and default recursion limit from 64 to 100. @@ -13,6 +13,13 @@ message extension field set is initialized and frozen and initialized but not frozen. ([#1062]) +* **Breaking:** Hide `PbList` and `PbMap` constructors. It is not possible to + construct these values correctly in user code, so the constructors are now + private. Existing uses of `PbList` can be replaced by `List` and `PbMap` can + be replaced by `Map`. + + For immutable lists and maps, you can use `built_value`. + [#1060]: https://github.com/google/protobuf.dart/pull/1060 [#1062]: https://github.com/google/protobuf.dart/pull/1062 diff --git a/protobuf/lib/src/protobuf/field_info.dart b/protobuf/lib/src/protobuf/field_info.dart index 775b3c0f..59c709f9 100644 --- a/protobuf/lib/src/protobuf/field_info.dart +++ b/protobuf/lib/src/protobuf/field_info.dart @@ -144,7 +144,7 @@ class FieldInfo { this.enumValues, this.defaultEnumValue, String? protoName, - }) : makeDefault = (() => PbList(check: check)), + }) : makeDefault = (() => newPbList(check: check)), _protoName = protoName, assert(PbFieldType.isRepeated(type)), assert(!PbFieldType.isEnum(type) || valueOf != null); @@ -169,7 +169,7 @@ class FieldInfo { /// [GeneratedMessage.getField], doesn't create a repeated field. dynamic get readonlyDefault { if (isRepeated) { - return _emptyList ??= PbList.unmodifiable(); + return _emptyList ??= newUnmodifiablePbList(); } return makeDefault!(); } @@ -232,13 +232,13 @@ class FieldInfo { /// Creates a repeated field. PbList _createRepeatedField() { assert(isRepeated); - return PbList(check: check); + return newPbList(check: check); } /// Same as above, but allow a tighter typed [PbList] to be created. PbList _createRepeatedFieldWithType() { assert(isRepeated); - return PbList(check: check); + return newPbList(check: check); } /// Convenience method to thread this FieldInfo's reified type parameter to @@ -303,7 +303,7 @@ class MapFieldInfo extends FieldInfo?> { tagNumber, index, type, - defaultOrMaker: () => PbMap(keyFieldType, valueFieldType), + defaultOrMaker: () => newPbMap(keyFieldType, valueFieldType), defaultEnumValue: defaultEnumValue, protoName: protoName, ) { @@ -319,7 +319,7 @@ class MapFieldInfo extends FieldInfo?> { PbMap _createMapField() { assert(isMapField); - return PbMap(keyFieldType, valueFieldType); + return newPbMap(keyFieldType, valueFieldType); } } diff --git a/protobuf/lib/src/protobuf/field_set.dart b/protobuf/lib/src/protobuf/field_set.dart index e2f03f9e..b458faec 100644 --- a/protobuf/lib/src/protobuf/field_set.dart +++ b/protobuf/lib/src/protobuf/field_set.dart @@ -402,7 +402,7 @@ class FieldSet { assert(fi.isMapField); if (_isReadOnly) { - return PbMap.unmodifiable(fi.keyFieldType, fi.valueFieldType); + return newUnmodifiablePbMap(fi.keyFieldType, fi.valueFieldType); } final map = fi._createMapField(); diff --git a/protobuf/lib/src/protobuf/pb_list.dart b/protobuf/lib/src/protobuf/pb_list.dart index 1c2c8ce4..95f1033f 100644 --- a/protobuf/lib/src/protobuf/pb_list.dart +++ b/protobuf/lib/src/protobuf/pb_list.dart @@ -13,6 +13,17 @@ import 'utils.dart'; /// Throws [ArgumentError] or [RangeError] when the item is not valid. typedef CheckFunc = void Function(E? x); +@pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') +PbList newPbList({CheckFunc? check}) => PbList._(check: check); + +@pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') +PbList newUnmodifiablePbList({CheckFunc? check}) => + PbList._unmodifiable(); + /// A [ListBase] implementation used for protobuf `repeated` fields. class PbList extends ListBase { /// The actual list storing the elements. @@ -35,17 +46,13 @@ class PbList extends ListBase { bool get isFrozen => _isReadOnly; - PbList({CheckFunc? check}) : _wrappedList = [], _check = check; + PbList._({CheckFunc? check}) : _wrappedList = [], _check = check; - PbList.unmodifiable() + PbList._unmodifiable() : _wrappedList = _emptyList, _check = checkNotNull, _isReadOnly = true; - PbList.from(Iterable from) - : _wrappedList = List.of(from), - _check = checkNotNull; - @override @pragma('dart2js:never-inline') void add(E element) { @@ -256,7 +263,7 @@ class PbList extends ListBase { } PbList _deepCopy() { - final newList = PbList(check: _check); + final newList = PbList._(check: _check); final wrappedList = _wrappedList; final newWrappedList = newList._wrappedList; if (wrappedList.isNotEmpty) { diff --git a/protobuf/lib/src/protobuf/pb_map.dart b/protobuf/lib/src/protobuf/pb_map.dart index 00513337..0200f4af 100644 --- a/protobuf/lib/src/protobuf/pb_map.dart +++ b/protobuf/lib/src/protobuf/pb_map.dart @@ -10,6 +10,18 @@ import 'utils.dart'; const mapKeyFieldNumber = 1; const mapValueFieldNumber = 2; +@pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') +PbMap newPbMap(int keyFieldType, int valueFieldType) => + PbMap._(keyFieldType, valueFieldType); + +@pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') +PbMap newUnmodifiablePbMap(int keyFieldType, int valueFieldType) => + PbMap._unmodifiable(keyFieldType, valueFieldType); + /// A [MapBase] implementation used for protobuf `map` fields. class PbMap extends MapBase { /// Key type of the map. Per proto2 and proto3 specs, this needs to be an @@ -34,9 +46,9 @@ class PbMap extends MapBase { bool _isReadOnly = false; - PbMap(this.keyFieldType, this.valueFieldType) : _wrappedMap = {}; + PbMap._(this.keyFieldType, this.valueFieldType) : _wrappedMap = {}; - PbMap.unmodifiable(this.keyFieldType, this.valueFieldType) + PbMap._unmodifiable(this.keyFieldType, this.valueFieldType) : _wrappedMap = {}, _isReadOnly = true; @@ -114,7 +126,7 @@ class PbMap extends MapBase { } PbMap _deepCopy() { - final newMap = PbMap(keyFieldType, valueFieldType); + final newMap = PbMap._(keyFieldType, valueFieldType); final wrappedMap = _wrappedMap; final newWrappedMap = newMap._wrappedMap; if (PbFieldType.isGroupOrMessage(valueFieldType)) { diff --git a/protobuf/test/list_test.dart b/protobuf/test/list_test.dart index 23e99510..ea95cc8e 100644 --- a/protobuf/test/list_test.dart +++ b/protobuf/test/list_test.dart @@ -2,22 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:fixnum/fixnum.dart'; -import 'package:protobuf/protobuf.dart'; import 'package:test/test.dart'; -// [ArgumentError] in production mode, [TypeError] in checked. -final invalidArgumentException = predicate( - (e) => e is ArgumentError || e is TypeError, -); -final badArgument = throwsA(invalidArgumentException); - -// Suppress an analyzer warning for a deliberate type mismatch. -T cast(Object? x) => x as T; +import 'mock_util.dart'; void main() { test('testPbList handles basic operations', () { - final lb1 = PbList(); + final lb1 = T().int32s; expect(lb1, []); lb1.add(1); @@ -63,7 +54,7 @@ void main() { }); test('PbList handles range operations', () { - final lb2 = PbList(); + final lb2 = T().int32s; lb2.addAll([1, 2, 3, 4, 5, 6, 7, 8, 9]); expect(lb2.sublist(3, 7), [4, 5, 6, 7]); @@ -89,168 +80,4 @@ void main() { lb2.setRange(5, 6, [88, 99].take(2), 1); expect(lb2, [1, 2, 3, 9, 8, 99]); }); - - test('PbList validates items', () { - expect(() { - // ignore: unnecessary_cast - (PbList() as List).add('hello'); - }, throwsA(TypeMatcher())); - }); - - test('PbList for signed int32 validates items', () { - final List list = PbList(check: getCheckFunction(PbFieldType.P3)); - - expect(() { - list.add(-2147483649); - }, throwsArgumentError); - - expect( - () { - list.add(-2147483648); - }, - returnsNormally, - reason: 'could not add min signed int32 to a PbList', - ); - - expect(() { - list.add(2147483648); - }, throwsArgumentError); - - expect( - () { - list.add(2147483647); - }, - returnsNormally, - reason: 'could not add max signed int32 to a PbList', - ); - }); - - test('PBList for unsigned int32 validates items', () { - final List list = PbList(check: getCheckFunction(PbFieldType.PU3)); - - expect(() { - list.add(-1); - }, throwsArgumentError); - - expect( - () { - list.add(0); - }, - returnsNormally, - reason: 'could not add zero to a PbList', - ); - - expect(() { - list.add(4294967296); - }, throwsArgumentError); - - expect( - () { - list.add(4294967295); - }, - returnsNormally, - reason: 'could not add max unsigned int32 to a PbList', - ); - }); - - test('PbList for float validates items', () { - final List list = PbList(check: getCheckFunction(PbFieldType.PF)); - - expect(() { - list.add(3.4028234663852886E39); - }, throwsArgumentError); - - expect(() { - list.add(-3.4028234663852886E39); - }, throwsArgumentError); - - expect( - () { - list.add(3.4028234663852886E38); - }, - returnsNormally, - reason: 'could not add max float to a PbList', - ); - - expect( - () { - list.add(-3.4028234663852886E38); - }, - returnsNormally, - reason: 'could not add min float to a PbList', - ); - }); - - test('PbList for signed Int64 validates items', () { - final List list = PbList(); - expect(() { - list.add(cast(0)); // not an Int64 - }, badArgument); - - expect( - () { - list.add(Int64(0)); - }, - returnsNormally, - reason: 'could not add Int64(0) to a PbList', - ); - - expect( - () { - list.add(Int64.MAX_VALUE); - }, - returnsNormally, - reason: 'could not add max Int64 to a PbList', - ); - - expect( - () { - list.add(Int64.MIN_VALUE); - }, - returnsNormally, - reason: 'could not add min Int64 to PbList', - ); - }); - - test('PbList for unsigned Int64 validates items', () { - final List list = PbList(); - expect(() { - list.add(cast(0)); // not an Int64 - }, badArgument); - - expect( - () { - list.add(Int64(0)); - }, - returnsNormally, - reason: 'could not add Int64(0) to a PbList', - ); - - // Adding -1 should work because we are storing the bits as-is. - // (It will be interpreted as a positive number.) - // See: https://github.com/google/protobuf.dart/issues/44 - expect( - () { - list.add(Int64(-1)); - }, - returnsNormally, - reason: 'could not add Int64(-1) to a PbList', - ); - - expect( - () { - list.add(Int64.MAX_VALUE); - }, - returnsNormally, - reason: 'could not add max Int64 to a PbList', - ); - - expect( - () { - list.add(Int64.MIN_VALUE); - }, - returnsNormally, - reason: 'could not add min Int64 to a PbList', - ); - }); } diff --git a/protobuf/test/mock_util.dart b/protobuf/test/mock_util.dart index fdd385ea..9288cd60 100644 --- a/protobuf/test/mock_util.dart +++ b/protobuf/test/mock_util.dart @@ -13,6 +13,7 @@ import 'package:protobuf/protobuf.dart' ProtobufEnum; final mockEnumValues = [ProtobufEnum(1, 'a'), ProtobufEnum(2, 'b')]; + BuilderInfo mockInfo(String className, CreateBuilderFunc create) { return BuilderInfo(className, createEmptyInstance: create) ..a(1, 'val', PbFieldType.O3, defaultOrMaker: 42) @@ -64,7 +65,9 @@ abstract class MockMessage extends GeneratedMessage { class T extends MockMessage { @override BuilderInfo get info_ => _info; + static final _info = mockInfo('T', T.new); + @override T createEmptyInstance() => T(); } diff --git a/protoc_plugin/CHANGELOG.md b/protoc_plugin/CHANGELOG.md index 78c97547..cc6d0116 100644 --- a/protoc_plugin/CHANGELOG.md +++ b/protoc_plugin/CHANGELOG.md @@ -1,3 +1,10 @@ +## 24.0.0 + +* Don't generate `createRepeated` methods. + + These methods were mostly useless and unused as there isn't much you can do + with a `PbList` that you can't do with a `List`. + ## 23.0.0 Note: this version requires protobuf 5.0.0. diff --git a/protoc_plugin/lib/names.dart b/protoc_plugin/lib/names.dart index e14495d4..ec85b5a4 100644 --- a/protoc_plugin/lib/names.dart +++ b/protoc_plugin/lib/names.dart @@ -661,7 +661,6 @@ const List _dartReservedWords = [ // the base GeneratedMessage class determined by reflection. const _generatedMessageNames = [ 'create', - 'createRepeated', 'getDefault', 'List', 'notSet', diff --git a/protoc_plugin/lib/src/gen/dart_options.pb.dart b/protoc_plugin/lib/src/gen/dart_options.pb.dart index 06435847..c5c559e2 100644 --- a/protoc_plugin/lib/src/gen/dart_options.pb.dart +++ b/protoc_plugin/lib/src/gen/dart_options.pb.dart @@ -62,7 +62,6 @@ class DartMixin extends $pb.GeneratedMessage { static DartMixin create() => DartMixin._(); @$core.override DartMixin createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static DartMixin getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -142,7 +141,6 @@ class Imports extends $pb.GeneratedMessage { static Imports create() => Imports._(); @$core.override Imports createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Imports getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/api/client.pb.dart b/protoc_plugin/lib/src/gen/google/api/client.pb.dart index 3cc4ee4b..375dc089 100644 --- a/protoc_plugin/lib/src/gen/google/api/client.pb.dart +++ b/protoc_plugin/lib/src/gen/google/api/client.pb.dart @@ -78,8 +78,6 @@ class CommonLanguageSettings extends $pb.GeneratedMessage { static CommonLanguageSettings create() => CommonLanguageSettings._(); @$core.override CommonLanguageSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static CommonLanguageSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -198,8 +196,6 @@ class ClientLibrarySettings extends $pb.GeneratedMessage { static ClientLibrarySettings create() => ClientLibrarySettings._(); @$core.override ClientLibrarySettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static ClientLibrarySettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -412,7 +408,6 @@ class Publishing extends $pb.GeneratedMessage { static Publishing create() => Publishing._(); @$core.override Publishing createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Publishing getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -578,8 +573,6 @@ class JavaSettings extends $pb.GeneratedMessage { static JavaSettings create() => JavaSettings._(); @$core.override JavaSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static JavaSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -676,7 +669,6 @@ class CppSettings extends $pb.GeneratedMessage { static CppSettings create() => CppSettings._(); @$core.override CppSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static CppSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -736,7 +728,6 @@ class PhpSettings extends $pb.GeneratedMessage { static PhpSettings create() => PhpSettings._(); @$core.override PhpSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static PhpSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -810,8 +801,6 @@ class PythonSettings_ExperimentalFeatures extends $pb.GeneratedMessage { PythonSettings_ExperimentalFeatures._(); @$core.override PythonSettings_ExperimentalFeatures createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static PythonSettings_ExperimentalFeatures getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor< @@ -905,8 +894,6 @@ class PythonSettings extends $pb.GeneratedMessage { static PythonSettings create() => PythonSettings._(); @$core.override PythonSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static PythonSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -980,8 +967,6 @@ class NodeSettings extends $pb.GeneratedMessage { static NodeSettings create() => NodeSettings._(); @$core.override NodeSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static NodeSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1071,8 +1056,6 @@ class DotnetSettings extends $pb.GeneratedMessage { static DotnetSettings create() => DotnetSettings._(); @$core.override DotnetSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static DotnetSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1167,8 +1150,6 @@ class RubySettings extends $pb.GeneratedMessage { static RubySettings create() => RubySettings._(); @$core.override RubySettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static RubySettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1235,7 +1216,6 @@ class GoSettings extends $pb.GeneratedMessage { static GoSettings create() => GoSettings._(); @$core.override GoSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static GoSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1325,8 +1305,6 @@ class MethodSettings_LongRunning extends $pb.GeneratedMessage { static MethodSettings_LongRunning create() => MethodSettings_LongRunning._(); @$core.override MethodSettings_LongRunning createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static MethodSettings_LongRunning getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1432,8 +1410,6 @@ class MethodSettings extends $pb.GeneratedMessage { static MethodSettings create() => MethodSettings._(); @$core.override MethodSettings createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static MethodSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1543,8 +1519,6 @@ class SelectiveGapicGeneration extends $pb.GeneratedMessage { static SelectiveGapicGeneration create() => SelectiveGapicGeneration._(); @$core.override SelectiveGapicGeneration createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static SelectiveGapicGeneration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/api/http.pb.dart b/protoc_plugin/lib/src/gen/google/api/http.pb.dart index a4964041..3aab4887 100644 --- a/protoc_plugin/lib/src/gen/google/api/http.pb.dart +++ b/protoc_plugin/lib/src/gen/google/api/http.pb.dart @@ -62,7 +62,6 @@ class Http extends $pb.GeneratedMessage { static Http create() => Http._(); @$core.override Http createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Http getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -434,7 +433,6 @@ class HttpRule extends $pb.GeneratedMessage { static HttpRule create() => HttpRule._(); @$core.override HttpRule createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static HttpRule getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -614,8 +612,6 @@ class CustomHttpPattern extends $pb.GeneratedMessage { static CustomHttpPattern create() => CustomHttpPattern._(); @$core.override CustomHttpPattern createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static CustomHttpPattern getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/api/routing.pb.dart b/protoc_plugin/lib/src/gen/google/api/routing.pb.dart index 28bb7421..79cb616a 100644 --- a/protoc_plugin/lib/src/gen/google/api/routing.pb.dart +++ b/protoc_plugin/lib/src/gen/google/api/routing.pb.dart @@ -416,7 +416,6 @@ class RoutingRule extends $pb.GeneratedMessage { static RoutingRule create() => RoutingRule._(); @$core.override RoutingRule createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static RoutingRule getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -475,8 +474,6 @@ class RoutingParameter extends $pb.GeneratedMessage { static RoutingParameter create() => RoutingParameter._(); @$core.override RoutingParameter createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static RoutingParameter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/protobuf/compiler/plugin.pb.dart b/protoc_plugin/lib/src/gen/google/protobuf/compiler/plugin.pb.dart index 3bee3157..25f5db89 100644 --- a/protoc_plugin/lib/src/gen/google/protobuf/compiler/plugin.pb.dart +++ b/protoc_plugin/lib/src/gen/google/protobuf/compiler/plugin.pb.dart @@ -70,7 +70,6 @@ class Version extends $pb.GeneratedMessage { static Version create() => Version._(); @$core.override Version createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Version getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -172,8 +171,6 @@ class CodeGeneratorRequest extends $pb.GeneratedMessage { static CodeGeneratorRequest create() => CodeGeneratorRequest._(); @$core.override CodeGeneratorRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static CodeGeneratorRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -289,8 +286,6 @@ class CodeGeneratorResponse_File extends $pb.GeneratedMessage { static CodeGeneratorResponse_File create() => CodeGeneratorResponse_File._(); @$core.override CodeGeneratorResponse_File createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static CodeGeneratorResponse_File getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -444,8 +439,6 @@ class CodeGeneratorResponse extends $pb.GeneratedMessage { static CodeGeneratorResponse create() => CodeGeneratorResponse._(); @$core.override CodeGeneratorResponse createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static CodeGeneratorResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/protobuf/descriptor.pb.dart b/protoc_plugin/lib/src/gen/google/protobuf/descriptor.pb.dart index a4959473..84dce86d 100644 --- a/protoc_plugin/lib/src/gen/google/protobuf/descriptor.pb.dart +++ b/protoc_plugin/lib/src/gen/google/protobuf/descriptor.pb.dart @@ -64,8 +64,6 @@ class FileDescriptorSet extends $pb.GeneratedMessage { static FileDescriptorSet create() => FileDescriptorSet._(); @$core.override FileDescriptorSet createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FileDescriptorSet getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -165,8 +163,6 @@ class FileDescriptorProto extends $pb.GeneratedMessage { static FileDescriptorProto create() => FileDescriptorProto._(); @$core.override FileDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FileDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -326,8 +322,6 @@ class DescriptorProto_ExtensionRange extends $pb.GeneratedMessage { DescriptorProto_ExtensionRange._(); @$core.override DescriptorProto_ExtensionRange createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static DescriptorProto_ExtensionRange getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -412,8 +406,6 @@ class DescriptorProto_ReservedRange extends $pb.GeneratedMessage { DescriptorProto_ReservedRange._(); @$core.override DescriptorProto_ReservedRange createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static DescriptorProto_ReservedRange getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -519,8 +511,6 @@ class DescriptorProto extends $pb.GeneratedMessage { static DescriptorProto create() => DescriptorProto._(); @$core.override DescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static DescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -639,8 +629,6 @@ class ExtensionRangeOptions_Declaration extends $pb.GeneratedMessage { ExtensionRangeOptions_Declaration._(); @$core.override ExtensionRangeOptions_Declaration createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static ExtensionRangeOptions_Declaration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor( @@ -763,8 +751,6 @@ class ExtensionRangeOptions extends $pb.GeneratedMessage { static ExtensionRangeOptions create() => ExtensionRangeOptions._(); @$core.override ExtensionRangeOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static ExtensionRangeOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -879,8 +865,6 @@ class FieldDescriptorProto extends $pb.GeneratedMessage { static FieldDescriptorProto create() => FieldDescriptorProto._(); @$core.override FieldDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FieldDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1072,8 +1056,6 @@ class OneofDescriptorProto extends $pb.GeneratedMessage { static OneofDescriptorProto create() => OneofDescriptorProto._(); @$core.override OneofDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static OneofDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1153,8 +1135,6 @@ class EnumDescriptorProto_EnumReservedRange extends $pb.GeneratedMessage { EnumDescriptorProto_EnumReservedRange._(); @$core.override EnumDescriptorProto_EnumReservedRange createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static EnumDescriptorProto_EnumReservedRange getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor< @@ -1240,8 +1220,6 @@ class EnumDescriptorProto extends $pb.GeneratedMessage { static EnumDescriptorProto create() => EnumDescriptorProto._(); @$core.override EnumDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static EnumDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1341,8 +1319,6 @@ class EnumValueDescriptorProto extends $pb.GeneratedMessage { static EnumValueDescriptorProto create() => EnumValueDescriptorProto._(); @$core.override EnumValueDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static EnumValueDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1427,8 +1403,6 @@ class ServiceDescriptorProto extends $pb.GeneratedMessage { static ServiceDescriptorProto create() => ServiceDescriptorProto._(); @$core.override ServiceDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static ServiceDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1515,8 +1489,6 @@ class MethodDescriptorProto extends $pb.GeneratedMessage { static MethodDescriptorProto create() => MethodDescriptorProto._(); @$core.override MethodDescriptorProto createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static MethodDescriptorProto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -1697,7 +1669,6 @@ class FileOptions extends $pb.GeneratedMessage { static FileOptions create() => FileOptions._(); @$core.override FileOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static FileOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2031,8 +2002,6 @@ class MessageOptions extends $pb.GeneratedMessage { static MessageOptions create() => MessageOptions._(); @$core.override MessageOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static MessageOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2211,8 +2180,6 @@ class FieldOptions_EditionDefault extends $pb.GeneratedMessage { FieldOptions_EditionDefault._(); @$core.override FieldOptions_EditionDefault createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FieldOptions_EditionDefault getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2294,8 +2261,6 @@ class FieldOptions_FeatureSupport extends $pb.GeneratedMessage { FieldOptions_FeatureSupport._(); @$core.override FieldOptions_FeatureSupport createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FieldOptions_FeatureSupport getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2441,8 +2406,6 @@ class FieldOptions extends $pb.GeneratedMessage { static FieldOptions create() => FieldOptions._(); @$core.override FieldOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FieldOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2676,8 +2639,6 @@ class OneofOptions extends $pb.GeneratedMessage { static OneofOptions create() => OneofOptions._(); @$core.override OneofOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static OneofOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2762,7 +2723,6 @@ class EnumOptions extends $pb.GeneratedMessage { static EnumOptions create() => EnumOptions._(); @$core.override EnumOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static EnumOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -2890,8 +2850,6 @@ class EnumValueOptions extends $pb.GeneratedMessage { static EnumValueOptions create() => EnumValueOptions._(); @$core.override EnumValueOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static EnumValueOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3004,8 +2962,6 @@ class ServiceOptions extends $pb.GeneratedMessage { static ServiceOptions create() => ServiceOptions._(); @$core.override ServiceOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static ServiceOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3100,8 +3056,6 @@ class MethodOptions extends $pb.GeneratedMessage { static MethodOptions create() => MethodOptions._(); @$core.override MethodOptions createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static MethodOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3201,8 +3155,6 @@ class UninterpretedOption_NamePart extends $pb.GeneratedMessage { UninterpretedOption_NamePart._(); @$core.override UninterpretedOption_NamePart createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static UninterpretedOption_NamePart getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3294,8 +3246,6 @@ class UninterpretedOption extends $pb.GeneratedMessage { static UninterpretedOption create() => UninterpretedOption._(); @$core.override UninterpretedOption createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static UninterpretedOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3397,8 +3347,6 @@ class FeatureSet_VisibilityFeature extends $pb.GeneratedMessage { FeatureSet_VisibilityFeature._(); @$core.override FeatureSet_VisibilityFeature createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FeatureSet_VisibilityFeature getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3487,7 +3435,6 @@ class FeatureSet extends $pb.GeneratedMessage { static FeatureSet create() => FeatureSet._(); @$core.override FeatureSet createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static FeatureSet getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3629,9 +3576,6 @@ class FeatureSetDefaults_FeatureSetEditionDefault extends $pb.GeneratedMessage { FeatureSetDefaults_FeatureSetEditionDefault._(); @$core.override FeatureSetDefaults_FeatureSetEditionDefault createEmptyInstance() => create(); - static $pb.PbList - createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FeatureSetDefaults_FeatureSetEditionDefault getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor< @@ -3725,8 +3669,6 @@ class FeatureSetDefaults extends $pb.GeneratedMessage { static FeatureSetDefaults create() => FeatureSetDefaults._(); @$core.override FeatureSetDefaults createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static FeatureSetDefaults getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3813,8 +3755,6 @@ class SourceCodeInfo_Location extends $pb.GeneratedMessage { static SourceCodeInfo_Location create() => SourceCodeInfo_Location._(); @$core.override SourceCodeInfo_Location createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static SourceCodeInfo_Location getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -3966,8 +3906,6 @@ class SourceCodeInfo extends $pb.GeneratedMessage { static SourceCodeInfo create() => SourceCodeInfo._(); @$core.override SourceCodeInfo createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static SourceCodeInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -4077,8 +4015,6 @@ class GeneratedCodeInfo_Annotation extends $pb.GeneratedMessage { GeneratedCodeInfo_Annotation._(); @$core.override GeneratedCodeInfo_Annotation createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static GeneratedCodeInfo_Annotation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -4177,8 +4113,6 @@ class GeneratedCodeInfo extends $pb.GeneratedMessage { static GeneratedCodeInfo create() => GeneratedCodeInfo._(); @$core.override GeneratedCodeInfo createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static GeneratedCodeInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart b/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart index fafadb50..bd08462f 100644 --- a/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart +++ b/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart @@ -120,7 +120,6 @@ class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin { static Duration create() => Duration._(); @$core.override Duration createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Duration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/gen/google/protobuf/unittest_features.pb.dart b/protoc_plugin/lib/src/gen/google/protobuf/unittest_features.pb.dart index 014f4b8f..7b26251d 100644 --- a/protoc_plugin/lib/src/gen/google/protobuf/unittest_features.pb.dart +++ b/protoc_plugin/lib/src/gen/google/protobuf/unittest_features.pb.dart @@ -59,8 +59,6 @@ class TestMessage_Nested extends $pb.GeneratedMessage { static TestMessage_Nested create() => TestMessage_Nested._(); @$core.override TestMessage_Nested createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static TestMessage_Nested getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -106,7 +104,6 @@ class TestMessage extends $pb.GeneratedMessage { static TestMessage create() => TestMessage._(); @$core.override TestMessage createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static TestMessage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -219,8 +216,6 @@ class TestFeatures extends $pb.GeneratedMessage { static TestFeatures create() => TestFeatures._(); @$core.override TestFeatures createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static TestFeatures getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/lib/src/message_generator.dart b/protoc_plugin/lib/src/message_generator.dart index 1ff7bea5..3639eba7 100644 --- a/protoc_plugin/lib/src/message_generator.dart +++ b/protoc_plugin/lib/src/message_generator.dart @@ -524,10 +524,6 @@ class MessageGenerator extends ProtobufContainer { out.println('@$coreImportPrefix.override'); out.println('$classname createEmptyInstance() => create();'); - out.println( - 'static $protobufImportPrefix.PbList<$classname> createRepeated() =>' - ' $protobufImportPrefix.PbList<$classname>();', - ); out.println("@$coreImportPrefix.pragma('dart2js:noInline')"); out.println( 'static $classname getDefault() =>' diff --git a/protoc_plugin/test/goldens/deprecations.pb.dart b/protoc_plugin/test/goldens/deprecations.pb.dart index 96fdc2e8..96f9dbf4 100644 --- a/protoc_plugin/test/goldens/deprecations.pb.dart +++ b/protoc_plugin/test/goldens/deprecations.pb.dart @@ -59,8 +59,6 @@ class HelloRequest extends $pb.GeneratedMessage { static HelloRequest create() => HelloRequest._(); @$core.override HelloRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static HelloRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -118,7 +116,6 @@ class HelloReply extends $pb.GeneratedMessage { static HelloReply create() => HelloReply._(); @$core.override HelloReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static HelloReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/doc_comments.pb.dart b/protoc_plugin/test/goldens/doc_comments.pb.dart index 245a2030..c89cb1df 100644 --- a/protoc_plugin/test/goldens/doc_comments.pb.dart +++ b/protoc_plugin/test/goldens/doc_comments.pb.dart @@ -59,8 +59,6 @@ class HelloRequest extends $pb.GeneratedMessage { static HelloRequest create() => HelloRequest._(); @$core.override HelloRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => - $pb.PbList(); @$core.pragma('dart2js:noInline') static HelloRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); @@ -115,7 +113,6 @@ class HelloReply extends $pb.GeneratedMessage { static HelloReply create() => HelloReply._(); @$core.override HelloReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static HelloReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/grpc_service.pb.dart b/protoc_plugin/test/goldens/grpc_service.pb.dart index d7569635..e1fc97e3 100644 --- a/protoc_plugin/test/goldens/grpc_service.pb.dart +++ b/protoc_plugin/test/goldens/grpc_service.pb.dart @@ -46,7 +46,6 @@ class Empty extends $pb.GeneratedMessage { static Empty create() => Empty._(); @$core.override Empty createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Empty getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/imports.pb.dart b/protoc_plugin/test/goldens/imports.pb.dart index f9b26f9d..6a4b42d9 100644 --- a/protoc_plugin/test/goldens/imports.pb.dart +++ b/protoc_plugin/test/goldens/imports.pb.dart @@ -51,7 +51,6 @@ class M extends $pb.GeneratedMessage { static M create() => M._(); @$core.override M createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static M getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/int64.pb.dart b/protoc_plugin/test/goldens/int64.pb.dart index a5a4a037..91888c40 100644 --- a/protoc_plugin/test/goldens/int64.pb.dart +++ b/protoc_plugin/test/goldens/int64.pb.dart @@ -48,7 +48,6 @@ class Int64 extends $pb.GeneratedMessage { static Int64 create() => Int64._(); @$core.override Int64 createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Int64 getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/messageGenerator.pb.dart b/protoc_plugin/test/goldens/messageGenerator.pb.dart index 67f17156..7b6c9cf2 100644 --- a/protoc_plugin/test/goldens/messageGenerator.pb.dart +++ b/protoc_plugin/test/goldens/messageGenerator.pb.dart @@ -25,7 +25,6 @@ class PhoneNumber extends $pb.GeneratedMessage { static PhoneNumber create() => PhoneNumber._(); @$core.override PhoneNumber createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static PhoneNumber getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static PhoneNumber? _defaultInstance; diff --git a/protoc_plugin/test/goldens/messageGenerator.pb.dart.meta b/protoc_plugin/test/goldens/messageGenerator.pb.dart.meta index e6cae843..f4f8312a 100644 --- a/protoc_plugin/test/goldens/messageGenerator.pb.dart.meta +++ b/protoc_plugin/test/goldens/messageGenerator.pb.dart.meta @@ -18,8 +18,8 @@ annotation: { path: 2 path: 1 sourceFile: - begin: 1722 - end: 1728 + begin: 1642 + end: 1648 } annotation: { path: 4 @@ -27,8 +27,8 @@ annotation: { path: 2 path: 1 sourceFile: - begin: 1770 - end: 1776 + begin: 1690 + end: 1696 } annotation: { path: 4 @@ -36,8 +36,8 @@ annotation: { path: 2 path: 1 sourceFile: - begin: 1856 - end: 1865 + begin: 1776 + end: 1785 } annotation: { path: 4 @@ -45,8 +45,8 @@ annotation: { path: 2 path: 1 sourceFile: - begin: 1908 - end: 1919 + begin: 1828 + end: 1839 } annotation: { path: 4 @@ -54,8 +54,8 @@ annotation: { path: 2 path: 0 sourceFile: - begin: 1991 - end: 1995 + begin: 1911 + end: 1915 } annotation: { path: 4 @@ -63,8 +63,8 @@ annotation: { path: 2 path: 0 sourceFile: - begin: 2036 - end: 2040 + begin: 1956 + end: 1960 } annotation: { path: 4 @@ -72,8 +72,8 @@ annotation: { path: 2 path: 0 sourceFile: - begin: 2128 - end: 2135 + begin: 2048 + end: 2055 } annotation: { path: 4 @@ -81,8 +81,8 @@ annotation: { path: 2 path: 0 sourceFile: - begin: 2178 - end: 2187 + begin: 2098 + end: 2107 } annotation: { path: 4 @@ -90,8 +90,8 @@ annotation: { path: 2 path: 2 sourceFile: - begin: 2250 - end: 2254 + begin: 2170 + end: 2174 } annotation: { path: 4 @@ -99,8 +99,8 @@ annotation: { path: 2 path: 2 sourceFile: - begin: 2301 - end: 2305 + begin: 2221 + end: 2225 } annotation: { path: 4 @@ -108,8 +108,8 @@ annotation: { path: 2 path: 2 sourceFile: - begin: 2385 - end: 2392 + begin: 2305 + end: 2312 } annotation: { path: 4 @@ -117,8 +117,8 @@ annotation: { path: 2 path: 2 sourceFile: - begin: 2435 - end: 2444 + begin: 2355 + end: 2364 } annotation: { path: 4 @@ -126,8 +126,8 @@ annotation: { path: 2 path: 3 sourceFile: - begin: 2556 - end: 2571 + begin: 2476 + end: 2491 } annotation: { path: 4 @@ -135,8 +135,8 @@ annotation: { path: 2 path: 3 sourceFile: - begin: 2662 - end: 2677 + begin: 2582 + end: 2597 } annotation: { path: 4 @@ -144,8 +144,8 @@ annotation: { path: 2 path: 3 sourceFile: - begin: 2806 - end: 2824 + begin: 2726 + end: 2744 } annotation: { path: 4 @@ -153,6 +153,6 @@ annotation: { path: 2 path: 3 sourceFile: - begin: 2916 - end: 2936 + begin: 2836 + end: 2856 } diff --git a/protoc_plugin/test/goldens/oneMessage.pb.dart b/protoc_plugin/test/goldens/oneMessage.pb.dart index b522b88b..3a33d98d 100644 --- a/protoc_plugin/test/goldens/oneMessage.pb.dart +++ b/protoc_plugin/test/goldens/oneMessage.pb.dart @@ -50,7 +50,6 @@ class PhoneNumber extends $pb.GeneratedMessage { static PhoneNumber create() => PhoneNumber._(); @$core.override PhoneNumber createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static PhoneNumber getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); diff --git a/protoc_plugin/test/goldens/oneMessage.pb.dart.meta b/protoc_plugin/test/goldens/oneMessage.pb.dart.meta index 96d71fa9..56b0cfa7 100644 --- a/protoc_plugin/test/goldens/oneMessage.pb.dart.meta +++ b/protoc_plugin/test/goldens/oneMessage.pb.dart.meta @@ -18,8 +18,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2161 - end: 2167 + begin: 2081 + end: 2087 } annotation: { path: 4 @@ -27,8 +27,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2209 - end: 2215 + begin: 2129 + end: 2135 } annotation: { path: 4 @@ -36,8 +36,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2295 - end: 2304 + begin: 2215 + end: 2224 } annotation: { path: 4 @@ -45,8 +45,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2347 - end: 2358 + begin: 2267 + end: 2278 } annotation: { path: 4 @@ -54,8 +54,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2418 - end: 2422 + begin: 2338 + end: 2342 } annotation: { path: 4 @@ -63,8 +63,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2464 - end: 2468 + begin: 2384 + end: 2388 } annotation: { path: 4 @@ -72,8 +72,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2550 - end: 2557 + begin: 2470 + end: 2477 } annotation: { path: 4 @@ -81,8 +81,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2600 - end: 2609 + begin: 2520 + end: 2529 } annotation: { path: 4 @@ -90,8 +90,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2672 - end: 2676 + begin: 2592 + end: 2596 } annotation: { path: 4 @@ -99,8 +99,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2723 - end: 2727 + begin: 2643 + end: 2647 } annotation: { path: 4 @@ -108,8 +108,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2807 - end: 2814 + begin: 2727 + end: 2734 } annotation: { path: 4 @@ -117,6 +117,6 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2857 - end: 2866 + begin: 2777 + end: 2786 } diff --git a/protoc_plugin/test/goldens/service.pb.dart b/protoc_plugin/test/goldens/service.pb.dart index d9c6c0a8..756f1988 100644 --- a/protoc_plugin/test/goldens/service.pb.dart +++ b/protoc_plugin/test/goldens/service.pb.dart @@ -47,7 +47,6 @@ class Empty extends $pb.GeneratedMessage { static Empty create() => Empty._(); @$core.override Empty createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') static Empty getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); From 6523dac66e2aa0e5672ac62e5edf01fdbdd58967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20A=C4=9Facan?= Date: Wed, 29 Oct 2025 08:22:03 +0000 Subject: [PATCH 2/3] Update --- protobuf/CHANGELOG.md | 2 +- protobuf/pubspec.yaml | 2 +- protobuf/test/mock_util.dart | 3 --- protoc_plugin/pubspec.yaml | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md index 07d0f012..88e1e856 100644 --- a/protobuf/CHANGELOG.md +++ b/protobuf/CHANGELOG.md @@ -1,4 +1,4 @@ -## 6.0.0-wip +## 6.0.0 * Update default size limit of `CodedBufferReader` from 67,108,864 bytes to 2,147,483,647 bytes, and default recursion limit from 64 to 100. diff --git a/protobuf/pubspec.yaml b/protobuf/pubspec.yaml index 84b70d09..b2fa5d54 100644 --- a/protobuf/pubspec.yaml +++ b/protobuf/pubspec.yaml @@ -1,5 +1,5 @@ name: protobuf -version: 5.1.0-wip +version: 6.0.0 description: >- Runtime library for protocol buffers support. Use with package:protoc_plugin to generate Dart code for your '.proto' files. diff --git a/protobuf/test/mock_util.dart b/protobuf/test/mock_util.dart index 9288cd60..fdd385ea 100644 --- a/protobuf/test/mock_util.dart +++ b/protobuf/test/mock_util.dart @@ -13,7 +13,6 @@ import 'package:protobuf/protobuf.dart' ProtobufEnum; final mockEnumValues = [ProtobufEnum(1, 'a'), ProtobufEnum(2, 'b')]; - BuilderInfo mockInfo(String className, CreateBuilderFunc create) { return BuilderInfo(className, createEmptyInstance: create) ..a(1, 'val', PbFieldType.O3, defaultOrMaker: 42) @@ -65,9 +64,7 @@ abstract class MockMessage extends GeneratedMessage { class T extends MockMessage { @override BuilderInfo get info_ => _info; - static final _info = mockInfo('T', T.new); - @override T createEmptyInstance() => T(); } diff --git a/protoc_plugin/pubspec.yaml b/protoc_plugin/pubspec.yaml index 3a44417c..86f35970 100644 --- a/protoc_plugin/pubspec.yaml +++ b/protoc_plugin/pubspec.yaml @@ -1,5 +1,5 @@ name: protoc_plugin -version: 23.0.0 +version: 24.0.0 description: A protobuf protoc compiler plugin used to generate Dart code. repository: https://github.com/google/protobuf.dart/tree/master/protoc_plugin @@ -14,7 +14,7 @@ dependencies: dart_style: ^3.0.0 fixnum: ^1.0.0 path: ^1.8.0 - protobuf: ^5.0.0 + protobuf: ^6.0.0 pub_semver: ^2.2.0 dev_dependencies: From 204b876be5ebc82d8d1cdd7799f117c292c3d8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20A=C4=9Facan?= Date: Thu, 30 Oct 2025 12:12:46 +0000 Subject: [PATCH 3/3] Update pubspec --- protoc_plugin/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc_plugin/pubspec.yaml b/protoc_plugin/pubspec.yaml index 3d2c0471..86f35970 100644 --- a/protoc_plugin/pubspec.yaml +++ b/protoc_plugin/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: dart_style: ^3.0.0 fixnum: ^1.0.0 path: ^1.8.0 - protobuf: ^5.0.0 + protobuf: ^6.0.0 pub_semver: ^2.2.0 dev_dependencies: