Java Docs: use instanceof with name binding (#2087)

* Java Docs: use instanceof with name binding

* remove changes in generated code

* Update docs/src/test/java/jdocs/ddata/protobuf/TwoPhaseSetSerializer2.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* merge issue

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
PJ Fanning 2025-08-25 13:45:13 +01:00 committed by GitHub
parent 18d7ff815a
commit 56470a4569
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 60 additions and 76 deletions

View file

@ -49,8 +49,8 @@ public class TwoPhaseSetSerializer2 extends AbstractSerializationSupport {
@Override
public byte[] toBinary(Object obj) {
if (obj instanceof TwoPhaseSet) {
return twoPhaseSetToProto((TwoPhaseSet) obj).toByteArray();
if (obj instanceof TwoPhaseSet tps) {
return twoPhaseSetToProto(tps).toByteArray();
} else {
throw new IllegalArgumentException("Can't serialize object of type " + obj.getClass());
}