Migrate some internals of the library off the older apis.
Also mark some of the old apis as deprecated, but the old generated code
suppressed warnings broadly to support protobuf deprecations.
PiperOrigin-RevId: 668003974
Since a group GPBUnknownField uses a GPBUnknownFields and that is mutable, it needs to be copied so two instances aren't linked.
PiperOrigin-RevId: 663323972
GPBUnknownFields will be going away in the next major release of the ObjC
Protobuf runtime. Code should be updated to make use of GPBUnknownFields
instead.
PiperOrigin-RevId: 659963056
`GPBTextFormatForMessage()` will contain any information for unknown fields.
And it clears the way for `GPBUnknownFieldSet` to eventually be deprecated
also.
PiperOrigin-RevId: 655184316
Make a new internal api for collecting up the unknown group fields
that will be used in a future change.
Add testing for the new api and for unknown field parsing of groups in
general.
PiperOrigin-RevId: 654875605
- Follow upb and only accept the first value for `type_id` and `message`
- Reflow some of the logic to hopefully make things a little easier to follow/clear.
- Validate some more assertion about things the extensions for a MessageSet.
PiperOrigin-RevId: 652545240
Ensure all apis are called directly in tests.
Correct `GPBUnknownField` `-copy` to not have to make a new instance
since it is immutable in the new form.
PiperOrigin-RevId: 650690942
Port of the interesting `GPBUnknownFieldsSet` tests to `GPBUnknownFields`
as they provide coverage of general handing of unknown fields during parsing.
Also tweak the `Set` tests to actually use a registry to confirm behaviors around
extensions where the test previously wasn't as complete.
PiperOrigin-RevId: 650660181
`GPBUnknownFields` additions:
- Provide `Optional` based apis for the `getFirst*` apis.
- Map the `NSFastEnumeration` over as a `Sequence` to support looping over the fields.
`GPBUnknownField` addition:
- Add an `enum` with associated values to provide a more type-safe way for inspection.
PiperOrigin-RevId: 649090744
`GPBUnknownFields` will be the eventually replacement for `GPBUnknownFieldSet`. This
introduces the type and the changes to `GPBUnknownField`.
The new api will preserve the wire ordering of unknown fields. This is now checked
in conformance tests.
While this adds the type changes and tests them, it does not yet wire the changes
in to the rest of the Runtime, so the conformance tests still done pass.
`GPBUnknownFieldSet` also hasn't been deprecated yet, that will come in later with
the wiring in to the runtime.
PiperOrigin-RevId: 648361455
This simply exposes preexisting logic. This read-only API is for convenience and doesn't reveal any information that was not already available. `[GPBCodedInputStream position]` is already a public API. The `limit` is known to the user because it's specified by them.
PiperOrigin-RevId: 635502694
This prevents shadowing of `java.lang` package commonly used in protobuf gencode. Existing extensions named `java` may or may not previously fail to compile depending on if the contents of their .proto result in gencode using `java.lang`. This is needed to fix `java_features.proto` lite gencode since enum gencode uses `java.lang`. Fields named `java` should already be escaped.
*Warning: This may break user code for existing protos with extensions named `java`. References to the extension should be renamed to use `java_` e.g. registry.add(GeneratedClassName.java_)*
PiperOrigin-RevId: 632508249
GPB_ENUM_FWD_DECLARE needs `int32_t`, so add the import so GPBBootstrap.h
stands on its own without needing users to import something else.
Add another compile test file to ensure this doesn't break.
PiperOrigin-RevId: 610403337
This restores the behavior of `-[GPBMessage writeToOutputStream:]` throwing an
exception if the underlying `GPBCodedOutputStream` failed to flush.
`GPBDictionary` and `GPBUnknownFieldSet` could also have theoretically thrown
exceptions from just about any method (although not for disk I/O reasons), so
this also restores that functionality by explicitly flushing before deallocating
the `GPBCodedOutputStream`.
PiperOrigin-RevId: 580207004
If `-[GPBCodedOutputStream flush]` failed (e.g., because the filesystem
was out of space), then `-[GPBCodedOutputStream dealloc]` would throw
an exception.
`-dealloc` cannot fail, so the only thing to do in this case is to silently
swallow the exception.
PiperOrigin-RevId: 579916429
ctype can not be used for none string/bytes fields. ctye=CORD can not be used for extensions. A new macro PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE is added that will be flipped for our next breaking release.
PiperOrigin-RevId: 555615362
The validation is done at the highest point so if a sub message is what
goes over the limit it is caught at the outer message, thus reducing the
impact on the serialization code.
PiperOrigin-RevId: 511473008
For normal fields, closed enums get their out of range values put into unknown
fields, but that wasn't happening for extension fields, this fixes that by
adding the validation during parsing.
Also document on the getExtension API what happens with enums.
Add tests to confirm expected behaviors.
PiperOrigin-RevId: 491356730
objectivec/README.md lists Xcode 10.2 as the minimum, update things accordingly.
- Remove code paths referencing the older versions.
- Remove support from the testing script.
- Minor formatting changes to make thing happy.
- Block clang-format from the PDDM macro definitions to avoid it wrapping
things.
- Don't add clang-format directives to the expansion, easier to handling
it outside of there.
- Remove some types not needed.
- Remove some files not needed.
- Move some tests files into different prefixes to logically segment things.
- Add objc_class_prefix to the files.
- Use an expected prefix file during generation to exercise that code and
validate things.
- Require prefixes for the test file.