Skip to content

Add LegacyProtoTypeAdapterFactory.#3014

Merged
eamonnmcmanus merged 7 commits intomainfrom
lptaf
Apr 17, 2026
Merged

Add LegacyProtoTypeAdapterFactory.#3014
eamonnmcmanus merged 7 commits intomainfrom
lptaf

Conversation

@eamonnmcmanus
Copy link
Copy Markdown
Member

@eamonnmcmanus eamonnmcmanus commented Apr 17, 2026

This is a migration aid for code that is currently accidentally relying
on ReflectiveTypeAdapterFactory to serialize and/or deserialize
protobuf messages. Such code depends on the internal details of how
protobuf messages are represented as Java objects, and can break if
those details change. This adapter freezes a particular representation
and allows code to become independent of future changes.

We do not recommend this for anything other than managing legacy code
that may have come to rely on a particular JSON format.

This code is not currently part of any released artifact.

This is a migration aid for code that is currently accidentally relying
on `ReflectiveTypeAdapterFactory` to serialize and/or deserialize
protobuf messages. Such code depends on the internal details of how
protobuf messages are represented as Java objects, and can break if
those details change. This adapter freezes a particular representation
and allows code to become independent of future changes.

We do not recommend this for anything other than managing legacy code
that may have come to rely on a particular JSON format.
@eamonnmcmanus eamonnmcmanus requested a review from cpovirk April 17, 2026 01:09
@eamonnmcmanus eamonnmcmanus marked this pull request as draft April 17, 2026 01:09
String fieldName = readFieldName(in);
Matcher matcher = BIT_FIELD_PATTERN.matcher(fieldName);
if (matcher.matches()) {
int shift = Integer.parseInt(matcher.group(1)) * 32;
@eamonnmcmanus eamonnmcmanus marked this pull request as ready for review April 17, 2026 01:22
This is pretty theoretical, but github-advanced-security flagged it.
@eamonnmcmanus eamonnmcmanus merged commit 48db33c into main Apr 17, 2026
27 checks passed
@eamonnmcmanus eamonnmcmanus deleted the lptaf branch April 17, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants