Skip to content

Commit 7874474

Browse files
Breaking Change: Remove unused helper methods for creating new mutable arraylists.
PiperOrigin-RevId: 600581644
1 parent 59c0271 commit 7874474

File tree

1 file changed

+0
-126
lines changed

1 file changed

+0
-126
lines changed

java/core/src/main/java/com/google/protobuf/GeneratedMessage.java

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -385,72 +385,22 @@ protected static IntList emptyIntList() {
385385
return IntArrayList.emptyList();
386386
}
387387

388-
// TODO: Unused. Remove.
389-
protected static IntList newIntList() {
390-
return new IntArrayList();
391-
}
392-
393-
// TODO: Redundant with makeMutableCopy(). Remove.
394-
protected static IntList mutableCopy(IntList list) {
395-
return makeMutableCopy(list);
396-
}
397-
398-
// TODO: Redundant with makeMutableCopy(). Remove.
399-
protected static LongList mutableCopy(LongList list) {
400-
return makeMutableCopy(list);
401-
}
402-
403-
// TODO: Redundant with makeMutableCopy(). Remove.
404-
protected static FloatList mutableCopy(FloatList list) {
405-
return makeMutableCopy(list);
406-
}
407-
408-
// TODO: Redundant with makeMutableCopy(). Remove.
409-
protected static DoubleList mutableCopy(DoubleList list) {
410-
return makeMutableCopy(list);
411-
}
412-
413-
// TODO: Redundant with makeMutableCopy(). Remove.
414-
protected static BooleanList mutableCopy(BooleanList list) {
415-
return makeMutableCopy(list);
416-
}
417-
418388
protected static LongList emptyLongList() {
419389
return LongArrayList.emptyList();
420390
}
421391

422-
// TODO: Unused. Remove.
423-
protected static LongList newLongList() {
424-
return new LongArrayList();
425-
}
426-
427392
protected static FloatList emptyFloatList() {
428393
return FloatArrayList.emptyList();
429394
}
430395

431-
// TODO: Unused. Remove.
432-
protected static FloatList newFloatList() {
433-
return new FloatArrayList();
434-
}
435-
436396
protected static DoubleList emptyDoubleList() {
437397
return DoubleArrayList.emptyList();
438398
}
439399

440-
// TODO: Unused. Remove.
441-
protected static DoubleList newDoubleList() {
442-
return new DoubleArrayList();
443-
}
444-
445400
protected static BooleanList emptyBooleanList() {
446401
return BooleanArrayList.emptyList();
447402
}
448403

449-
// TODO: Unused. Remove.
450-
protected static BooleanList newBooleanList() {
451-
return new BooleanArrayList();
452-
}
453-
454404
protected static <ListT extends ProtobufList<?>> ListT makeMutableCopy(ListT list) {
455405
return makeMutableCopy(list, 0);
456406
}
@@ -510,39 +460,6 @@ protected Object newInstance(UnusedPrivateParameter unused) {
510460
throw new UnsupportedOperationException("This method must be overridden by the subclass.");
511461
}
512462

513-
/**
514-
* Used by parsing constructors in generated classes.
515-
*
516-
* <p>TODO: remove unused method (extensions should be immutable after build)
517-
*/
518-
protected void makeExtensionsImmutable() {
519-
// Noop for messages without extensions.
520-
}
521-
522-
/**
523-
* TODO: remove this after b/29368482 is fixed. We need to move this interface to
524-
* AbstractMessage in order to versioning GeneratedMessage but this move breaks binary
525-
* compatibility for AppEngine. After AppEngine is fixed we can exclude this from google3.
526-
*
527-
* <p>TODO: Remove at breaking change since b/29368482 was fixed in 2020
528-
*/
529-
protected interface BuilderParent extends AbstractMessage.BuilderParent {}
530-
531-
/** TODO: remove this together with GeneratedMessage.BuilderParent. */
532-
protected abstract Message.Builder newBuilderForType(BuilderParent parent);
533-
534-
/** TODO: generated class should implement this directly */
535-
@Override
536-
protected Message.Builder newBuilderForType(final AbstractMessage.BuilderParent parent) {
537-
return newBuilderForType(
538-
new BuilderParent() {
539-
@Override
540-
public void markDirty() {
541-
parent.markDirty();
542-
}
543-
});
544-
}
545-
546463
/** Builder class for {@link GeneratedMessage}. */
547464
@SuppressWarnings("unchecked")
548465
public abstract static class Builder<BuilderT extends Builder<BuilderT>>
@@ -1102,49 +1019,6 @@ public boolean isInitialized() {
11021019
return super.isInitialized() && extensionsAreInitialized();
11031020
}
11041021

1105-
// TODO: remove mutating method from immutable type
1106-
@Override
1107-
protected boolean parseUnknownField(
1108-
CodedInputStream input,
1109-
UnknownFieldSet.Builder unknownFields,
1110-
ExtensionRegistryLite extensionRegistry,
1111-
int tag)
1112-
throws IOException {
1113-
return MessageReflection.mergeFieldFrom(
1114-
input,
1115-
input.shouldDiscardUnknownFields() ? null : unknownFields,
1116-
extensionRegistry,
1117-
getDescriptorForType(),
1118-
new MessageReflection.ExtensionAdapter(extensions),
1119-
tag);
1120-
}
1121-
1122-
/**
1123-
* Delegates to parseUnknownField. This method is obsolete, but we must retain it for
1124-
* compatibility with older generated code.
1125-
*
1126-
* <p>TODO: remove mutating method from immutable type
1127-
*/
1128-
@Override
1129-
protected boolean parseUnknownFieldProto3(
1130-
CodedInputStream input,
1131-
UnknownFieldSet.Builder unknownFields,
1132-
ExtensionRegistryLite extensionRegistry,
1133-
int tag)
1134-
throws IOException {
1135-
return parseUnknownField(input, unknownFields, extensionRegistry, tag);
1136-
}
1137-
1138-
/**
1139-
* Used by parsing constructors in generated classes.
1140-
*
1141-
* <p>TODO: remove unused method (extensions should be immutable after build)
1142-
*/
1143-
@Override
1144-
protected void makeExtensionsImmutable() {
1145-
extensions.makeImmutable();
1146-
}
1147-
11481022
/**
11491023
* Used by subclasses to serialize extensions. Extension ranges may be interleaved with field
11501024
* numbers, but we must write them in canonical (sorted by field number) order. ExtensionWriter

0 commit comments

Comments
 (0)