From b1f2f37a8a65ce0c0e223ab164263bbd2e32b189 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 30 Jul 2023 15:46:09 +0100 Subject: [PATCH 001/632] protect 1.0.x branch (#513) --- .asf.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.asf.yaml b/.asf.yaml index 9889f634974..68a94a6f012 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -46,6 +46,18 @@ github: dismiss_stale_reviews: false require_code_owner_reviews: false required_approving_review_count: 1 + 1.0.x: + required_status_checks: + # strict means "Require branches to be up to date before merging". + strict: false + # contexts are the names of checks that must pass + contexts: + - Code is formatted + - Check headers + required_pull_request_reviews: + dismiss_stale_reviews: false + require_code_owner_reviews: false + required_approving_review_count: 1 notifications: commits: commits@pekko.apache.org From 8d5c34f48fec8c6f6deb8c105e2fe4c1048af23c Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 31 Jul 2023 11:06:17 +0100 Subject: [PATCH 002/632] replace use of Akka in comments (#516) * replace use of Akka in comments * fix config name --- .../apache/pekko/actor/testkit/typed/CapturedLogEvent.scala | 2 +- .../remote/serialization/DaemonMsgCreateSerializer.scala | 2 +- .../pekko/remote/serialization/ProtobufSerializer.scala | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/CapturedLogEvent.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/CapturedLogEvent.scala index a79a547dac5..6ee53a77092 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/CapturedLogEvent.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/CapturedLogEvent.scala @@ -85,7 +85,7 @@ object CapturedLogEvent { } /** - * Auxiliary constructor that receives Akka's internal [[OptionVal]] as parameters and converts them to Scala's [[Option]]. + * Auxiliary constructor that receives Pekko's internal [[OptionVal]] as parameters and converts them to Scala's [[Option]]. * INTERNAL API */ @InternalApi diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala index 89b81c7ec76..78b0e341711 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala @@ -29,7 +29,7 @@ import pekko.util.ccompat._ import pekko.util.ccompat.JavaConverters._ /** - * Serializes Akka's internal DaemonMsgCreate using protobuf + * Serializes Pekko's internal DaemonMsgCreate using protobuf * for the core structure of DaemonMsgCreate, Props and Deploy. * Serialization of contained RouterConfig, Config, and Scope * is done with configured serializer for those classes. diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala index 73c9ca4fbd9..06aacc7d1dc 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala @@ -31,7 +31,7 @@ object ProtobufSerializer { private val ARRAY_OF_BYTE_ARRAY = Array[Class[_]](classOf[Array[Byte]]) /** - * Helper to serialize an [[pekko.actor.ActorRef]] to Akka's + * Helper to serialize an [[pekko.actor.ActorRef]] to Pekko's * protobuf representation. */ def serializeActorRef(ref: ActorRef): ActorRefData = { @@ -40,7 +40,7 @@ object ProtobufSerializer { /** * Helper to materialize (lookup) an [[pekko.actor.ActorRef]] - * from Akka's protobuf representation in the supplied + * from Pekko's protobuf representation in the supplied * [[pekko.actor.ActorSystem]]. */ def deserializeActorRef(system: ExtendedActorSystem, refProtocol: ActorRefData): ActorRef = @@ -140,7 +140,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer * * If an old class is removed from `serialization-bindings` when it's not used for serialization * but still used for deserialization (e.g. rolling update with serialization changes) it can - * be allowed by specifying in `pekko.protobuf.allowed-classes`. + * be allowed by specifying in `pekko.serialization.protobuf.allowed-classes`. * * That is also possible when changing a binding from a ProtobufSerializer to another serializer (e.g. Jackson) * and still bind with the same class (interface). From da4bb1622987cda08ba8f00284399b9eba25b0a0 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 31 Jul 2023 12:35:14 +0100 Subject: [PATCH 003/632] publish 1.0 snapshots (#518) --- .github/workflows/publish-1.0-nightly.yml | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/publish-1.0-nightly.yml diff --git a/.github/workflows/publish-1.0-nightly.yml b/.github/workflows/publish-1.0-nightly.yml new file mode 100644 index 00000000000..b6c79cfc495 --- /dev/null +++ b/.github/workflows/publish-1.0-nightly.yml @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Based on Apache Arrow's java-nightly workflow +# https://github.com/apache/arrow/blob/master/.github/workflows/java_nightly.yml +name: Publish nightly 1.0 snapshots + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + +permissions: + contents: read + +jobs: + publish-nightly: + name: Publish 1.0 nightly + runs-on: ubuntu-20.04 + if: github.repository == 'apache/incubator-pekko' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: 1.0.x + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - name: Cache Coursier cache + uses: coursier/cache-action@v6 + + - name: Install Graphviz + run: |- + sudo apt-get install graphviz + + - name: Report MIMA incompatibility issues + run: |- + sbt +mimaReportBinaryIssues + + - name: Publish to Apache Maven repo + env: + NEXUS_USER: ${{ secrets.NEXUS_USER }} + NEXUS_PW: ${{ secrets.NEXUS_PW }} + run: sbt +publish + + - name: Build Documentation + run: |- + sbt -Dpekko.genjavadoc.enabled=true docs/paradox unidoc From 617ca6a4446c20ab924bd697d13dae55285693fd Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 31 Jul 2023 20:09:25 +0100 Subject: [PATCH 004/632] Update .scala-steward.conf to remove old pinning (#519) --- .scala-steward.conf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.scala-steward.conf b/.scala-steward.conf index 3070aaa00cf..dd02ce828f5 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -1,10 +1,5 @@ pullRequests.frequency = "@monthly" -updates.pin = [ - { groupId = "org.scalatest", artifactId = "scalatest", version = "3.1." } - { groupId = "com.fasterxml.jackson.core", artifactId = "jackson-core", version = "2.11." } -] - updates.ignore = [ { groupId = "com.google.protobuf", artifactId = "protobuf-java" } { groupId = "org.scalameta", artifactId = "scalafmt-core" } From c18a81a243e3f8b3452b07b4d596409334661e8d Mon Sep 17 00:00:00 2001 From: Matthew de Detrich Date: Tue, 1 Aug 2023 09:47:22 +0200 Subject: [PATCH 005/632] Remove javafmtOnCompile and check in CI --- .github/workflows/build-test-prValidation.yml | 26 +++++++++++++++++++ build.sbt | 4 +-- project/JavaFormatter.scala | 5 +--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-prValidation.yml b/.github/workflows/build-test-prValidation.yml index d693b7d11a8..e66343ff4ea 100644 --- a/.github/workflows/build-test-prValidation.yml +++ b/.github/workflows/build-test-prValidation.yml @@ -11,6 +11,32 @@ concurrency: cancel-in-progress: true jobs: + check-code-style: + name: Check / Code Style + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3.1.0 + with: + # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves + fetch-depth: 0 + + - name: Cache Coursier cache + uses: coursier/cache-action@v6.4.0 + + - name: Setup Java 8 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + + - name: Code style check + run: |- + cp .jvmopts-ci .jvmopts + sbt \ + -Dsbt.override.build.repos=false \ + -Dsbt.log.noformat=false \ + javafmtCheckAll pull-request-validation: name: Check / Tests runs-on: ubuntu-20.04 diff --git a/build.sbt b/build.sbt index 7a37cc6f393..1fa18f4d642 100644 --- a/build.sbt +++ b/build.sbt @@ -37,8 +37,8 @@ enablePlugins( JavaFormatterPlugin) disablePlugins(MimaPlugin) -addCommandAlias("verifyCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; headerCheckAll") -addCommandAlias("applyCodeStyle", "headerCreateAll; scalafmtAll; scalafmtSbt") +addCommandAlias("verifyCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; javafmtCheckAll; headerCheckAll") +addCommandAlias("applyCodeStyle", "headerCreateAll; scalafmtAll; scalafmtSbt; javafmtAll") addCommandAlias( name = "fixall", diff --git a/project/JavaFormatter.scala b/project/JavaFormatter.scala index 9944b231a3c..b3a73d68ecc 100644 --- a/project/JavaFormatter.scala +++ b/project/JavaFormatter.scala @@ -23,8 +23,6 @@ object JavaFormatter extends AutoPlugin { private val ignoreConfigFileName: String = ".sbt-java-formatter.conf" private val descriptor: String = "sbt-java-formatter" - private val formatOnCompile = !sys.props.contains("pekko.no.discipline") - import JavaFormatterPlugin.autoImport._ import sbt.Keys._ import sbt._ @@ -38,6 +36,5 @@ object JavaFormatter extends AutoPlugin { new ProjectFileIgnoreSupport((ThisBuild / baseDirectory).value / ignoreConfigFileName, descriptor) val simpleFileFilter = new SimpleFileFilter(file => ignoreSupport.isIgnoredByFileOrPackages(file)) simpleFileFilter || (javafmt / excludeFilter).value - }, - javafmtOnCompile := formatOnCompile) + }) } From 964dcf53eb9a81a65944a1b1d51575091fe0a031 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 1 Aug 2023 11:35:58 +0100 Subject: [PATCH 006/632] remove shaded protobuf-java v2 jar (pekko-protobuf) (#489) * remove protobuf v2 support * Update OSGi.scala * ci issue * remove refs to pekko-protobuf classes * fix comment * update comments * Update Serialization.scala --- .github/workflows/scala3-build.yml | 2 +- .github/workflows/scala3-compile.yml | 2 +- LICENSE | 6 - actor/src/main/resources/reference.conf | 1 - .../pekko/serialization/Serialization.scala | 6 +- build.sbt | 11 - legal/pekko-protobuf-jar-license.txt | 207 - project/AddMetaInfLicenseFiles.scala | 13 - project/OSGi.scala | 2 - project/PekkoDisciplinePlugin.scala | 2 - .../pekko/protobuf/AbstractMessage.java | 943 - .../pekko/protobuf/AbstractMessageLite.java | 356 - .../apache/pekko/protobuf/AbstractParser.java | 266 - .../pekko/protobuf/BlockingRpcChannel.java | 64 - .../pekko/protobuf/BlockingService.java | 77 - .../pekko/protobuf/BoundedByteString.java | 176 - .../org/apache/pekko/protobuf/ByteString.java | 979 - .../pekko/protobuf/CodedInputStream.java | 933 - .../pekko/protobuf/CodedOutputStream.java | 1119 - .../pekko/protobuf/DescriptorProtos.java | 28513 ---------------- .../apache/pekko/protobuf/Descriptors.java | 1983 -- .../apache/pekko/protobuf/DynamicMessage.java | 495 - .../pekko/protobuf/ExtensionRegistry.java | 279 - .../pekko/protobuf/ExtensionRegistryLite.java | 198 - .../org/apache/pekko/protobuf/FieldSet.java | 874 - .../pekko/protobuf/GeneratedMessage.java | 1958 -- .../pekko/protobuf/GeneratedMessageLite.java | 747 - .../org/apache/pekko/protobuf/Internal.java | 166 - .../InvalidProtocolBufferException.java | 127 - .../org/apache/pekko/protobuf/LazyField.java | 223 - .../pekko/protobuf/LazyStringArrayList.java | 191 - .../apache/pekko/protobuf/LazyStringList.java | 94 - .../pekko/protobuf/LiteralByteString.java | 362 - .../org/apache/pekko/protobuf/Message.java | 250 - .../apache/pekko/protobuf/MessageLite.java | 332 - .../pekko/protobuf/MessageLiteOrBuilder.java | 73 - .../pekko/protobuf/MessageOrBuilder.java | 142 - .../org/apache/pekko/protobuf/Parser.java | 272 - .../pekko/protobuf/ProtocolMessageEnum.java | 71 - .../pekko/protobuf/RepeatedFieldBuilder.java | 709 - .../apache/pekko/protobuf/RopeByteString.java | 956 - .../apache/pekko/protobuf/RpcCallback.java | 60 - .../org/apache/pekko/protobuf/RpcChannel.java | 84 - .../apache/pekko/protobuf/RpcController.java | 131 - .../org/apache/pekko/protobuf/RpcUtil.java | 148 - .../org/apache/pekko/protobuf/Service.java | 130 - .../pekko/protobuf/ServiceException.java | 65 - .../pekko/protobuf/SingleFieldBuilder.java | 254 - .../apache/pekko/protobuf/SmallSortedMap.java | 631 - .../org/apache/pekko/protobuf/TextFormat.java | 1572 - .../UninitializedMessageException.java | 112 - .../pekko/protobuf/UnknownFieldSet.java | 991 - .../protobuf/UnmodifiableLazyStringList.java | 165 - .../java/org/apache/pekko/protobuf/Utf8.java | 362 - .../org/apache/pekko/protobuf/WireFormat.java | 176 - remote/src/main/resources/reference.conf | 9 - .../serialization/ProtobufSerializer.scala | 4 +- .../ProtobufSerializerSpec.scala | 1 - 58 files changed, 6 insertions(+), 49069 deletions(-) delete mode 100644 legal/pekko-protobuf-jar-license.txt delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Descriptors.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/DynamicMessage.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/ExtensionRegistry.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/ExtensionRegistryLite.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/FieldSet.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/GeneratedMessage.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/GeneratedMessageLite.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Internal.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/InvalidProtocolBufferException.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/LazyField.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/LazyStringArrayList.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/LazyStringList.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/LiteralByteString.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Message.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/MessageLite.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/MessageLiteOrBuilder.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/MessageOrBuilder.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Parser.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/ProtocolMessageEnum.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RepeatedFieldBuilder.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RopeByteString.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RpcCallback.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RpcChannel.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RpcController.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/RpcUtil.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Service.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/ServiceException.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/SingleFieldBuilder.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/SmallSortedMap.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/TextFormat.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/UninitializedMessageException.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/UnknownFieldSet.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/UnmodifiableLazyStringList.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/Utf8.java delete mode 100644 protobuf/src/main/java/org/apache/pekko/protobuf/WireFormat.java diff --git a/.github/workflows/scala3-build.yml b/.github/workflows/scala3-build.yml index a9e37843276..8a6c2e34920 100644 --- a/.github/workflows/scala3-build.yml +++ b/.github/workflows/scala3-build.yml @@ -30,7 +30,7 @@ jobs: - serialization-jackson/test - stream/test stream-testkit/test stream-tests/test stream-typed/test - stream-tests-tck/test - - remote/test remote-tests/test protobuf/test protobuf-v3/test + - remote/test remote-tests/test protobuf-v3/test fail-fast: true steps: - name: Checkout diff --git a/.github/workflows/scala3-compile.yml b/.github/workflows/scala3-compile.yml index f16748ecc8f..922ed67ee05 100644 --- a/.github/workflows/scala3-compile.yml +++ b/.github/workflows/scala3-compile.yml @@ -28,7 +28,7 @@ jobs: - serialization-jackson/Test/compile - stream/Test/compile stream-testkit/Test/compile stream-tests/Test/compile stream-typed/Test/compile - stream-tests-tck/Test/compile - - remote/Test/compile remote-tests/Test/compile protobuf/Test/compile protobuf-v3/Test/compile + - remote/Test/compile remote-tests/Test/compile protobuf-v3/Test/compile fail-fast: true steps: - name: Checkout diff --git a/LICENSE b/LICENSE index ec2dc50f3e9..fc1ec51f45e 100644 --- a/LICENSE +++ b/LICENSE @@ -353,12 +353,6 @@ Copyright 2014 - 2016 Real Logic Ltd. --------------- -pekko-protobuf contains the sources of Google protobuf 2.5.0 runtime support, -moved into the source package `org.apache.pekko.protobuf` so as to avoid version conflicts. -For license information see COPYING.protobuf - ---------------- - pekko-persistence-typed contains AuctionEntity.java in its test source. This code is derived from a class in Lagom , licensed under the Apache 2.0 license. diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf index a2e01c016cc..b625c5b260a 100644 --- a/actor/src/main/resources/reference.conf +++ b/actor/src/main/resources/reference.conf @@ -800,7 +800,6 @@ pekko { "com.google.protobuf.GeneratedMessage", "com.google.protobuf.GeneratedMessageV3", "scalapb.GeneratedMessageCompanion", - "org.apache.pekko.protobuf.GeneratedMessage", "org.apache.pekko.protobufv3.internal.GeneratedMessageV3" ] diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala index 9c5b31bd629..76b5c2901df 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala @@ -447,7 +447,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { private[pekko] val bindings: immutable.Seq[ClassSerializer] = { val fromConfig = for { (className: String, alias: String) <- settings.SerializationBindings - if alias != "none" && checkGoogleProtobuf(className) && checkPekkoProtobuf(className) + if alias != "none" && checkGoogleProtobuf(className) } yield (system.dynamicAccess.getClassFor[Any](className).get, serializers(alias)) val fromSettings = serializerDetails.flatMap { detail => @@ -484,10 +484,6 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { // include "com.google.protobuf.GeneratedMessage" = proto in configured serialization-bindings. private def checkGoogleProtobuf(className: String): Boolean = checkClass("com.google.protobuf", className) - // pekko-protobuf is now not a dependency of remote so only load if user has explicitly added it - // remove in v1.1 - private def checkPekkoProtobuf(className: String): Boolean = checkClass("org.apache.pekko.protobuf", className) - private def checkClass(prefix: String, className: String): Boolean = !className.startsWith(prefix) || system.dynamicAccess.getClassFor[Any](className).isSuccess diff --git a/build.sbt b/build.sbt index 1fa18f4d642..d2c96335966 100644 --- a/build.sbt +++ b/build.sbt @@ -84,7 +84,6 @@ lazy val userProjects: Seq[ProjectReference] = List[ProjectReference]( persistenceQuery, persistenceTyped, persistenceTestkit, - protobuf, protobufV3, pki, remote, @@ -116,7 +115,6 @@ lazy val root = Project(id = "pekko", base = file(".")) UnidocRoot.autoImport.unidocRootIgnoreProjects := Seq( remoteTests, benchJmh, - protobuf, protobufV3, pekkoScalaNightly, docs, @@ -362,14 +360,6 @@ lazy val persistenceTypedTests = pekkoModule("persistence-typed-tests") .disablePlugins(MimaPlugin) .enablePlugins(NoPublish) -lazy val protobuf = pekkoModule("protobuf") - .settings(OSGi.protobuf) - .settings(AutomaticModuleName.settings("pekko.protobuf")) - .settings(AddMetaInfLicenseFiles.protobufSettings) - .enablePlugins(ScaladocNoVerificationOfDiagrams) - .disablePlugins(MimaPlugin) - .settings(autoScalaLibrary := false) // Pure java project - lazy val protobufV3 = pekkoModule("protobuf-v3") .settings(OSGi.protobufV3) .settings(AutomaticModuleName.settings("pekko.protobuf.v3")) @@ -413,7 +403,6 @@ lazy val remote = actor, stream, pki, - protobuf % "test", actorTests % "test->test", testkit % "test->test", streamTestkit % "test", diff --git a/legal/pekko-protobuf-jar-license.txt b/legal/pekko-protobuf-jar-license.txt deleted file mode 100644 index d58aebf02a5..00000000000 --- a/legal/pekko-protobuf-jar-license.txt +++ /dev/null @@ -1,207 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---------------- - -pekko-protobuf contains the sources of Google protobuf 2.5.0 runtime support, -moved into the source package `org.apache.pekko.protobuf` so as to avoid version conflicts. -For license information see COPYING.protobuf diff --git a/project/AddMetaInfLicenseFiles.scala b/project/AddMetaInfLicenseFiles.scala index 0a4532a2edc..94c89916d18 100644 --- a/project/AddMetaInfLicenseFiles.scala +++ b/project/AddMetaInfLicenseFiles.scala @@ -64,19 +64,6 @@ object AddMetaInfLicenseFiles extends AutoPlugin { apacheSonatypeLicenseFile := baseDir.value / "legal" / "pekko-remote-jar-license.txt", apacheSonatypeNoticeFile := baseDir.value / "legal" / "pekko-remote-jar-notice.txt") - /** - * Settings specific for Pekko protobuf subproject which requires a different license file - * as well as an additional "COPYING.protobuf" file. - */ - lazy val protobufSettings = Seq( - apacheSonatypeLicenseFile := baseDir.value / "legal" / "pekko-protobuf-jar-license.txt") ++ inConfig(Compile)(Seq( - resourceGenerators += { - Def.task { - List( - ApacheSonatypePlugin.addFileToMetaInf(resourceManaged.value, baseDir.value / "COPYING.protobuf")) - } - })) - /** * Settings specific for Pekko protobuf-v3 subproject which requires a different license file * as well as an additional "COPYING.protobuf" file. diff --git a/project/OSGi.scala b/project/OSGi.scala index e3e8946199e..bafd5ede1ca 100644 --- a/project/OSGi.scala +++ b/project/OSGi.scala @@ -70,8 +70,6 @@ object OSGi { val osgi = exports(Seq("org.apache.pekko.osgi.*")) - val protobuf = exports(Seq("org.apache.pekko.protobuf.*")) - val protobufV3 = osgiSettings ++ Seq( OsgiKeys.importPackage := Seq( "!sun.misc", diff --git a/project/PekkoDisciplinePlugin.scala b/project/PekkoDisciplinePlugin.scala index 6c5ceefb8f3..37c78170f99 100644 --- a/project/PekkoDisciplinePlugin.scala +++ b/project/PekkoDisciplinePlugin.scala @@ -32,8 +32,6 @@ object PekkoDisciplinePlugin extends AutoPlugin { "pekko-actor-typed-tests", // references to deprecated PARSER fields in generated message formats? "pekko-cluster-typed", - // use of deprecated org.apache.pekko.protobuf.GeneratedMessage - "pekko-protobuf", "pekko-protobuf-v3", // references to deprecated PARSER fields in generated message formats? "pekko-remote", diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java deleted file mode 100644 index 595776a9472..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java +++ /dev/null @@ -1,943 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import org.apache.pekko.protobuf.Descriptors.Descriptor; -import org.apache.pekko.protobuf.Descriptors.FieldDescriptor; -import org.apache.pekko.protobuf.GeneratedMessage.ExtendableBuilder; -import org.apache.pekko.protobuf.Internal.EnumLite; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * A partial implementation of the {@link Message} interface which implements - * as many methods of that interface as possible in terms of other methods. - * - * @author kenton@google.com Kenton Varda - */ -public abstract class AbstractMessage extends AbstractMessageLite - implements Message { - @SuppressWarnings("unchecked") - public boolean isInitialized() { - // Check that all required fields are present. - for (final FieldDescriptor field : getDescriptorForType().getFields()) { - if (field.isRequired()) { - if (!hasField(field)) { - return false; - } - } - } - - // Check that embedded messages are initialized. - for (final Map.Entry entry : - getAllFields().entrySet()) { - final FieldDescriptor field = entry.getKey(); - if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - if (field.isRepeated()) { - for (final Message element : (List) entry.getValue()) { - if (!element.isInitialized()) { - return false; - } - } - } else { - if (!((Message) entry.getValue()).isInitialized()) { - return false; - } - } - } - } - - return true; - } - - public List findInitializationErrors() { - return Builder.findMissingFields(this); - } - - public String getInitializationErrorString() { - return delimitWithCommas(findInitializationErrors()); - } - - private static String delimitWithCommas(List parts) { - StringBuilder result = new StringBuilder(); - for (String part : parts) { - if (result.length() > 0) { - result.append(", "); - } - result.append(part); - } - return result.toString(); - } - - @Override - public final String toString() { - return TextFormat.printToString(this); - } - - public void writeTo(final CodedOutputStream output) throws IOException { - final boolean isMessageSet = - getDescriptorForType().getOptions().getMessageSetWireFormat(); - - for (final Map.Entry entry : - getAllFields().entrySet()) { - final FieldDescriptor field = entry.getKey(); - final Object value = entry.getValue(); - if (isMessageSet && field.isExtension() && - field.getType() == FieldDescriptor.Type.MESSAGE && - !field.isRepeated()) { - output.writeMessageSetExtension(field.getNumber(), (Message) value); - } else { - FieldSet.writeField(field, value, output); - } - } - - final UnknownFieldSet unknownFields = getUnknownFields(); - if (isMessageSet) { - unknownFields.writeAsMessageSetTo(output); - } else { - unknownFields.writeTo(output); - } - } - - private int memoizedSize = -1; - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) { - return size; - } - - size = 0; - final boolean isMessageSet = - getDescriptorForType().getOptions().getMessageSetWireFormat(); - - for (final Map.Entry entry : - getAllFields().entrySet()) { - final FieldDescriptor field = entry.getKey(); - final Object value = entry.getValue(); - if (isMessageSet && field.isExtension() && - field.getType() == FieldDescriptor.Type.MESSAGE && - !field.isRepeated()) { - size += CodedOutputStream.computeMessageSetExtensionSize( - field.getNumber(), (Message) value); - } else { - size += FieldSet.computeFieldSize(field, value); - } - } - - final UnknownFieldSet unknownFields = getUnknownFields(); - if (isMessageSet) { - size += unknownFields.getSerializedSizeAsMessageSet(); - } else { - size += unknownFields.getSerializedSize(); - } - - memoizedSize = size; - return size; - } - - @Override - public boolean equals(final Object other) { - if (other == this) { - return true; - } - if (!(other instanceof Message)) { - return false; - } - final Message otherMessage = (Message) other; - if (getDescriptorForType() != otherMessage.getDescriptorForType()) { - return false; - } - return getAllFields().equals(otherMessage.getAllFields()) && - getUnknownFields().equals(otherMessage.getUnknownFields()); - } - - @Override - public int hashCode() { - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = hashFields(hash, getAllFields()); - hash = (29 * hash) + getUnknownFields().hashCode(); - return hash; - } - - /** Get a hash code for given fields and values, using the given seed. */ - @SuppressWarnings("unchecked") - protected int hashFields(int hash, Map map) { - for (Map.Entry entry : map.entrySet()) { - FieldDescriptor field = entry.getKey(); - Object value = entry.getValue(); - hash = (37 * hash) + field.getNumber(); - if (field.getType() != FieldDescriptor.Type.ENUM){ - hash = (53 * hash) + value.hashCode(); - } else if (field.isRepeated()) { - List list = (List) value; - hash = (53 * hash) + hashEnumList(list); - } else { - hash = (53 * hash) + hashEnum((EnumLite) value); - } - } - return hash; - } - - /** - * Helper method for implementing {@link Message#hashCode()}. - * @see Boolean#hashCode() - */ - protected static int hashLong(long n) { - return (int) (n ^ (n >>> 32)); - } - - /** - * Helper method for implementing {@link Message#hashCode()}. - * @see Boolean#hashCode() - */ - protected static int hashBoolean(boolean b) { - return b ? 1231 : 1237; - } - - /** - * Package private helper method for AbstractParser to create - * UninitializedMessageException with missing field information. - */ - @Override - UninitializedMessageException newUninitializedMessageException() { - return Builder.newUninitializedMessageException(this); - } - - /** - * Helper method for implementing {@link Message#hashCode()}. - *

- * This is needed because {@link java.lang.Enum#hashCode()} is final, but we - * need to use the field number as the hash code to ensure compatibility - * between statically and dynamically generated enum objects. - */ - protected static int hashEnum(EnumLite e) { - return e.getNumber(); - } - - /** Helper method for implementing {@link Message#hashCode()}. */ - protected static int hashEnumList(List list) { - int hash = 1; - for (EnumLite e : list) { - hash = 31 * hash + hashEnum(e); - } - return hash; - } - - // ================================================================= - - /** - * A partial implementation of the {@link Message.Builder} interface which - * implements as many methods of that interface as possible in terms of - * other methods. - */ - @SuppressWarnings("unchecked") - public static abstract class Builder - extends AbstractMessageLite.Builder - implements Message.Builder { - // The compiler produces an error if this is not declared explicitly. - @Override - public abstract BuilderType clone(); - - public BuilderType clear() { - for (final Map.Entry entry : - getAllFields().entrySet()) { - clearField(entry.getKey()); - } - return (BuilderType) this; - } - - public List findInitializationErrors() { - return findMissingFields(this); - } - - public String getInitializationErrorString() { - return delimitWithCommas(findInitializationErrors()); - } - - public BuilderType mergeFrom(final Message other) { - if (other.getDescriptorForType() != getDescriptorForType()) { - throw new IllegalArgumentException( - "mergeFrom(Message) can only merge messages of the same type."); - } - - // Note: We don't attempt to verify that other's fields have valid - // types. Doing so would be a losing battle. We'd have to verify - // all sub-messages as well, and we'd have to make copies of all of - // them to insure that they don't change after verification (since - // the Message interface itself cannot enforce immutability of - // implementations). - // TODO(kenton): Provide a function somewhere called makeDeepCopy() - // which allows people to make secure deep copies of messages. - - for (final Map.Entry entry : - other.getAllFields().entrySet()) { - final FieldDescriptor field = entry.getKey(); - if (field.isRepeated()) { - for (final Object element : (List)entry.getValue()) { - addRepeatedField(field, element); - } - } else if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - final Message existingValue = (Message)getField(field); - if (existingValue == existingValue.getDefaultInstanceForType()) { - setField(field, entry.getValue()); - } else { - setField(field, - existingValue.newBuilderForType() - .mergeFrom(existingValue) - .mergeFrom((Message)entry.getValue()) - .build()); - } - } else { - setField(field, entry.getValue()); - } - } - - mergeUnknownFields(other.getUnknownFields()); - - return (BuilderType) this; - } - - @Override - public BuilderType mergeFrom(final CodedInputStream input) - throws IOException { - return mergeFrom(input, ExtensionRegistry.getEmptyRegistry()); - } - - @Override - public BuilderType mergeFrom( - final CodedInputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - final UnknownFieldSet.Builder unknownFields = - UnknownFieldSet.newBuilder(getUnknownFields()); - while (true) { - final int tag = input.readTag(); - if (tag == 0) { - break; - } - - if (!mergeFieldFrom(input, unknownFields, extensionRegistry, - getDescriptorForType(), this, null, tag)) { - // end group tag - break; - } - } - setUnknownFields(unknownFields.build()); - return (BuilderType) this; - } - - /** helper method to handle {@code builder} and {@code extensions}. */ - private static void addRepeatedField( - Message.Builder builder, - FieldSet extensions, - FieldDescriptor field, - Object value) { - if (builder != null) { - builder.addRepeatedField(field, value); - } else { - extensions.addRepeatedField(field, value); - } - } - - /** helper method to handle {@code builder} and {@code extensions}. */ - private static void setField( - Message.Builder builder, - FieldSet extensions, - FieldDescriptor field, - Object value) { - if (builder != null) { - builder.setField(field, value); - } else { - extensions.setField(field, value); - } - } - - /** helper method to handle {@code builder} and {@code extensions}. */ - private static boolean hasOriginalMessage( - Message.Builder builder, - FieldSet extensions, - FieldDescriptor field) { - if (builder != null) { - return builder.hasField(field); - } else { - return extensions.hasField(field); - } - } - - /** helper method to handle {@code builder} and {@code extensions}. */ - private static Message getOriginalMessage( - Message.Builder builder, - FieldSet extensions, - FieldDescriptor field) { - if (builder != null) { - return (Message) builder.getField(field); - } else { - return (Message) extensions.getField(field); - } - } - - /** helper method to handle {@code builder} and {@code extensions}. */ - private static void mergeOriginalMessage( - Message.Builder builder, - FieldSet extensions, - FieldDescriptor field, - Message.Builder subBuilder) { - Message originalMessage = getOriginalMessage(builder, extensions, field); - if (originalMessage != null) { - subBuilder.mergeFrom(originalMessage); - } - } - - /** - * Like {@link #mergeFrom(CodedInputStream, ExtensionRegistryLite)}, but - * parses a single field. - * - * When {@code builder} is not null, the method will parse and merge the - * field into {@code builder}. Otherwise, it will try to parse the field - * into {@code extensions}, when it's called by the parsing constructor in - * generated classes. - * - * Package-private because it is used by GeneratedMessage.ExtendableMessage. - * @param tag The tag, which should have already been read. - * @return {@code true} unless the tag is an end-group tag. - */ - static boolean mergeFieldFrom( - CodedInputStream input, - UnknownFieldSet.Builder unknownFields, - ExtensionRegistryLite extensionRegistry, - Descriptor type, - Message.Builder builder, - FieldSet extensions, - int tag) throws IOException { - if (type.getOptions().getMessageSetWireFormat() && - tag == WireFormat.MESSAGE_SET_ITEM_TAG) { - mergeMessageSetExtensionFromCodedStream( - input, unknownFields, extensionRegistry, type, builder, extensions); - return true; - } - - final int wireType = WireFormat.getTagWireType(tag); - final int fieldNumber = WireFormat.getTagFieldNumber(tag); - - final FieldDescriptor field; - Message defaultInstance = null; - - if (type.isExtensionNumber(fieldNumber)) { - // extensionRegistry may be either ExtensionRegistry or - // ExtensionRegistryLite. Since the type we are parsing is a full - // message, only a full ExtensionRegistry could possibly contain - // extensions of it. Otherwise we will treat the registry as if it - // were empty. - if (extensionRegistry instanceof ExtensionRegistry) { - final ExtensionRegistry.ExtensionInfo extension = - ((ExtensionRegistry) extensionRegistry) - .findExtensionByNumber(type, fieldNumber); - if (extension == null) { - field = null; - } else { - field = extension.descriptor; - defaultInstance = extension.defaultInstance; - if (defaultInstance == null && - field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - throw new IllegalStateException( - "Message-typed extension lacked default instance: " + - field.getFullName()); - } - } - } else { - field = null; - } - } else if (builder != null) { - field = type.findFieldByNumber(fieldNumber); - } else { - field = null; - } - - boolean unknown = false; - boolean packed = false; - if (field == null) { - unknown = true; // Unknown field. - } else if (wireType == FieldSet.getWireFormatForFieldType( - field.getLiteType(), - false /* isPacked */)) { - packed = false; - } else if (field.isPackable() && - wireType == FieldSet.getWireFormatForFieldType( - field.getLiteType(), - true /* isPacked */)) { - packed = true; - } else { - unknown = true; // Unknown wire type. - } - - if (unknown) { // Unknown field or wrong wire type. Skip. - return unknownFields.mergeFieldFrom(tag, input); - } - - if (packed) { - final int length = input.readRawVarint32(); - final int limit = input.pushLimit(length); - if (field.getLiteType() == WireFormat.FieldType.ENUM) { - while (input.getBytesUntilLimit() > 0) { - final int rawValue = input.readEnum(); - final Object value = field.getEnumType().findValueByNumber(rawValue); - if (value == null) { - // If the number isn't recognized as a valid value for this - // enum, drop it (don't even add it to unknownFields). - return true; - } - addRepeatedField(builder, extensions, field, value); - } - } else { - while (input.getBytesUntilLimit() > 0) { - final Object value = - FieldSet.readPrimitiveField(input, field.getLiteType()); - addRepeatedField(builder, extensions, field, value); - } - } - input.popLimit(limit); - } else { - final Object value; - switch (field.getType()) { - case GROUP: { - final Message.Builder subBuilder; - if (defaultInstance != null) { - subBuilder = defaultInstance.newBuilderForType(); - } else { - subBuilder = builder.newBuilderForField(field); - } - if (!field.isRepeated()) { - mergeOriginalMessage(builder, extensions, field, subBuilder); - } - input.readGroup(field.getNumber(), subBuilder, extensionRegistry); - value = subBuilder.buildPartial(); - break; - } - case MESSAGE: { - final Message.Builder subBuilder; - if (defaultInstance != null) { - subBuilder = defaultInstance.newBuilderForType(); - } else { - subBuilder = builder.newBuilderForField(field); - } - if (!field.isRepeated()) { - mergeOriginalMessage(builder, extensions, field, subBuilder); - } - input.readMessage(subBuilder, extensionRegistry); - value = subBuilder.buildPartial(); - break; - } - case ENUM: - final int rawValue = input.readEnum(); - value = field.getEnumType().findValueByNumber(rawValue); - // If the number isn't recognized as a valid value for this enum, - // drop it. - if (value == null) { - unknownFields.mergeVarintField(fieldNumber, rawValue); - return true; - } - break; - default: - value = FieldSet.readPrimitiveField(input, field.getLiteType()); - break; - } - - if (field.isRepeated()) { - addRepeatedField(builder, extensions, field, value); - } else { - setField(builder, extensions, field, value); - } - } - - return true; - } - - /** - * Called by {@code #mergeFieldFrom()} to parse a MessageSet extension. - * If {@code builder} is not null, this method will merge MessageSet into - * the builder. Otherwise, it will merge the MessageSet into {@code - * extensions}. - */ - private static void mergeMessageSetExtensionFromCodedStream( - CodedInputStream input, - UnknownFieldSet.Builder unknownFields, - ExtensionRegistryLite extensionRegistry, - Descriptor type, - Message.Builder builder, - FieldSet extensions) throws IOException { - - // The wire format for MessageSet is: - // message MessageSet { - // repeated group Item = 1 { - // required int32 typeId = 2; - // required bytes message = 3; - // } - // } - // "typeId" is the extension's field number. The extension can only be - // a message type, where "message" contains the encoded bytes of that - // message. - // - // In practice, we will probably never see a MessageSet item in which - // the message appears before the type ID, or where either field does not - // appear exactly once. However, in theory such cases are valid, so we - // should be prepared to accept them. - - int typeId = 0; - ByteString rawBytes = null; // If we encounter "message" before "typeId" - ExtensionRegistry.ExtensionInfo extension = null; - - // Read bytes from input, if we get it's type first then parse it eagerly, - // otherwise we store the raw bytes in a local variable. - while (true) { - final int tag = input.readTag(); - if (tag == 0) { - break; - } - - if (tag == WireFormat.MESSAGE_SET_TYPE_ID_TAG) { - typeId = input.readUInt32(); - if (typeId != 0) { - // extensionRegistry may be either ExtensionRegistry or - // ExtensionRegistryLite. Since the type we are parsing is a full - // message, only a full ExtensionRegistry could possibly contain - // extensions of it. Otherwise we will treat the registry as if it - // were empty. - if (extensionRegistry instanceof ExtensionRegistry) { - extension = ((ExtensionRegistry) extensionRegistry) - .findExtensionByNumber(type, typeId); - } - } - - } else if (tag == WireFormat.MESSAGE_SET_MESSAGE_TAG) { - if (typeId != 0) { - if (extension != null && ExtensionRegistryLite.isEagerlyParseMessageSets()) { - // We already know the type, so we can parse directly from the - // input with no copying. Hooray! - eagerlyMergeMessageSetExtension( - input, extension, extensionRegistry, builder, extensions); - rawBytes = null; - continue; - } - } - // We haven't seen a type ID yet or we want parse message lazily. - rawBytes = input.readBytes(); - - } else { // Unknown tag. Skip it. - if (!input.skipField(tag)) { - break; // End of group - } - } - } - input.checkLastTagWas(WireFormat.MESSAGE_SET_ITEM_END_TAG); - - // Process the raw bytes. - if (rawBytes != null && typeId != 0) { // Zero is not a valid type ID. - if (extension != null) { // We known the type - mergeMessageSetExtensionFromBytes( - rawBytes, extension, extensionRegistry, builder, extensions); - } else { // We don't know how to parse this. Ignore it. - if (rawBytes != null) { - unknownFields.mergeField(typeId, UnknownFieldSet.Field.newBuilder() - .addLengthDelimited(rawBytes).build()); - } - } - } - } - - private static void eagerlyMergeMessageSetExtension( - CodedInputStream input, - ExtensionRegistry.ExtensionInfo extension, - ExtensionRegistryLite extensionRegistry, - Message.Builder builder, - FieldSet extensions) throws IOException { - - FieldDescriptor field = extension.descriptor; - Message value = null; - if (hasOriginalMessage(builder, extensions, field)) { - Message originalMessage = - getOriginalMessage(builder, extensions, field); - Message.Builder subBuilder = originalMessage.toBuilder(); - input.readMessage(subBuilder, extensionRegistry); - value = subBuilder.buildPartial(); - } else { - value = input.readMessage(extension.defaultInstance.getParserForType(), - extensionRegistry); - } - - if (builder != null) { - builder.setField(field, value); - } else { - extensions.setField(field, value); - } - } - - private static void mergeMessageSetExtensionFromBytes( - ByteString rawBytes, - ExtensionRegistry.ExtensionInfo extension, - ExtensionRegistryLite extensionRegistry, - Message.Builder builder, - FieldSet extensions) throws IOException { - - FieldDescriptor field = extension.descriptor; - boolean hasOriginalValue = hasOriginalMessage(builder, extensions, field); - - if (hasOriginalValue || ExtensionRegistryLite.isEagerlyParseMessageSets()) { - // If the field already exists, we just parse the field. - Message value = null; - if (hasOriginalValue) { - Message originalMessage = - getOriginalMessage(builder, extensions, field); - Message.Builder subBuilder= originalMessage.toBuilder(); - subBuilder.mergeFrom(rawBytes, extensionRegistry); - value = subBuilder.buildPartial(); - } else { - value = extension.defaultInstance.getParserForType() - .parsePartialFrom(rawBytes, extensionRegistry); - } - setField(builder, extensions, field, value); - } else { - // Use LazyField to load MessageSet lazily. - LazyField lazyField = new LazyField( - extension.defaultInstance, extensionRegistry, rawBytes); - if (builder != null) { - // TODO(xiangl): it looks like this method can only be invoked by - // ExtendableBuilder, but I'm not sure. So I double check the type of - // builder here. It may be useless and need more investigation. - if (builder instanceof ExtendableBuilder) { - builder.setField(field, lazyField); - } else { - builder.setField(field, lazyField.getValue()); - } - } else { - extensions.setField(field, lazyField); - } - } - } - - public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) { - setUnknownFields( - UnknownFieldSet.newBuilder(getUnknownFields()) - .mergeFrom(unknownFields) - .build()); - return (BuilderType) this; - } - - public Message.Builder getFieldBuilder(final FieldDescriptor field) { - throw new UnsupportedOperationException( - "getFieldBuilder() called on an unsupported message type."); - } - - /** - * Construct an UninitializedMessageException reporting missing fields in - * the given message. - */ - protected static UninitializedMessageException - newUninitializedMessageException(Message message) { - return new UninitializedMessageException(findMissingFields(message)); - } - - /** - * Populates {@code this.missingFields} with the full "path" of each - * missing required field in the given message. - */ - private static List findMissingFields( - final MessageOrBuilder message) { - final List results = new ArrayList(); - findMissingFields(message, "", results); - return results; - } - - /** Recursive helper implementing {@link #findMissingFields(Message)}. */ - private static void findMissingFields(final MessageOrBuilder message, - final String prefix, - final List results) { - for (final FieldDescriptor field : - message.getDescriptorForType().getFields()) { - if (field.isRequired() && !message.hasField(field)) { - results.add(prefix + field.getName()); - } - } - - for (final Map.Entry entry : - message.getAllFields().entrySet()) { - final FieldDescriptor field = entry.getKey(); - final Object value = entry.getValue(); - - if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - if (field.isRepeated()) { - int i = 0; - for (final Object element : (List) value) { - findMissingFields((MessageOrBuilder) element, - subMessagePrefix(prefix, field, i++), - results); - } - } else { - if (message.hasField(field)) { - findMissingFields((MessageOrBuilder) value, - subMessagePrefix(prefix, field, -1), - results); - } - } - } - } - } - - private static String subMessagePrefix(final String prefix, - final FieldDescriptor field, - final int index) { - final StringBuilder result = new StringBuilder(prefix); - if (field.isExtension()) { - result.append('(') - .append(field.getFullName()) - .append(')'); - } else { - result.append(field.getName()); - } - if (index != -1) { - result.append('[') - .append(index) - .append(']'); - } - result.append('.'); - return result.toString(); - } - - // =============================================================== - // The following definitions seem to be required in order to make javac - // not produce weird errors like: - // - // java/com/google/protobuf/DynamicMessage.java:203: types - // org.apache.pekko.protobuf.AbstractMessage.Builder< - // org.apache.pekko.protobuf.DynamicMessage.Builder> and - // org.apache.pekko.protobuf.AbstractMessage.Builder< - // org.apache.pekko.protobuf.DynamicMessage.Builder> are incompatible; both - // define mergeFrom(org.apache.pekko.protobuf.ByteString), but with unrelated - // return types. - // - // Strangely, these lines are only needed if javac is invoked separately - // on AbstractMessage.java and AbstractMessageLite.java. If javac is - // invoked on both simultaneously, it works. (Or maybe the important - // point is whether or not DynamicMessage.java is compiled together with - // AbstractMessageLite.java -- not sure.) I suspect this is a compiler - // bug. - - @Override - public BuilderType mergeFrom(final ByteString data) - throws InvalidProtocolBufferException { - return super.mergeFrom(data); - } - - @Override - public BuilderType mergeFrom( - final ByteString data, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return super.mergeFrom(data, extensionRegistry); - } - - @Override - public BuilderType mergeFrom(final byte[] data) - throws InvalidProtocolBufferException { - return super.mergeFrom(data); - } - - @Override - public BuilderType mergeFrom( - final byte[] data, final int off, final int len) - throws InvalidProtocolBufferException { - return super.mergeFrom(data, off, len); - } - - @Override - public BuilderType mergeFrom( - final byte[] data, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return super.mergeFrom(data, extensionRegistry); - } - - @Override - public BuilderType mergeFrom( - final byte[] data, final int off, final int len, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return super.mergeFrom(data, off, len, extensionRegistry); - } - - @Override - public BuilderType mergeFrom(final InputStream input) - throws IOException { - return super.mergeFrom(input); - } - - @Override - public BuilderType mergeFrom( - final InputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - return super.mergeFrom(input, extensionRegistry); - } - - @Override - public boolean mergeDelimitedFrom(final InputStream input) - throws IOException { - return super.mergeDelimitedFrom(input); - } - - @Override - public boolean mergeDelimitedFrom( - final InputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - return super.mergeDelimitedFrom(input, extensionRegistry); - } - - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java deleted file mode 100644 index eb6fc232482..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import java.io.FilterInputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collection; - -/** - * A partial implementation of the {@link MessageLite} interface which - * implements as many methods of that interface as possible in terms of other - * methods. - * - * @author kenton@google.com Kenton Varda - */ -public abstract class AbstractMessageLite implements MessageLite { - public ByteString toByteString() { - try { - final ByteString.CodedBuilder out = - ByteString.newCodedBuilder(getSerializedSize()); - writeTo(out.getCodedOutput()); - return out.build(); - } catch (IOException e) { - throw new RuntimeException( - "Serializing to a ByteString threw an IOException (should " + - "never happen).", e); - } - } - - public byte[] toByteArray() { - try { - final byte[] result = new byte[getSerializedSize()]; - final CodedOutputStream output = CodedOutputStream.newInstance(result); - writeTo(output); - output.checkNoSpaceLeft(); - return result; - } catch (IOException e) { - throw new RuntimeException( - "Serializing to a byte array threw an IOException " + - "(should never happen).", e); - } - } - - public void writeTo(final OutputStream output) throws IOException { - final int bufferSize = - CodedOutputStream.computePreferredBufferSize(getSerializedSize()); - final CodedOutputStream codedOutput = - CodedOutputStream.newInstance(output, bufferSize); - writeTo(codedOutput); - codedOutput.flush(); - } - - public void writeDelimitedTo(final OutputStream output) throws IOException { - final int serialized = getSerializedSize(); - final int bufferSize = CodedOutputStream.computePreferredBufferSize( - CodedOutputStream.computeRawVarint32Size(serialized) + serialized); - final CodedOutputStream codedOutput = - CodedOutputStream.newInstance(output, bufferSize); - codedOutput.writeRawVarint32(serialized); - writeTo(codedOutput); - codedOutput.flush(); - } - - /** - * Package private helper method for AbstractParser to create - * UninitializedMessageException. - */ - UninitializedMessageException newUninitializedMessageException() { - return new UninitializedMessageException(this); - } - - /** - * A partial implementation of the {@link Message.Builder} interface which - * implements as many methods of that interface as possible in terms of - * other methods. - */ - @SuppressWarnings("unchecked") - public static abstract class Builder - implements MessageLite.Builder { - // The compiler produces an error if this is not declared explicitly. - @Override - public abstract BuilderType clone(); - - public BuilderType mergeFrom(final CodedInputStream input) - throws IOException { - return mergeFrom(input, ExtensionRegistryLite.getEmptyRegistry()); - } - - // Re-defined here for return type covariance. - public abstract BuilderType mergeFrom( - final CodedInputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException; - - public BuilderType mergeFrom(final ByteString data) - throws InvalidProtocolBufferException { - try { - final CodedInputStream input = data.newCodedInput(); - mergeFrom(input); - input.checkLastTagWas(0); - return (BuilderType) this; - } catch (InvalidProtocolBufferException e) { - throw e; - } catch (IOException e) { - throw new RuntimeException( - "Reading from a ByteString threw an IOException (should " + - "never happen).", e); - } - } - - public BuilderType mergeFrom( - final ByteString data, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - try { - final CodedInputStream input = data.newCodedInput(); - mergeFrom(input, extensionRegistry); - input.checkLastTagWas(0); - return (BuilderType) this; - } catch (InvalidProtocolBufferException e) { - throw e; - } catch (IOException e) { - throw new RuntimeException( - "Reading from a ByteString threw an IOException (should " + - "never happen).", e); - } - } - - public BuilderType mergeFrom(final byte[] data) - throws InvalidProtocolBufferException { - return mergeFrom(data, 0, data.length); - } - - public BuilderType mergeFrom(final byte[] data, final int off, - final int len) - throws InvalidProtocolBufferException { - try { - final CodedInputStream input = - CodedInputStream.newInstance(data, off, len); - mergeFrom(input); - input.checkLastTagWas(0); - return (BuilderType) this; - } catch (InvalidProtocolBufferException e) { - throw e; - } catch (IOException e) { - throw new RuntimeException( - "Reading from a byte array threw an IOException (should " + - "never happen).", e); - } - } - - public BuilderType mergeFrom( - final byte[] data, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return mergeFrom(data, 0, data.length, extensionRegistry); - } - - public BuilderType mergeFrom( - final byte[] data, final int off, final int len, - final ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - try { - final CodedInputStream input = - CodedInputStream.newInstance(data, off, len); - mergeFrom(input, extensionRegistry); - input.checkLastTagWas(0); - return (BuilderType) this; - } catch (InvalidProtocolBufferException e) { - throw e; - } catch (IOException e) { - throw new RuntimeException( - "Reading from a byte array threw an IOException (should " + - "never happen).", e); - } - } - - public BuilderType mergeFrom(final InputStream input) throws IOException { - final CodedInputStream codedInput = CodedInputStream.newInstance(input); - mergeFrom(codedInput); - codedInput.checkLastTagWas(0); - return (BuilderType) this; - } - - public BuilderType mergeFrom( - final InputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - final CodedInputStream codedInput = CodedInputStream.newInstance(input); - mergeFrom(codedInput, extensionRegistry); - codedInput.checkLastTagWas(0); - return (BuilderType) this; - } - - /** - * An InputStream implementations which reads from some other InputStream - * but is limited to a particular number of bytes. Used by - * mergeDelimitedFrom(). This is intentionally package-private so that - * UnknownFieldSet can share it. - */ - static final class LimitedInputStream extends FilterInputStream { - private int limit; - - LimitedInputStream(InputStream in, int limit) { - super(in); - this.limit = limit; - } - - @Override - public int available() throws IOException { - return Math.min(super.available(), limit); - } - - @Override - public int read() throws IOException { - if (limit <= 0) { - return -1; - } - final int result = super.read(); - if (result >= 0) { - --limit; - } - return result; - } - - @Override - public int read(final byte[] b, final int off, int len) - throws IOException { - if (limit <= 0) { - return -1; - } - len = Math.min(len, limit); - final int result = super.read(b, off, len); - if (result >= 0) { - limit -= result; - } - return result; - } - - @Override - public long skip(final long n) throws IOException { - final long result = super.skip(Math.min(n, limit)); - if (result >= 0) { - limit -= result; - } - return result; - } - } - - public boolean mergeDelimitedFrom( - final InputStream input, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - final int firstByte = input.read(); - if (firstByte == -1) { - return false; - } - final int size = CodedInputStream.readRawVarint32(firstByte, input); - final InputStream limitedInput = new LimitedInputStream(input, size); - mergeFrom(limitedInput, extensionRegistry); - return true; - } - - public boolean mergeDelimitedFrom(final InputStream input) - throws IOException { - return mergeDelimitedFrom(input, - ExtensionRegistryLite.getEmptyRegistry()); - } - - /** - * Construct an UninitializedMessageException reporting missing fields in - * the given message. - */ - protected static UninitializedMessageException - newUninitializedMessageException(MessageLite message) { - return new UninitializedMessageException(message); - } - - /** - * Adds the {@code values} to the {@code list}. This is a helper method - * used by generated code. Users should ignore it. - * - * @throws NullPointerException if any of the elements of {@code values} is - * null. - */ - protected static void addAll(final Iterable values, - final Collection list) { - if (values instanceof LazyStringList) { - // For StringOrByteStringLists, check the underlying elements to avoid - // forcing conversions of ByteStrings to Strings. - checkForNullValues(((LazyStringList) values).getUnderlyingElements()); - } else { - checkForNullValues(values); - } - if (values instanceof Collection) { - final Collection collection = (Collection) values; - list.addAll(collection); - } else { - for (final T value : values) { - list.add(value); - } - } - } - - private static void checkForNullValues(final Iterable values) { - for (final Object value : values) { - if (value == null) { - throw new NullPointerException(); - } - } - } - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java deleted file mode 100644 index 02ece3a607f..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import org.apache.pekko.protobuf.AbstractMessageLite.Builder.LimitedInputStream; - -import java.io.IOException; -import java.io.InputStream; - -/** - * A partial implementation of the {@link Parser} interface which implements - * as many methods of that interface as possible in terms of other methods. - * - * Note: This class implements all the convenience methods in the - * {@link Parser} interface. See {@link Parser} for related javadocs. - * Subclasses need to implement - * {@link Parser#parsePartialFrom(CodedInputStream, ExtensionRegistryLite)} - * - * @author liujisi@google.com (Pherl Liu) - */ -public abstract class AbstractParser - implements Parser { - /** - * Creates an UninitializedMessageException for MessageType. - */ - private UninitializedMessageException - newUninitializedMessageException(MessageType message) { - if (message instanceof AbstractMessageLite) { - return ((AbstractMessageLite) message).newUninitializedMessageException(); - } - return new UninitializedMessageException(message); - } - - /** - * Helper method to check if message is initialized. - * - * @throws InvalidProtocolBufferException if it is not initialized. - * @return The message to check. - */ - private MessageType checkMessageInitialized(MessageType message) - throws InvalidProtocolBufferException { - if (message != null && !message.isInitialized()) { - throw newUninitializedMessageException(message) - .asInvalidProtocolBufferException() - .setUnfinishedMessage(message); - } - return message; - } - - private static final ExtensionRegistryLite EMPTY_REGISTRY - = ExtensionRegistryLite.getEmptyRegistry(); - - public MessageType parsePartialFrom(CodedInputStream input) - throws InvalidProtocolBufferException { - return parsePartialFrom(input, EMPTY_REGISTRY); - } - - public MessageType parseFrom(CodedInputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return checkMessageInitialized( - parsePartialFrom(input, extensionRegistry)); - } - - public MessageType parseFrom(CodedInputStream input) - throws InvalidProtocolBufferException { - return parseFrom(input, EMPTY_REGISTRY); - } - - public MessageType parsePartialFrom(ByteString data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - MessageType message; - try { - CodedInputStream input = data.newCodedInput(); - message = parsePartialFrom(input, extensionRegistry); - try { - input.checkLastTagWas(0); - } catch (InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(message); - } - return message; - } catch (InvalidProtocolBufferException e) { - throw e; - } - } - - public MessageType parsePartialFrom(ByteString data) - throws InvalidProtocolBufferException { - return parsePartialFrom(data, EMPTY_REGISTRY); - } - - public MessageType parseFrom(ByteString data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return checkMessageInitialized(parsePartialFrom(data, extensionRegistry)); - } - - public MessageType parseFrom(ByteString data) - throws InvalidProtocolBufferException { - return parseFrom(data, EMPTY_REGISTRY); - } - - public MessageType parsePartialFrom(byte[] data, int off, int len, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - try { - CodedInputStream input = CodedInputStream.newInstance(data, off, len); - MessageType message = parsePartialFrom(input, extensionRegistry); - try { - input.checkLastTagWas(0); - } catch (InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(message); - } - return message; - } catch (InvalidProtocolBufferException e) { - throw e; - } - } - - public MessageType parsePartialFrom(byte[] data, int off, int len) - throws InvalidProtocolBufferException { - return parsePartialFrom(data, off, len, EMPTY_REGISTRY); - } - - public MessageType parsePartialFrom(byte[] data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return parsePartialFrom(data, 0, data.length, extensionRegistry); - } - - public MessageType parsePartialFrom(byte[] data) - throws InvalidProtocolBufferException { - return parsePartialFrom(data, 0, data.length, EMPTY_REGISTRY); - } - - public MessageType parseFrom(byte[] data, int off, int len, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return checkMessageInitialized( - parsePartialFrom(data, off, len, extensionRegistry)); - } - - public MessageType parseFrom(byte[] data, int off, int len) - throws InvalidProtocolBufferException { - return parseFrom(data, off, len, EMPTY_REGISTRY); - } - - public MessageType parseFrom(byte[] data, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return parseFrom(data, 0, data.length, extensionRegistry); - } - - public MessageType parseFrom(byte[] data) - throws InvalidProtocolBufferException { - return parseFrom(data, EMPTY_REGISTRY); - } - - public MessageType parsePartialFrom(InputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - CodedInputStream codedInput = CodedInputStream.newInstance(input); - MessageType message = parsePartialFrom(codedInput, extensionRegistry); - try { - codedInput.checkLastTagWas(0); - } catch (InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(message); - } - return message; - } - - public MessageType parsePartialFrom(InputStream input) - throws InvalidProtocolBufferException { - return parsePartialFrom(input, EMPTY_REGISTRY); - } - - public MessageType parseFrom(InputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return checkMessageInitialized( - parsePartialFrom(input, extensionRegistry)); - } - - public MessageType parseFrom(InputStream input) - throws InvalidProtocolBufferException { - return parseFrom(input, EMPTY_REGISTRY); - } - - public MessageType parsePartialDelimitedFrom( - InputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - int size; - try { - int firstByte = input.read(); - if (firstByte == -1) { - return null; - } - size = CodedInputStream.readRawVarint32(firstByte, input); - } catch (IOException e) { - throw new InvalidProtocolBufferException(e.getMessage()); - } - InputStream limitedInput = new LimitedInputStream(input, size); - return parsePartialFrom(limitedInput, extensionRegistry); - } - - public MessageType parsePartialDelimitedFrom(InputStream input) - throws InvalidProtocolBufferException { - return parsePartialDelimitedFrom(input, EMPTY_REGISTRY); - } - - public MessageType parseDelimitedFrom( - InputStream input, - ExtensionRegistryLite extensionRegistry) - throws InvalidProtocolBufferException { - return checkMessageInitialized( - parsePartialDelimitedFrom(input, extensionRegistry)); - } - - public MessageType parseDelimitedFrom(InputStream input) - throws InvalidProtocolBufferException { - return parseDelimitedFrom(input, EMPTY_REGISTRY); - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java deleted file mode 100644 index 1f0320d3f50..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -/** - *

Abstract interface for a blocking RPC channel. {@code BlockingRpcChannel} - * is the blocking equivalent to {@link RpcChannel}. - * - * @author kenton@google.com Kenton Varda - * @author cpovirk@google.com Chris Povirk - */ -public interface BlockingRpcChannel { - /** - * Call the given method of the remote service and blocks until it returns. - * {@code callBlockingMethod()} is the blocking equivalent to - * {@link RpcChannel#callMethod}. - */ - Message callBlockingMethod( - Descriptors.MethodDescriptor method, - RpcController controller, - Message request, - Message responsePrototype) throws ServiceException; -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java deleted file mode 100644 index b4b331f0fbd..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -/** - * Blocking equivalent to {@link Service}. - * - * @author kenton@google.com Kenton Varda - * @author cpovirk@google.com Chris Povirk - */ -public interface BlockingService { - /** - * Equivalent to {@link Service#getDescriptorForType}. - */ - Descriptors.ServiceDescriptor getDescriptorForType(); - - /** - * Equivalent to {@link Service#callMethod}, except that - * {@code callBlockingMethod()} returns the result of the RPC or throws a - * {@link ServiceException} if there is a failure, rather than passing the - * information to a callback. - */ - Message callBlockingMethod(Descriptors.MethodDescriptor method, - RpcController controller, - Message request) throws ServiceException; - - /** - * Equivalent to {@link Service#getRequestPrototype}. - */ - Message getRequestPrototype(Descriptors.MethodDescriptor method); - - /** - * Equivalent to {@link Service#getResponsePrototype}. - */ - Message getResponsePrototype(Descriptors.MethodDescriptor method); -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java deleted file mode 100644 index dd73f791de3..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import java.util.NoSuchElementException; - -/** - * This class is used to represent the substring of a {@link ByteString} over a - * single byte array. In terms of the public API of {@link ByteString}, you end - * up here by calling {@link ByteString#copyFrom(byte[])} followed by {@link - * ByteString#substring(int, int)}. - * - *

This class contains most of the overhead involved in creating a substring - * from a {@link LiteralByteString}. The overhead involves some range-checking - * and two extra fields. - * - * @author carlanton@google.com (Carl Haverl) - */ -class BoundedByteString extends LiteralByteString { - - private final int bytesOffset; - private final int bytesLength; - - /** - * Creates a {@code BoundedByteString} backed by the sub-range of given array, - * without copying. - * - * @param bytes array to wrap - * @param offset index to first byte to use in bytes - * @param length number of bytes to use from bytes - * @throws IllegalArgumentException if {@code offset < 0}, {@code length < 0}, - * or if {@code offset + length > - * bytes.length}. - */ - BoundedByteString(byte[] bytes, int offset, int length) { - super(bytes); - if (offset < 0) { - throw new IllegalArgumentException("Offset too small: " + offset); - } - if (length < 0) { - throw new IllegalArgumentException("Length too small: " + offset); - } - if ((long) offset + length > bytes.length) { - throw new IllegalArgumentException( - "Offset+Length too large: " + offset + "+" + length); - } - - this.bytesOffset = offset; - this.bytesLength = length; - } - - /** - * Gets the byte at the given index. - * Throws {@link ArrayIndexOutOfBoundsException} - * for backwards-compatibility reasons although it would more properly be - * {@link IndexOutOfBoundsException}. - * - * @param index index of byte - * @return the value - * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or >= size - */ - @Override - public byte byteAt(int index) { - // We must check the index ourselves as we cannot rely on Java array index - // checking for substrings. - if (index < 0) { - throw new ArrayIndexOutOfBoundsException("Index too small: " + index); - } - if (index >= size()) { - throw new ArrayIndexOutOfBoundsException( - "Index too large: " + index + ", " + size()); - } - - return bytes[bytesOffset + index]; - } - - @Override - public int size() { - return bytesLength; - } - - @Override - protected int getOffsetIntoBytes() { - return bytesOffset; - } - - // ================================================================= - // ByteString -> byte[] - - @Override - protected void copyToInternal(byte[] target, int sourceOffset, - int targetOffset, int numberToCopy) { - System.arraycopy(bytes, getOffsetIntoBytes() + sourceOffset, target, - targetOffset, numberToCopy); - } - - // ================================================================= - // ByteIterator - - @Override - public ByteIterator iterator() { - return new BoundedByteIterator(); - } - - private class BoundedByteIterator implements ByteIterator { - - private int position; - private final int limit; - - private BoundedByteIterator() { - position = getOffsetIntoBytes(); - limit = position + size(); - } - - public boolean hasNext() { - return (position < limit); - } - - public Byte next() { - // Boxing calls Byte.valueOf(byte), which does not instantiate. - return nextByte(); - } - - public byte nextByte() { - if (position >= limit) { - throw new NoSuchElementException(); - } - return bytes[position++]; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java b/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java deleted file mode 100644 index 81da171c5d7..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java +++ /dev/null @@ -1,979 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * Immutable sequence of bytes. Substring is supported by sharing the reference - * to the immutable underlying bytes, as with {@link String}. Concatenation is - * likewise supported without copying (long strings) by building a tree of - * pieces in {@link RopeByteString}. - *

- * Like {@link String}, the contents of a {@link ByteString} can never be - * observed to change, not even in the presence of a data race or incorrect - * API usage in the client code. - * - * @author crazybob@google.com Bob Lee - * @author kenton@google.com Kenton Varda - * @author carlanton@google.com Carl Haverl - * @author martinrb@google.com Martin Buchholz - */ -public abstract class ByteString implements Iterable { - - /** - * When two strings to be concatenated have a combined length shorter than - * this, we just copy their bytes on {@link #concat(ByteString)}. - * The trade-off is copy size versus the overhead of creating tree nodes - * in {@link RopeByteString}. - */ - static final int CONCATENATE_BY_COPY_SIZE = 128; - - /** - * When copying an InputStream into a ByteString with .readFrom(), - * the chunks in the underlying rope start at 256 bytes, but double - * each iteration up to 8192 bytes. - */ - static final int MIN_READ_FROM_CHUNK_SIZE = 0x100; // 256b - static final int MAX_READ_FROM_CHUNK_SIZE = 0x2000; // 8k - - /** - * Empty {@code ByteString}. - */ - public static final ByteString EMPTY = new LiteralByteString(new byte[0]); - - // This constructor is here to prevent subclassing outside of this package, - ByteString() {} - - /** - * Gets the byte at the given index. This method should be used only for - * random access to individual bytes. To access bytes sequentially, use the - * {@link ByteIterator} returned by {@link #iterator()}, and call {@link - * #substring(int, int)} first if necessary. - * - * @param index index of byte - * @return the value - * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or ≥ size - */ - public abstract byte byteAt(int index); - - /** - * Return a {@link ByteString.ByteIterator} over the bytes in the ByteString. - * To avoid auto-boxing, you may get the iterator manually and call - * {@link ByteIterator#nextByte()}. - * - * @return the iterator - */ - public abstract ByteIterator iterator(); - - /** - * This interface extends {@code Iterator}, so that we can return an - * unboxed {@code byte}. - */ - public interface ByteIterator extends Iterator { - /** - * An alternative to {@link Iterator#next()} that returns an - * unboxed primitive {@code byte}. - * - * @return the next {@code byte} in the iteration - * @throws NoSuchElementException if the iteration has no more elements - */ - byte nextByte(); - } - - /** - * Gets the number of bytes. - * - * @return size in bytes - */ - public abstract int size(); - - /** - * Returns {@code true} if the size is {@code 0}, {@code false} otherwise. - * - * @return true if this is zero bytes long - */ - public boolean isEmpty() { - return size() == 0; - } - - // ================================================================= - // ByteString -> substring - - /** - * Return the substring from {@code beginIndex}, inclusive, to the end of the - * string. - * - * @param beginIndex start at this index - * @return substring sharing underlying data - * @throws IndexOutOfBoundsException if {@code beginIndex < 0} or - * {@code beginIndex > size()}. - */ - public ByteString substring(int beginIndex) { - return substring(beginIndex, size()); - } - - /** - * Return the substring from {@code beginIndex}, inclusive, to {@code - * endIndex}, exclusive. - * - * @param beginIndex start at this index - * @param endIndex the last character is the one before this index - * @return substring sharing underlying data - * @throws IndexOutOfBoundsException if {@code beginIndex < 0}, - * {@code endIndex > size()}, or {@code beginIndex > endIndex}. - */ - public abstract ByteString substring(int beginIndex, int endIndex); - - /** - * Tests if this bytestring starts with the specified prefix. - * Similar to {@link String#startsWith(String)} - * - * @param prefix the prefix. - * @return true if the byte sequence represented by the - * argument is a prefix of the byte sequence represented by - * this string; false otherwise. - */ - public boolean startsWith(ByteString prefix) { - return size() >= prefix.size() && - substring(0, prefix.size()).equals(prefix); - } - - // ================================================================= - // byte[] -> ByteString - - /** - * Copies the given bytes into a {@code ByteString}. - * - * @param bytes source array - * @param offset offset in source array - * @param size number of bytes to copy - * @return new {@code ByteString} - */ - public static ByteString copyFrom(byte[] bytes, int offset, int size) { - byte[] copy = new byte[size]; - System.arraycopy(bytes, offset, copy, 0, size); - return new LiteralByteString(copy); - } - - /** - * Copies the given bytes into a {@code ByteString}. - * - * @param bytes to copy - * @return new {@code ByteString} - */ - public static ByteString copyFrom(byte[] bytes) { - return copyFrom(bytes, 0, bytes.length); - } - - /** - * Copies the next {@code size} bytes from a {@code java.nio.ByteBuffer} into - * a {@code ByteString}. - * - * @param bytes source buffer - * @param size number of bytes to copy - * @return new {@code ByteString} - */ - public static ByteString copyFrom(ByteBuffer bytes, int size) { - byte[] copy = new byte[size]; - bytes.get(copy); - return new LiteralByteString(copy); - } - - /** - * Copies the remaining bytes from a {@code java.nio.ByteBuffer} into - * a {@code ByteString}. - * - * @param bytes sourceBuffer - * @return new {@code ByteString} - */ - public static ByteString copyFrom(ByteBuffer bytes) { - return copyFrom(bytes, bytes.remaining()); - } - - /** - * Encodes {@code text} into a sequence of bytes using the named charset - * and returns the result as a {@code ByteString}. - * - * @param text source string - * @param charsetName encoding to use - * @return new {@code ByteString} - * @throws UnsupportedEncodingException if the encoding isn't found - */ - public static ByteString copyFrom(String text, String charsetName) - throws UnsupportedEncodingException { - return new LiteralByteString(text.getBytes(charsetName)); - } - - /** - * Encodes {@code text} into a sequence of UTF-8 bytes and returns the - * result as a {@code ByteString}. - * - * @param text source string - * @return new {@code ByteString} - */ - public static ByteString copyFromUtf8(String text) { - return new LiteralByteString(text.getBytes(StandardCharsets.UTF_8)); - } - - // ================================================================= - // InputStream -> ByteString - - /** - * Completely reads the given stream's bytes into a - * {@code ByteString}, blocking if necessary until all bytes are - * read through to the end of the stream. - * - * Performance notes: The returned {@code ByteString} is an - * immutable tree of byte arrays ("chunks") of the stream data. The - * first chunk is small, with subsequent chunks each being double - * the size, up to 8K. If the caller knows the precise length of - * the stream and wishes to avoid all unnecessary copies and - * allocations, consider using the two-argument version of this - * method, below. - * - * @param streamToDrain The source stream, which is read completely - * but not closed. - * @return A new {@code ByteString} which is made up of chunks of - * various sizes, depending on the behavior of the underlying - * stream. - * @throws IOException IOException is thrown if there is a problem - * reading the underlying stream. - */ - public static ByteString readFrom(InputStream streamToDrain) - throws IOException { - return readFrom( - streamToDrain, MIN_READ_FROM_CHUNK_SIZE, MAX_READ_FROM_CHUNK_SIZE); - } - - /** - * Completely reads the given stream's bytes into a - * {@code ByteString}, blocking if necessary until all bytes are - * read through to the end of the stream. - * - * Performance notes: The returned {@code ByteString} is an - * immutable tree of byte arrays ("chunks") of the stream data. The - * chunkSize parameter sets the size of these byte arrays. In - * particular, if the chunkSize is precisely the same as the length - * of the stream, unnecessary allocations and copies will be - * avoided. Otherwise, the chunks will be of the given size, except - * for the last chunk, which will be resized (via a reallocation and - * copy) to contain the remainder of the stream. - * - * @param streamToDrain The source stream, which is read completely - * but not closed. - * @param chunkSize The size of the chunks in which to read the - * stream. - * @return A new {@code ByteString} which is made up of chunks of - * the given size. - * @throws IOException IOException is thrown if there is a problem - * reading the underlying stream. - */ - public static ByteString readFrom(InputStream streamToDrain, int chunkSize) - throws IOException { - return readFrom(streamToDrain, chunkSize, chunkSize); - } - - // Helper method that takes the chunk size range as a parameter. - public static ByteString readFrom(InputStream streamToDrain, int minChunkSize, - int maxChunkSize) throws IOException { - Collection results = new ArrayList<>(); - - // copy the inbound bytes into a list of chunks; the chunk size - // grows exponentially to support both short and long streams. - int chunkSize = minChunkSize; - while (true) { - ByteString chunk = readChunk(streamToDrain, chunkSize); - if (chunk == null) { - break; - } - results.add(chunk); - chunkSize = Math.min(chunkSize * 2, maxChunkSize); - } - - return ByteString.copyFrom(results); - } - - /** - * Blocks until a chunk of the given size can be made from the - * stream, or EOF is reached. Calls read() repeatedly in case the - * given stream implementation doesn't completely fill the given - * buffer in one read() call. - * - * @return A chunk of the desired size, or else a chunk as large as - * was available when end of stream was reached. Returns null if the - * given stream had no more data in it. - */ - private static ByteString readChunk(InputStream in, final int chunkSize) - throws IOException { - final byte[] buf = new byte[chunkSize]; - int bytesRead = 0; - while (bytesRead < chunkSize) { - final int count = in.read(buf, bytesRead, chunkSize - bytesRead); - if (count == -1) { - break; - } - bytesRead += count; - } - - if (bytesRead == 0) { - return null; - } else { - return ByteString.copyFrom(buf, 0, bytesRead); - } - } - - // ================================================================= - // Multiple ByteStrings -> One ByteString - - /** - * Concatenate the given {@code ByteString} to this one. Short concatenations, - * of total size smaller than {@link ByteString#CONCATENATE_BY_COPY_SIZE}, are - * produced by copying the underlying bytes (as per Rope.java, - * BAP95 . In general, the concatenate involves no copying. - * - * @param other string to concatenate - * @return a new {@code ByteString} instance - */ - public ByteString concat(ByteString other) { - int thisSize = size(); - int otherSize = other.size(); - if ((long) thisSize + otherSize >= Integer.MAX_VALUE) { - throw new IllegalArgumentException("ByteString would be too long: " + - thisSize + "+" + otherSize); - } - - return RopeByteString.concatenate(this, other); - } - - /** - * Concatenates all byte strings in the iterable and returns the result. - * This is designed to run in O(list size), not O(total bytes). - * - *

The returned {@code ByteString} is not necessarily a unique object. - * If the list is empty, the returned object is the singleton empty - * {@code ByteString}. If the list has only one element, that - * {@code ByteString} will be returned without copying. - * - * @param byteStrings strings to be concatenated - * @return new {@code ByteString} - */ - public static ByteString copyFrom(Iterable byteStrings) { - Collection collection; - if (!(byteStrings instanceof Collection)) { - collection = new ArrayList<>(); - for (ByteString byteString : byteStrings) { - collection.add(byteString); - } - } else { - collection = (Collection) byteStrings; - } - ByteString result; - if (collection.isEmpty()) { - result = EMPTY; - } else { - result = balancedConcat(collection.iterator(), collection.size()); - } - return result; - } - - // Internal function used by copyFrom(Iterable). - // Create a balanced concatenation of the next "length" elements from the - // iterable. - private static ByteString balancedConcat(Iterator iterator, - int length) { - assert length >= 1; - ByteString result; - if (length == 1) { - result = iterator.next(); - } else { - int halfLength = length >>> 1; - ByteString left = balancedConcat(iterator, halfLength); - ByteString right = balancedConcat(iterator, length - halfLength); - result = left.concat(right); - } - return result; - } - - // ================================================================= - // ByteString -> byte[] - - /** - * Copies bytes into a buffer at the given offset. - * - * @param target buffer to copy into - * @param offset in the target buffer - * @throws IndexOutOfBoundsException if the offset is negative or too large - */ - public void copyTo(byte[] target, int offset) { - copyTo(target, 0, offset, size()); - } - - /** - * Copies bytes into a buffer. - * - * @param target buffer to copy into - * @param sourceOffset offset within these bytes - * @param targetOffset offset within the target buffer - * @param numberToCopy number of bytes to copy - * @throws IndexOutOfBoundsException if an offset or size is negative or too - * large - */ - public void copyTo(byte[] target, int sourceOffset, int targetOffset, - int numberToCopy) { - if (sourceOffset < 0) { - throw new IndexOutOfBoundsException("Source offset < 0: " + sourceOffset); - } - if (targetOffset < 0) { - throw new IndexOutOfBoundsException("Target offset < 0: " + targetOffset); - } - if (numberToCopy < 0) { - throw new IndexOutOfBoundsException("Length < 0: " + numberToCopy); - } - if (sourceOffset + numberToCopy > size()) { - throw new IndexOutOfBoundsException( - "Source end offset < 0: " + (sourceOffset + numberToCopy)); - } - if (targetOffset + numberToCopy > target.length) { - throw new IndexOutOfBoundsException( - "Target end offset < 0: " + (targetOffset + numberToCopy)); - } - if (numberToCopy > 0) { - copyToInternal(target, sourceOffset, targetOffset, numberToCopy); - } - } - - /** - * Internal (package private) implementation of copyTo. - * It assumes that all error checking has already been performed and that - * numberToCopy > 0. - */ - protected abstract void copyToInternal(byte[] target, int sourceOffset, - int targetOffset, int numberToCopy); - - /** - * Copies bytes into a ByteBuffer. - * - * @param target ByteBuffer to copy into. - * @throws java.nio.ReadOnlyBufferException if the {@code target} is read-only - * @throws java.nio.BufferOverflowException if the {@code target}'s - * remaining() space is not large enough to hold the data. - */ - public abstract void copyTo(ByteBuffer target); - - /** - * Copies bytes to a {@code byte[]}. - * - * @return copied bytes - */ - public byte[] toByteArray() { - int size = size(); - byte[] result = new byte[size]; - copyToInternal(result, 0, 0, size); - return result; - } - - /** - * Writes the complete contents of this byte string to - * the specified output stream argument. - * - * @param out the output stream to which to write the data. - * @throws IOException if an I/O error occurs. - */ - public abstract void writeTo(OutputStream out) throws IOException; - - /** - * Constructs a read-only {@code java.nio.ByteBuffer} whose content - * is equal to the contents of this byte string. - * The result uses the same backing array as the byte string, if possible. - * - * @return wrapped bytes - */ - public abstract ByteBuffer asReadOnlyByteBuffer(); - - /** - * Constructs a list of read-only {@code java.nio.ByteBuffer} objects - * such that the concatenation of their contents is equal to the contents - * of this byte string. The result uses the same backing arrays as the - * byte string. - *

- * By returning a list, implementations of this method may be able to avoid - * copying even when there are multiple backing arrays. - * - * @return a list of wrapped bytes - */ - public abstract List asReadOnlyByteBufferList(); - - /** - * Constructs a new {@code String} by decoding the bytes using the - * specified charset. - * - * @param charsetName encode using this charset - * @return new string - * @throws UnsupportedEncodingException if charset isn't recognized - */ - public abstract String toString(String charsetName) - throws UnsupportedEncodingException; - - // ================================================================= - // UTF-8 decoding - - /** - * Constructs a new {@code String} by decoding the bytes as UTF-8. - * - * @return new string using UTF-8 encoding - */ - public String toStringUtf8() { - try { - return toString("UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("UTF-8 not supported?", e); - } - } - - /** - * Tells whether this {@code ByteString} represents a well-formed UTF-8 - * byte sequence, such that the original bytes can be converted to a - * String object and then round tripped back to bytes without loss. - * - *

More precisely, returns {@code true} whenever:

 {@code
-   * Arrays.equals(byteString.toByteArray(),
-   *     new String(byteString.toByteArray(), "UTF-8").getBytes("UTF-8"))
-   * }
- * - *

This method returns {@code false} for "overlong" byte sequences, - * as well as for 3-byte sequences that would map to a surrogate - * character, in accordance with the restricted definition of UTF-8 - * introduced in Unicode 3.1. Note that the UTF-8 decoder included in - * Oracle's JDK has been modified to also reject "overlong" byte - * sequences, but (as of 2011) still accepts 3-byte surrogate - * character byte sequences. - * - *

See the Unicode Standard,
- * Table 3-6. UTF-8 Bit Distribution,
- * Table 3-7. Well Formed UTF-8 Byte Sequences. - * - * @return whether the bytes in this {@code ByteString} are a - * well-formed UTF-8 byte sequence - */ - public abstract boolean isValidUtf8(); - - /** - * Tells whether the given byte sequence is a well-formed, malformed, or - * incomplete UTF-8 byte sequence. This method accepts and returns a partial - * state result, allowing the bytes for a complete UTF-8 byte sequence to be - * composed from multiple {@code ByteString} segments. - * - * @param state either {@code 0} (if this is the initial decoding operation) - * or the value returned from a call to a partial decoding method for the - * previous bytes - * @param offset offset of the first byte to check - * @param length number of bytes to check - * - * @return {@code -1} if the partial byte sequence is definitely malformed, - * {@code 0} if it is well-formed (no additional input needed), or, if the - * byte sequence is "incomplete", i.e. apparently terminated in the middle of - * a character, an opaque integer "state" value containing enough information - * to decode the character when passed to a subsequent invocation of a - * partial decoding method. - */ - protected abstract int partialIsValidUtf8(int state, int offset, int length); - - // ================================================================= - // equals() and hashCode() - - @Override - public abstract boolean equals(Object o); - - /** - * Return a non-zero hashCode depending only on the sequence of bytes - * in this ByteString. - * - * @return hashCode value for this object - */ - @Override - public abstract int hashCode(); - - // ================================================================= - // Input stream - - /** - * Creates an {@code InputStream} which can be used to read the bytes. - *

- * The {@link InputStream} returned by this method is guaranteed to be - * completely non-blocking. The method {@link InputStream#available()} - * returns the number of bytes remaining in the stream. The methods - * {@link InputStream#read(byte[])}, {@link InputStream#read(byte[],int,int)} - * and {@link InputStream#skip(long)} will read/skip as many bytes as are - * available. - *

- * The methods in the returned {@link InputStream} might not be - * thread safe. - * - * @return an input stream that returns the bytes of this byte string. - */ - public abstract InputStream newInput(); - - /** - * Creates a {@link CodedInputStream} which can be used to read the bytes. - * Using this is often more efficient than creating a {@link CodedInputStream} - * that wraps the result of {@link #newInput()}. - * - * @return stream based on wrapped data - */ - public abstract CodedInputStream newCodedInput(); - - // ================================================================= - // Output stream - - /** - * Creates a new {@link Output} with the given initial capacity. Call {@link - * Output#toByteString()} to create the {@code ByteString} instance. - *

- * A {@link ByteString.Output} offers the same functionality as a - * {@link ByteArrayOutputStream}, except that it returns a {@link ByteString} - * rather than a {@code byte} array. - * - * @param initialCapacity estimate of number of bytes to be written - * @return {@code OutputStream} for building a {@code ByteString} - */ - public static Output newOutput(int initialCapacity) { - return new Output(initialCapacity); - } - - /** - * Creates a new {@link Output}. Call {@link Output#toByteString()} to create - * the {@code ByteString} instance. - *

- * A {@link ByteString.Output} offers the same functionality as a - * {@link ByteArrayOutputStream}, except that it returns a {@link ByteString} - * rather than a {@code byte array}. - * - * @return {@code OutputStream} for building a {@code ByteString} - */ - public static Output newOutput() { - return new Output(CONCATENATE_BY_COPY_SIZE); - } - - /** - * Outputs to a {@code ByteString} instance. Call {@link #toByteString()} to - * create the {@code ByteString} instance. - */ - public static final class Output extends OutputStream { - // Implementation note. - // The public methods of this class must be synchronized. ByteStrings - // are guaranteed to be immutable. Without some sort of locking, it could - // be possible for one thread to call toByteSring(), while another thread - // is still modifying the underlying byte array. - - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; - // argument passed by user, indicating initial capacity. - private final int initialCapacity; - // ByteStrings to be concatenated to create the result - private final ArrayList flushedBuffers; - // Total number of bytes in the ByteStrings of flushedBuffers - private int flushedBuffersTotalBytes; - // Current buffer to which we are writing - private byte[] buffer; - // Location in buffer[] to which we write the next byte. - private int bufferPos; - - /** - * Creates a new ByteString output stream with the specified - * initial capacity. - * - * @param initialCapacity the initial capacity of the output stream. - */ - Output(int initialCapacity) { - if (initialCapacity < 0) { - throw new IllegalArgumentException("Buffer size < 0"); - } - this.initialCapacity = initialCapacity; - this.flushedBuffers = new ArrayList<>(); - this.buffer = new byte[initialCapacity]; - } - - @Override - public synchronized void write(int b) { - if (bufferPos == buffer.length) { - flushFullBuffer(1); - } - buffer[bufferPos++] = (byte)b; - } - - @Override - public synchronized void write(byte[] b, int offset, int length) { - if (length <= buffer.length - bufferPos) { - // The bytes can fit into the current buffer. - System.arraycopy(b, offset, buffer, bufferPos, length); - bufferPos += length; - } else { - // Use up the current buffer - int copySize = buffer.length - bufferPos; - System.arraycopy(b, offset, buffer, bufferPos, copySize); - offset += copySize; - length -= copySize; - // Flush the buffer, and get a new buffer at least big enough to cover - // what we still need to output - flushFullBuffer(length); - System.arraycopy(b, offset, buffer, 0 /* count */, length); - bufferPos = length; - } - } - - /** - * Creates a byte string. Its size is the current size of this output - * stream and its output has been copied to it. - * - * @return the current contents of this output stream, as a byte string. - */ - public synchronized ByteString toByteString() { - flushLastBuffer(); - return ByteString.copyFrom(flushedBuffers); - } - - /** - * Implement java.util.Arrays.copyOf() for jdk 1.5. - */ - private byte[] copyArray(byte[] buffer, int length) { - byte[] result = new byte[length]; - System.arraycopy(buffer, 0, result, 0, Math.min(buffer.length, length)); - return result; - } - - /** - * Writes the complete contents of this byte array output stream to - * the specified output stream argument. - * - * @param out the output stream to which to write the data. - * @throws IOException if an I/O error occurs. - */ - public void writeTo(OutputStream out) throws IOException { - ByteString[] cachedFlushBuffers; - byte[] cachedBuffer; - int cachedBufferPos; - synchronized (this) { - // Copy the information we need into local variables so as to hold - // the lock for as short a time as possible. - cachedFlushBuffers = - flushedBuffers.toArray(new ByteString[flushedBuffers.size()]); - cachedBuffer = buffer; - cachedBufferPos = bufferPos; - } - for (ByteString byteString : cachedFlushBuffers) { - byteString.writeTo(out); - } - - out.write(copyArray(cachedBuffer, cachedBufferPos)); - } - - /** - * Returns the current size of the output stream. - * - * @return the current size of the output stream - */ - public synchronized int size() { - return flushedBuffersTotalBytes + bufferPos; - } - - /** - * Resets this stream, so that all currently accumulated output in the - * output stream is discarded. The output stream can be used again, - * reusing the already allocated buffer space. - */ - public synchronized void reset() { - flushedBuffers.clear(); - flushedBuffersTotalBytes = 0; - bufferPos = 0; - } - - @Override - public String toString() { - return String.format("", - Integer.toHexString(System.identityHashCode(this)), size()); - } - - /** - * Internal function used by writers. The current buffer is full, and the - * writer needs a new buffer whose size is at least the specified minimum - * size. - */ - private void flushFullBuffer(int minSize) { - flushedBuffers.add(new LiteralByteString(buffer)); - flushedBuffersTotalBytes += buffer.length; - // We want to increase our total capacity by 50%, but as a minimum, - // the new buffer should also at least be >= minSize and - // >= initial Capacity. - int newSize = Math.max(initialCapacity, - Math.max(minSize, flushedBuffersTotalBytes >>> 1)); - buffer = new byte[newSize]; - bufferPos = 0; - } - - /** - * Internal function used by {@link #toByteString()}. The current buffer may - * or may not be full, but it needs to be flushed. - */ - private void flushLastBuffer() { - if (bufferPos < buffer.length) { - if (bufferPos > 0) { - byte[] bufferCopy = copyArray(buffer, bufferPos); - flushedBuffers.add(new LiteralByteString(bufferCopy)); - } - // We reuse this buffer for further writes. - } else { - // Buffer is completely full. Huzzah. - flushedBuffers.add(new LiteralByteString(buffer)); - // 99% of the time, we're not going to use this OutputStream again. - // We set buffer to an empty byte stream so that we're handling this - // case without wasting space. In the rare case that more writes - // *do* occur, this empty buffer will be flushed and an appropriately - // sized new buffer will be created. - buffer = EMPTY_BYTE_ARRAY; - } - flushedBuffersTotalBytes += bufferPos; - bufferPos = 0; - } - } - - /** - * Constructs a new {@code ByteString} builder, which allows you to - * efficiently construct a {@code ByteString} by writing to a {@link - * CodedOutputStream}. Using this is much more efficient than calling {@code - * newOutput()} and wrapping that in a {@code CodedOutputStream}. - * - *

This is package-private because it's a somewhat confusing interface. - * Users can call {@link Message#toByteString()} instead of calling this - * directly. - * - * @param size The target byte size of the {@code ByteString}. You must write - * exactly this many bytes before building the result. - * @return the builder - */ - static CodedBuilder newCodedBuilder(int size) { - return new CodedBuilder(size); - } - - /** See {@link ByteString#newCodedBuilder(int)}. */ - static final class CodedBuilder { - private final CodedOutputStream output; - private final byte[] buffer; - - private CodedBuilder(int size) { - buffer = new byte[size]; - output = CodedOutputStream.newInstance(buffer); - } - - public ByteString build() { - output.checkNoSpaceLeft(); - - // We can be confident that the CodedOutputStream will not modify the - // underlying bytes anymore because it already wrote all of them. So, - // no need to make a copy. - return new LiteralByteString(buffer); - } - - public CodedOutputStream getCodedOutput() { - return output; - } - } - - // ================================================================= - // Methods {@link RopeByteString} needs on instances, which aren't part of the - // public API. - - /** - * Return the depth of the tree representing this {@code ByteString}, if any, - * whose root is this node. If this is a leaf node, return 0. - * - * @return tree depth or zero - */ - protected abstract int getTreeDepth(); - - /** - * Return {@code true} if this ByteString is literal (a leaf node) or a - * flat-enough tree in the sense of {@link RopeByteString}. - * - * @return true if the tree is flat enough - */ - protected abstract boolean isBalanced(); - - /** - * Return the cached hash code if available. - * - * @return value of cached hash code or 0 if not computed yet - */ - protected abstract int peekCachedHashCode(); - - /** - * Compute the hash across the value bytes starting with the given hash, and - * return the result. This is used to compute the hash across strings - * represented as a set of pieces by allowing the hash computation to be - * continued from piece to piece. - * - * @param h starting hash value - * @param offset offset into this value to start looking at data values - * @param length number of data values to include in the hash computation - * @return ending hash value - */ - protected abstract int partialHash(int h, int offset, int length); - - @Override - public String toString() { - return String.format("", - Integer.toHexString(System.identityHashCode(this)), size()); - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java b/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java deleted file mode 100644 index 1f7ebf7e712..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java +++ /dev/null @@ -1,933 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -/** - * Reads and decodes protocol message fields. - * - * This class contains two kinds of methods: methods that read specific - * protocol message constructs and field types (e.g. {@link #readTag()} and - * {@link #readInt32()}) and methods that read low-level values (e.g. - * {@link #readRawVarint32()} and {@link #readRawBytes}). If you are reading - * encoded protocol messages, you should use the former methods, but if you are - * reading some other format of your own design, use the latter. - * - * @author kenton@google.com Kenton Varda - */ -public final class CodedInputStream { - /** - * Create a new CodedInputStream wrapping the given InputStream. - */ - public static CodedInputStream newInstance(final InputStream input) { - return new CodedInputStream(input); - } - - /** - * Create a new CodedInputStream wrapping the given byte array. - */ - public static CodedInputStream newInstance(final byte[] buf) { - return newInstance(buf, 0, buf.length); - } - - /** - * Create a new CodedInputStream wrapping the given byte array slice. - */ - public static CodedInputStream newInstance(final byte[] buf, final int off, - final int len) { - CodedInputStream result = new CodedInputStream(buf, off, len); - try { - // Some uses of CodedInputStream can be more efficient if they know - // exactly how many bytes are available. By pushing the end point of the - // buffer as a limit, we allow them to get this information via - // getBytesUntilLimit(). Pushing a limit that we know is at the end of - // the stream can never hurt, since we can never past that point anyway. - result.pushLimit(len); - } catch (InvalidProtocolBufferException ex) { - // The only reason pushLimit() might throw an exception here is if len - // is negative. Normally pushLimit()'s parameter comes directly off the - // wire, so it's important to catch exceptions in case of corrupt or - // malicious data. However, in this case, we expect that len is not a - // user-supplied value, so we can assume that it being negative indicates - // a programming error. Therefore, throwing an unchecked exception is - // appropriate. - throw new IllegalArgumentException(ex); - } - return result; - } - - // ----------------------------------------------------------------- - - /** - * Attempt to read a field tag, returning zero if we have reached EOF. - * Protocol message parsers use this to read tags, since a protocol message - * may legally end wherever a tag occurs, and zero is not a valid tag number. - */ - public int readTag() throws IOException { - if (isAtEnd()) { - lastTag = 0; - return 0; - } - - lastTag = readRawVarint32(); - if (WireFormat.getTagFieldNumber(lastTag) == 0) { - // If we actually read zero (or any tag number corresponding to field - // number zero), that's not a valid tag. - throw InvalidProtocolBufferException.invalidTag(); - } - return lastTag; - } - - /** - * Verifies that the last call to readTag() returned the given tag value. - * This is used to verify that a nested group ended with the correct - * end tag. - * - * @throws InvalidProtocolBufferException {@code value} does not match the - * last tag. - */ - public void checkLastTagWas(final int value) - throws InvalidProtocolBufferException { - if (lastTag != value) { - throw InvalidProtocolBufferException.invalidEndTag(); - } - } - - /** - * Reads and discards a single field, given its tag value. - * - * @return {@code false} if the tag is an endgroup tag, in which case - * nothing is skipped. Otherwise, returns {@code true}. - */ - public boolean skipField(final int tag) throws IOException { - switch (WireFormat.getTagWireType(tag)) { - case WireFormat.WIRETYPE_VARINT: - readInt32(); - return true; - case WireFormat.WIRETYPE_FIXED64: - readRawLittleEndian64(); - return true; - case WireFormat.WIRETYPE_LENGTH_DELIMITED: - skipRawBytes(readRawVarint32()); - return true; - case WireFormat.WIRETYPE_START_GROUP: - skipMessage(); - checkLastTagWas( - WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), - WireFormat.WIRETYPE_END_GROUP)); - return true; - case WireFormat.WIRETYPE_END_GROUP: - return false; - case WireFormat.WIRETYPE_FIXED32: - readRawLittleEndian32(); - return true; - default: - throw InvalidProtocolBufferException.invalidWireType(); - } - } - - /** - * Reads and discards an entire message. This will read either until EOF - * or until an endgroup tag, whichever comes first. - */ - public void skipMessage() throws IOException { - while (true) { - final int tag = readTag(); - if (tag == 0 || !skipField(tag)) { - return; - } - } - } - - // ----------------------------------------------------------------- - - /** Read a {@code double} field value from the stream. */ - public double readDouble() throws IOException { - return Double.longBitsToDouble(readRawLittleEndian64()); - } - - /** Read a {@code float} field value from the stream. */ - public float readFloat() throws IOException { - return Float.intBitsToFloat(readRawLittleEndian32()); - } - - /** Read a {@code uint64} field value from the stream. */ - public long readUInt64() throws IOException { - return readRawVarint64(); - } - - /** Read an {@code int64} field value from the stream. */ - public long readInt64() throws IOException { - return readRawVarint64(); - } - - /** Read an {@code int32} field value from the stream. */ - public int readInt32() throws IOException { - return readRawVarint32(); - } - - /** Read a {@code fixed64} field value from the stream. */ - public long readFixed64() throws IOException { - return readRawLittleEndian64(); - } - - /** Read a {@code fixed32} field value from the stream. */ - public int readFixed32() throws IOException { - return readRawLittleEndian32(); - } - - /** Read a {@code bool} field value from the stream. */ - public boolean readBool() throws IOException { - return readRawVarint32() != 0; - } - - /** Read a {@code string} field value from the stream. */ - public String readString() throws IOException { - final int size = readRawVarint32(); - if (size <= (bufferSize - bufferPos) && size > 0) { - // Fast path: We already have the bytes in a contiguous buffer, so - // just copy directly from it. - final String result = new String(buffer, bufferPos, size, "UTF-8"); - bufferPos += size; - return result; - } else { - // Slow path: Build a byte array first then copy it. - return new String(readRawBytes(size), "UTF-8"); - } - } - - /** Read a {@code group} field value from the stream. */ - public void readGroup(final int fieldNumber, - final MessageLite.Builder builder, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - if (recursionDepth >= recursionLimit) { - throw InvalidProtocolBufferException.recursionLimitExceeded(); - } - ++recursionDepth; - builder.mergeFrom(this, extensionRegistry); - checkLastTagWas( - WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; - } - - /** Read a {@code group} field value from the stream. */ - public T readGroup( - final int fieldNumber, - final Parser parser, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - if (recursionDepth >= recursionLimit) { - throw InvalidProtocolBufferException.recursionLimitExceeded(); - } - ++recursionDepth; - T result = parser.parsePartialFrom(this, extensionRegistry); - checkLastTagWas( - WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; - return result; - } - - /** - * Reads a {@code group} field value from the stream and merges it into the - * given {@link UnknownFieldSet}. - * - * @deprecated UnknownFieldSet.Builder now implements MessageLite.Builder, so - * you can just call {@link #readGroup}. - */ - @Deprecated - public void readUnknownGroup(final int fieldNumber, - final MessageLite.Builder builder) - throws IOException { - // We know that UnknownFieldSet will ignore any ExtensionRegistry so it - // is safe to pass null here. (We can't call - // ExtensionRegistry.getEmptyRegistry() because that would make this - // class depend on ExtensionRegistry, which is not part of the lite - // library.) - readGroup(fieldNumber, builder, null); - } - - /** Read an embedded message field value from the stream. */ - public void readMessage(final MessageLite.Builder builder, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - final int length = readRawVarint32(); - if (recursionDepth >= recursionLimit) { - throw InvalidProtocolBufferException.recursionLimitExceeded(); - } - final int oldLimit = pushLimit(length); - ++recursionDepth; - builder.mergeFrom(this, extensionRegistry); - checkLastTagWas(0); - --recursionDepth; - popLimit(oldLimit); - } - - /** Read an embedded message field value from the stream. */ - public T readMessage( - final Parser parser, - final ExtensionRegistryLite extensionRegistry) - throws IOException { - int length = readRawVarint32(); - if (recursionDepth >= recursionLimit) { - throw InvalidProtocolBufferException.recursionLimitExceeded(); - } - final int oldLimit = pushLimit(length); - ++recursionDepth; - T result = parser.parsePartialFrom(this, extensionRegistry); - checkLastTagWas(0); - --recursionDepth; - popLimit(oldLimit); - return result; - } - - /** Read a {@code bytes} field value from the stream. */ - public ByteString readBytes() throws IOException { - final int size = readRawVarint32(); - if (size == 0) { - return ByteString.EMPTY; - } else if (size <= (bufferSize - bufferPos) && size > 0) { - // Fast path: We already have the bytes in a contiguous buffer, so - // just copy directly from it. - final ByteString result = ByteString.copyFrom(buffer, bufferPos, size); - bufferPos += size; - return result; - } else { - // Slow path: Build a byte array first then copy it. - return ByteString.copyFrom(readRawBytes(size)); - } - } - - /** Read a {@code uint32} field value from the stream. */ - public int readUInt32() throws IOException { - return readRawVarint32(); - } - - /** - * Read an enum field value from the stream. Caller is responsible - * for converting the numeric value to an actual enum. - */ - public int readEnum() throws IOException { - return readRawVarint32(); - } - - /** Read an {@code sfixed32} field value from the stream. */ - public int readSFixed32() throws IOException { - return readRawLittleEndian32(); - } - - /** Read an {@code sfixed64} field value from the stream. */ - public long readSFixed64() throws IOException { - return readRawLittleEndian64(); - } - - /** Read an {@code sint32} field value from the stream. */ - public int readSInt32() throws IOException { - return decodeZigZag32(readRawVarint32()); - } - - /** Read an {@code sint64} field value from the stream. */ - public long readSInt64() throws IOException { - return decodeZigZag64(readRawVarint64()); - } - - // ================================================================= - - /** - * Read a raw Varint from the stream. If larger than 32 bits, discard the - * upper bits. - */ - public int readRawVarint32() throws IOException { - byte tmp = readRawByte(); - if (tmp >= 0) { - return tmp; - } - int result = tmp & 0x7f; - if ((tmp = readRawByte()) >= 0) { - result |= tmp << 7; - } else { - result |= (tmp & 0x7f) << 7; - if ((tmp = readRawByte()) >= 0) { - result |= tmp << 14; - } else { - result |= (tmp & 0x7f) << 14; - if ((tmp = readRawByte()) >= 0) { - result |= tmp << 21; - } else { - result |= (tmp & 0x7f) << 21; - result |= (tmp = readRawByte()) << 28; - if (tmp < 0) { - // Discard upper 32 bits. - for (int i = 0; i < 5; i++) { - if (readRawByte() >= 0) { - return result; - } - } - throw InvalidProtocolBufferException.malformedVarint(); - } - } - } - } - return result; - } - - /** - * Reads a varint from the input one byte at a time, so that it does not - * read any bytes after the end of the varint. If you simply wrapped the - * stream in a CodedInputStream and used {@link #readRawVarint32(InputStream)} - * then you would probably end up reading past the end of the varint since - * CodedInputStream buffers its input. - */ - static int readRawVarint32(final InputStream input) throws IOException { - final int firstByte = input.read(); - if (firstByte == -1) { - throw InvalidProtocolBufferException.truncatedMessage(); - } - return readRawVarint32(firstByte, input); - } - - /** - * Like {@link #readRawVarint32(InputStream)}, but expects that the caller - * has already read one byte. This allows the caller to determine if EOF - * has been reached before attempting to read. - */ - public static int readRawVarint32( - final int firstByte, final InputStream input) throws IOException { - if ((firstByte & 0x80) == 0) { - return firstByte; - } - - int result = firstByte & 0x7f; - int offset = 7; - for (; offset < 32; offset += 7) { - final int b = input.read(); - if (b == -1) { - throw InvalidProtocolBufferException.truncatedMessage(); - } - result |= (b & 0x7f) << offset; - if ((b & 0x80) == 0) { - return result; - } - } - // Keep reading up to 64 bits. - for (; offset < 64; offset += 7) { - final int b = input.read(); - if (b == -1) { - throw InvalidProtocolBufferException.truncatedMessage(); - } - if ((b & 0x80) == 0) { - return result; - } - } - throw InvalidProtocolBufferException.malformedVarint(); - } - - /** Read a raw Varint from the stream. */ - public long readRawVarint64() throws IOException { - int shift = 0; - long result = 0; - while (shift < 64) { - final byte b = readRawByte(); - result |= (long)(b & 0x7F) << shift; - if ((b & 0x80) == 0) { - return result; - } - shift += 7; - } - throw InvalidProtocolBufferException.malformedVarint(); - } - - /** Read a 32-bit little-endian integer from the stream. */ - public int readRawLittleEndian32() throws IOException { - final byte b1 = readRawByte(); - final byte b2 = readRawByte(); - final byte b3 = readRawByte(); - final byte b4 = readRawByte(); - return (((int)b1 & 0xff) ) | - (((int)b2 & 0xff) << 8) | - (((int)b3 & 0xff) << 16) | - (((int)b4 & 0xff) << 24); - } - - /** Read a 64-bit little-endian integer from the stream. */ - public long readRawLittleEndian64() throws IOException { - final byte b1 = readRawByte(); - final byte b2 = readRawByte(); - final byte b3 = readRawByte(); - final byte b4 = readRawByte(); - final byte b5 = readRawByte(); - final byte b6 = readRawByte(); - final byte b7 = readRawByte(); - final byte b8 = readRawByte(); - return (((long)b1 & 0xff) ) | - (((long)b2 & 0xff) << 8) | - (((long)b3 & 0xff) << 16) | - (((long)b4 & 0xff) << 24) | - (((long)b5 & 0xff) << 32) | - (((long)b6 & 0xff) << 40) | - (((long)b7 & 0xff) << 48) | - (((long)b8 & 0xff) << 56); - } - - /** - * Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers - * into values that can be efficiently encoded with varint. (Otherwise, - * negative values must be sign-extended to 64 bits to be varint encoded, - * thus always taking 10 bytes on the wire.) - * - * @param n An unsigned 32-bit integer, stored in a signed int because - * Java has no explicit unsigned support. - * @return A signed 32-bit integer. - */ - public static int decodeZigZag32(final int n) { - return (n >>> 1) ^ -(n & 1); - } - - /** - * Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers - * into values that can be efficiently encoded with varint. (Otherwise, - * negative values must be sign-extended to 64 bits to be varint encoded, - * thus always taking 10 bytes on the wire.) - * - * @param n An unsigned 64-bit integer, stored in a signed int because - * Java has no explicit unsigned support. - * @return A signed 64-bit integer. - */ - public static long decodeZigZag64(final long n) { - return (n >>> 1) ^ -(n & 1); - } - - // ----------------------------------------------------------------- - - private final byte[] buffer; - private int bufferSize; - private int bufferSizeAfterLimit; - private int bufferPos; - private final InputStream input; - private int lastTag; - - /** - * The total number of bytes read before the current buffer. The total - * bytes read up to the current position can be computed as - * {@code totalBytesRetired + bufferPos}. This value may be negative if - * reading started in the middle of the current buffer (e.g. if the - * constructor that takes a byte array and an offset was used). - */ - private int totalBytesRetired; - - /** The absolute position of the end of the current message. */ - private int currentLimit = Integer.MAX_VALUE; - - /** See setRecursionLimit() */ - private int recursionDepth; - private int recursionLimit = DEFAULT_RECURSION_LIMIT; - - /** See setSizeLimit() */ - private int sizeLimit = DEFAULT_SIZE_LIMIT; - - private static final int DEFAULT_RECURSION_LIMIT = 64; - private static final int DEFAULT_SIZE_LIMIT = 64 << 20; // 64MB - private static final int BUFFER_SIZE = 4096; - - private CodedInputStream(final byte[] buffer, final int off, final int len) { - this.buffer = buffer; - bufferSize = off + len; - bufferPos = off; - totalBytesRetired = -off; - input = null; - } - - private CodedInputStream(final InputStream input) { - buffer = new byte[BUFFER_SIZE]; - bufferSize = 0; - bufferPos = 0; - totalBytesRetired = 0; - this.input = input; - } - - /** - * Set the maximum message recursion depth. In order to prevent malicious - * messages from causing stack overflows, {@code CodedInputStream} limits - * how deeply messages may be nested. The default limit is 64. - * - * @return the old limit. - */ - public int setRecursionLimit(final int limit) { - if (limit < 0) { - throw new IllegalArgumentException( - "Recursion limit cannot be negative: " + limit); - } - final int oldLimit = recursionLimit; - recursionLimit = limit; - return oldLimit; - } - - /** - * Set the maximum message size. In order to prevent malicious - * messages from exhausting memory or causing integer overflows, - * {@code CodedInputStream} limits how large a message may be. - * The default limit is 64MB. You should set this limit as small - * as you can without harming your app's functionality. Note that - * size limits only apply when reading from an {@code InputStream}, not - * when constructed around a raw byte array (nor with - * {@link ByteString#newCodedInput}). - *

- * If you want to read several messages from a single CodedInputStream, you - * could call {@link #resetSizeCounter()} after each one to avoid hitting the - * size limit. - * - * @return the old limit. - */ - public int setSizeLimit(final int limit) { - if (limit < 0) { - throw new IllegalArgumentException( - "Size limit cannot be negative: " + limit); - } - final int oldLimit = sizeLimit; - sizeLimit = limit; - return oldLimit; - } - - /** - * Resets the current size counter to zero (see {@link #setSizeLimit(int)}). - */ - public void resetSizeCounter() { - totalBytesRetired = -bufferPos; - } - - /** - * Sets {@code currentLimit} to (current position) + {@code byteLimit}. This - * is called when descending into a length-delimited embedded message. - * - *

Note that {@code pushLimit()} does NOT affect how many bytes the - * {@code CodedInputStream} reads from an underlying {@code InputStream} when - * refreshing its buffer. If you need to prevent reading past a certain - * point in the underlying {@code InputStream} (e.g. because you expect it to - * contain more data after the end of the message which you need to handle - * differently) then you must place a wrapper around your {@code InputStream} - * which limits the amount of data that can be read from it. - * - * @return the old limit. - */ - public int pushLimit(int byteLimit) throws InvalidProtocolBufferException { - if (byteLimit < 0) { - throw InvalidProtocolBufferException.negativeSize(); - } - byteLimit += totalBytesRetired + bufferPos; - final int oldLimit = currentLimit; - if (byteLimit > oldLimit) { - throw InvalidProtocolBufferException.truncatedMessage(); - } - currentLimit = byteLimit; - - recomputeBufferSizeAfterLimit(); - - return oldLimit; - } - - private void recomputeBufferSizeAfterLimit() { - bufferSize += bufferSizeAfterLimit; - final int bufferEnd = totalBytesRetired + bufferSize; - if (bufferEnd > currentLimit) { - // Limit is in current buffer. - bufferSizeAfterLimit = bufferEnd - currentLimit; - bufferSize -= bufferSizeAfterLimit; - } else { - bufferSizeAfterLimit = 0; - } - } - - /** - * Discards the current limit, returning to the previous limit. - * - * @param oldLimit The old limit, as returned by {@code pushLimit}. - */ - public void popLimit(final int oldLimit) { - currentLimit = oldLimit; - recomputeBufferSizeAfterLimit(); - } - - /** - * Returns the number of bytes to be read before the current limit. - * If no limit is set, returns -1. - */ - public int getBytesUntilLimit() { - if (currentLimit == Integer.MAX_VALUE) { - return -1; - } - - final int currentAbsolutePosition = totalBytesRetired + bufferPos; - return currentLimit - currentAbsolutePosition; - } - - /** - * Returns true if the stream has reached the end of the input. This is the - * case if either the end of the underlying input source has been reached or - * if the stream has reached a limit created using {@link #pushLimit(int)}. - */ - public boolean isAtEnd() throws IOException { - return bufferPos == bufferSize && !refillBuffer(false); - } - - /** - * The total bytes read up to the current position. Calling - * {@link #resetSizeCounter()} resets this value to zero. - */ - public int getTotalBytesRead() { - return totalBytesRetired + bufferPos; - } - - /** - * Called with {@code this.buffer} is empty to read more bytes from the - * input. If {@code mustSucceed} is true, refillBuffer() guarantees that - * either there will be at least one byte in the buffer when it returns - * or it will throw an exception. If {@code mustSucceed} is false, - * refillBuffer() returns false if no more bytes were available. - */ - private boolean refillBuffer(final boolean mustSucceed) throws IOException { - if (bufferPos < bufferSize) { - throw new IllegalStateException( - "refillBuffer() called when buffer wasn't empty."); - } - - if (totalBytesRetired + bufferSize == currentLimit) { - // Oops, we hit a limit. - if (mustSucceed) { - throw InvalidProtocolBufferException.truncatedMessage(); - } else { - return false; - } - } - - totalBytesRetired += bufferSize; - - bufferPos = 0; - bufferSize = (input == null) ? -1 : input.read(buffer); - if (bufferSize == 0 || bufferSize < -1) { - throw new IllegalStateException( - "InputStream#read(byte[]) returned invalid result: " + bufferSize + - "\nThe InputStream implementation is buggy."); - } - if (bufferSize == -1) { - bufferSize = 0; - if (mustSucceed) { - throw InvalidProtocolBufferException.truncatedMessage(); - } else { - return false; - } - } else { - recomputeBufferSizeAfterLimit(); - final int totalBytesRead = - totalBytesRetired + bufferSize + bufferSizeAfterLimit; - if (totalBytesRead > sizeLimit || totalBytesRead < 0) { - throw InvalidProtocolBufferException.sizeLimitExceeded(); - } - return true; - } - } - - /** - * Read one byte from the input. - * - * @throws InvalidProtocolBufferException The end of the stream or the current - * limit was reached. - */ - public byte readRawByte() throws IOException { - if (bufferPos == bufferSize) { - refillBuffer(true); - } - return buffer[bufferPos++]; - } - - /** - * Read a fixed size of bytes from the input. - * - * @throws InvalidProtocolBufferException The end of the stream or the current - * limit was reached. - */ - public byte[] readRawBytes(final int size) throws IOException { - if (size < 0) { - throw InvalidProtocolBufferException.negativeSize(); - } - - if (totalBytesRetired + bufferPos + size > currentLimit) { - // Read to the end of the stream anyway. - skipRawBytes(currentLimit - totalBytesRetired - bufferPos); - // Then fail. - throw InvalidProtocolBufferException.truncatedMessage(); - } - - if (size <= bufferSize - bufferPos) { - // We have all the bytes we need already. - final byte[] bytes = new byte[size]; - System.arraycopy(buffer, bufferPos, bytes, 0, size); - bufferPos += size; - return bytes; - } else if (size < BUFFER_SIZE) { - // Reading more bytes than are in the buffer, but not an excessive number - // of bytes. We can safely allocate the resulting array ahead of time. - - // First copy what we have. - final byte[] bytes = new byte[size]; - int pos = bufferSize - bufferPos; - System.arraycopy(buffer, bufferPos, bytes, 0, pos); - bufferPos = bufferSize; - - // We want to use refillBuffer() and then copy from the buffer into our - // byte array rather than reading directly into our byte array because - // the input may be unbuffered. - refillBuffer(true); - - while (size - pos > bufferSize) { - System.arraycopy(buffer, 0, bytes, pos, bufferSize); - pos += bufferSize; - bufferPos = bufferSize; - refillBuffer(true); - } - - System.arraycopy(buffer, 0, bytes, pos, size - pos); - bufferPos = size - pos; - - return bytes; - } else { - // The size is very large. For security reasons, we can't allocate the - // entire byte array yet. The size comes directly from the input, so a - // maliciously-crafted message could provide a bogus very large size in - // order to trick the app into allocating a lot of memory. We avoid this - // by allocating and reading only a small chunk at a time, so that the - // malicious message must actually *be* extremely large to cause - // problems. Meanwhile, we limit the allowed size of a message elsewhere. - - // Remember the buffer markers since we'll have to copy the bytes out of - // it later. - final int originalBufferPos = bufferPos; - final int originalBufferSize = bufferSize; - - // Mark the current buffer consumed. - totalBytesRetired += bufferSize; - bufferPos = 0; - bufferSize = 0; - - // Read all the rest of the bytes we need. - int sizeLeft = size - (originalBufferSize - originalBufferPos); - final List chunks = new ArrayList(); - - while (sizeLeft > 0) { - final byte[] chunk = new byte[Math.min(sizeLeft, BUFFER_SIZE)]; - int pos = 0; - while (pos < chunk.length) { - final int n = (input == null) ? -1 : - input.read(chunk, pos, chunk.length - pos); - if (n == -1) { - throw InvalidProtocolBufferException.truncatedMessage(); - } - totalBytesRetired += n; - pos += n; - } - sizeLeft -= chunk.length; - chunks.add(chunk); - } - - // OK, got everything. Now concatenate it all into one buffer. - final byte[] bytes = new byte[size]; - - // Start by copying the leftover bytes from this.buffer. - int pos = originalBufferSize - originalBufferPos; - System.arraycopy(buffer, originalBufferPos, bytes, 0, pos); - - // And now all the chunks. - for (final byte[] chunk : chunks) { - System.arraycopy(chunk, 0, bytes, pos, chunk.length); - pos += chunk.length; - } - - // Done. - return bytes; - } - } - - /** - * Reads and discards {@code size} bytes. - * - * @throws InvalidProtocolBufferException The end of the stream or the current - * limit was reached. - */ - public void skipRawBytes(final int size) throws IOException { - if (size < 0) { - throw InvalidProtocolBufferException.negativeSize(); - } - - if (totalBytesRetired + bufferPos + size > currentLimit) { - // Read to the end of the stream anyway. - skipRawBytes(currentLimit - totalBytesRetired - bufferPos); - // Then fail. - throw InvalidProtocolBufferException.truncatedMessage(); - } - - if (size <= bufferSize - bufferPos) { - // We have all the bytes we need already. - bufferPos += size; - } else { - // Skipping more bytes than are in the buffer. First skip what we have. - int pos = bufferSize - bufferPos; - bufferPos = bufferSize; - - // Keep refilling the buffer until we get to the point we wanted to skip - // to. This has the side effect of ensuring the limits are updated - // correctly. - refillBuffer(true); - while (size - pos > bufferSize) { - pos += bufferSize; - bufferPos = bufferSize; - refillBuffer(true); - } - - bufferPos = size - pos; - } - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java b/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java deleted file mode 100644 index f294ae57aaf..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java +++ /dev/null @@ -1,1119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package org.apache.pekko.protobuf; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; - -/** - * Encodes and writes protocol message fields. - * - *

This class contains two kinds of methods: methods that write specific - * protocol message constructs and field types (e.g. {@link #writeTag} and - * {@link #writeInt32}) and methods that write low-level values (e.g. - * {@link #writeRawVarint32} and {@link #writeRawBytes}). If you are - * writing encoded protocol messages, you should use the former methods, but if - * you are writing some other format of your own design, use the latter. - * - *

This class is totally unsynchronized. - * - * @author kneton@google.com Kenton Varda - */ -public final class CodedOutputStream { - private final byte[] buffer; - private final int limit; - private int position; - - private final OutputStream output; - - /** - * The buffer size used in {@link #newInstance(OutputStream)}. - */ - public static final int DEFAULT_BUFFER_SIZE = 4096; - - /** - * Returns the buffer size to efficiently write dataLength bytes to this - * CodedOutputStream. Used by AbstractMessageLite. - * - * @return the buffer size to efficiently write dataLength bytes to this - * CodedOutputStream. - */ - static int computePreferredBufferSize(int dataLength) { - return Math.min(dataLength, DEFAULT_BUFFER_SIZE); - } - - private CodedOutputStream(final byte[] buffer, final int offset, - final int length) { - output = null; - this.buffer = buffer; - position = offset; - limit = offset + length; - } - - private CodedOutputStream(final OutputStream output, final byte[] buffer) { - this.output = output; - this.buffer = buffer; - position = 0; - limit = buffer.length; - } - - /** - * Create a new {@code CodedOutputStream} wrapping the given - * {@code OutputStream}. - */ - public static CodedOutputStream newInstance(final OutputStream output) { - return newInstance(output, DEFAULT_BUFFER_SIZE); - } - - /** - * Create a new {@code CodedOutputStream} wrapping the given - * {@code OutputStream} with a given buffer size. - */ - public static CodedOutputStream newInstance(final OutputStream output, - final int bufferSize) { - return new CodedOutputStream(output, new byte[bufferSize]); - } - - /** - * Create a new {@code CodedOutputStream} that writes directly to the given - * byte array. If more bytes are written than fit in the array, - * {@link OutOfSpaceException} will be thrown. Writing directly to a flat - * array is faster than writing to an {@code OutputStream}. See also - * {@link ByteString#newCodedBuilder}. - */ - public static CodedOutputStream newInstance(final byte[] flatArray) { - return newInstance(flatArray, 0, flatArray.length); - } - - /** - * Create a new {@code CodedOutputStream} that writes directly to the given - * byte array slice. If more bytes are written than fit in the slice, - * {@link OutOfSpaceException} will be thrown. Writing directly to a flat - * array is faster than writing to an {@code OutputStream}. See also - * {@link ByteString#newCodedBuilder}. - */ - public static CodedOutputStream newInstance(final byte[] flatArray, - final int offset, - final int length) { - return new CodedOutputStream(flatArray, offset, length); - } - - // ----------------------------------------------------------------- - - /** Write a {@code double} field, including tag, to the stream. */ - public void writeDouble(final int fieldNumber, final double value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64); - writeDoubleNoTag(value); - } - - /** Write a {@code float} field, including tag, to the stream. */ - public void writeFloat(final int fieldNumber, final float value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32); - writeFloatNoTag(value); - } - - /** Write a {@code uint64} field, including tag, to the stream. */ - public void writeUInt64(final int fieldNumber, final long value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeUInt64NoTag(value); - } - - /** Write an {@code int64} field, including tag, to the stream. */ - public void writeInt64(final int fieldNumber, final long value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeInt64NoTag(value); - } - - /** Write an {@code int32} field, including tag, to the stream. */ - public void writeInt32(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeInt32NoTag(value); - } - - /** Write a {@code fixed64} field, including tag, to the stream. */ - public void writeFixed64(final int fieldNumber, final long value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64); - writeFixed64NoTag(value); - } - - /** Write a {@code fixed32} field, including tag, to the stream. */ - public void writeFixed32(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32); - writeFixed32NoTag(value); - } - - /** Write a {@code bool} field, including tag, to the stream. */ - public void writeBool(final int fieldNumber, final boolean value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeBoolNoTag(value); - } - - /** Write a {@code string} field, including tag, to the stream. */ - public void writeString(final int fieldNumber, final String value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED); - writeStringNoTag(value); - } - - /** Write a {@code group} field, including tag, to the stream. */ - public void writeGroup(final int fieldNumber, final MessageLite value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_START_GROUP); - writeGroupNoTag(value); - writeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP); - } - - /** - * Write a group represented by an {@link UnknownFieldSet}. - * - * @deprecated UnknownFieldSet now implements MessageLite, so you can just - * call {@link #writeGroup}. - */ - @Deprecated - public void writeUnknownGroup(final int fieldNumber, - final MessageLite value) - throws IOException { - writeGroup(fieldNumber, value); - } - - /** Write an embedded message field, including tag, to the stream. */ - public void writeMessage(final int fieldNumber, final MessageLite value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED); - writeMessageNoTag(value); - } - - /** Write a {@code bytes} field, including tag, to the stream. */ - public void writeBytes(final int fieldNumber, final ByteString value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED); - writeBytesNoTag(value); - } - - /** Write a {@code uint32} field, including tag, to the stream. */ - public void writeUInt32(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeUInt32NoTag(value); - } - - /** - * Write an enum field, including tag, to the stream. Caller is responsible - * for converting the enum value to its numeric value. - */ - public void writeEnum(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeEnumNoTag(value); - } - - /** Write an {@code sfixed32} field, including tag, to the stream. */ - public void writeSFixed32(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32); - writeSFixed32NoTag(value); - } - - /** Write an {@code sfixed64} field, including tag, to the stream. */ - public void writeSFixed64(final int fieldNumber, final long value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64); - writeSFixed64NoTag(value); - } - - /** Write an {@code sint32} field, including tag, to the stream. */ - public void writeSInt32(final int fieldNumber, final int value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeSInt32NoTag(value); - } - - /** Write an {@code sint64} field, including tag, to the stream. */ - public void writeSInt64(final int fieldNumber, final long value) - throws IOException { - writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); - writeSInt64NoTag(value); - } - - /** - * Write a MessageSet extension field to the stream. For historical reasons, - * the wire format differs from normal fields. - */ - public void writeMessageSetExtension(final int fieldNumber, - final MessageLite value) - throws IOException { - writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP); - writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber); - writeMessage(WireFormat.MESSAGE_SET_MESSAGE, value); - writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP); - } - - /** - * Write an unparsed MessageSet extension field to the stream. For - * historical reasons, the wire format differs from normal fields. - */ - public void writeRawMessageSetExtension(final int fieldNumber, - final ByteString value) - throws IOException { - writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP); - writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber); - writeBytes(WireFormat.MESSAGE_SET_MESSAGE, value); - writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP); - } - - // ----------------------------------------------------------------- - - /** Write a {@code double} field to the stream. */ - public void writeDoubleNoTag(final double value) throws IOException { - writeRawLittleEndian64(Double.doubleToRawLongBits(value)); - } - - /** Write a {@code float} field to the stream. */ - public void writeFloatNoTag(final float value) throws IOException { - writeRawLittleEndian32(Float.floatToRawIntBits(value)); - } - - /** Write a {@code uint64} field to the stream. */ - public void writeUInt64NoTag(final long value) throws IOException { - writeRawVarint64(value); - } - - /** Write an {@code int64} field to the stream. */ - public void writeInt64NoTag(final long value) throws IOException { - writeRawVarint64(value); - } - - /** Write an {@code int32} field to the stream. */ - public void writeInt32NoTag(final int value) throws IOException { - if (value >= 0) { - writeRawVarint32(value); - } else { - // Must sign-extend. - writeRawVarint64(value); - } - } - - /** Write a {@code fixed64} field to the stream. */ - public void writeFixed64NoTag(final long value) throws IOException { - writeRawLittleEndian64(value); - } - - /** Write a {@code fixed32} field to the stream. */ - public void writeFixed32NoTag(final int value) throws IOException { - writeRawLittleEndian32(value); - } - - /** Write a {@code bool} field to the stream. */ - public void writeBoolNoTag(final boolean value) throws IOException { - writeRawByte(value ? 1 : 0); - } - - /** Write a {@code string} field to the stream. */ - public void writeStringNoTag(final String value) throws IOException { - // Unfortunately there does not appear to be any way to tell Java to encode - // UTF-8 directly into our buffer, so we have to let it create its own byte - // array and then copy. - final byte[] bytes = value.getBytes(StandardCharsets.UTF_8); - writeRawVarint32(bytes.length); - writeRawBytes(bytes); - } - - /** Write a {@code group} field to the stream. */ - public void writeGroupNoTag(final MessageLite value) throws IOException { - value.writeTo(this); - } - - /** - * Write a group represented by an {@link UnknownFieldSet}. - * - * @deprecated UnknownFieldSet now implements MessageLite, so you can just - * call {@link #writeGroupNoTag}. - */ - @Deprecated - public void writeUnknownGroupNoTag(final MessageLite value) - throws IOException { - writeGroupNoTag(value); - } - - /** Write an embedded message field to the stream. */ - public void writeMessageNoTag(final MessageLite value) throws IOException { - writeRawVarint32(value.getSerializedSize()); - value.writeTo(this); - } - - /** Write a {@code bytes} field to the stream. */ - public void writeBytesNoTag(final ByteString value) throws IOException { - writeRawVarint32(value.size()); - writeRawBytes(value); - } - - /** Write a {@code uint32} field to the stream. */ - public void writeUInt32NoTag(final int value) throws IOException { - writeRawVarint32(value); - } - - /** - * Write an enum field to the stream. Caller is responsible - * for converting the enum value to its numeric value. - */ - public void writeEnumNoTag(final int value) throws IOException { - writeInt32NoTag(value); - } - - /** Write an {@code sfixed32} field to the stream. */ - public void writeSFixed32NoTag(final int value) throws IOException { - writeRawLittleEndian32(value); - } - - /** Write an {@code sfixed64} field to the stream. */ - public void writeSFixed64NoTag(final long value) throws IOException { - writeRawLittleEndian64(value); - } - - /** Write an {@code sint32} field to the stream. */ - public void writeSInt32NoTag(final int value) throws IOException { - writeRawVarint32(encodeZigZag32(value)); - } - - /** Write an {@code sint64} field to the stream. */ - public void writeSInt64NoTag(final long value) throws IOException { - writeRawVarint64(encodeZigZag64(value)); - } - - // ================================================================= - - /** - * Compute the number of bytes that would be needed to encode a - * {@code double} field, including tag. - */ - public static int computeDoubleSize(final int fieldNumber, - final double value) { - return computeTagSize(fieldNumber) + computeDoubleSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code float} field, including tag. - */ - public static int computeFloatSize(final int fieldNumber, final float value) { - return computeTagSize(fieldNumber) + computeFloatSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code uint64} field, including tag. - */ - public static int computeUInt64Size(final int fieldNumber, final long value) { - return computeTagSize(fieldNumber) + computeUInt64SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code int64} field, including tag. - */ - public static int computeInt64Size(final int fieldNumber, final long value) { - return computeTagSize(fieldNumber) + computeInt64SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code int32} field, including tag. - */ - public static int computeInt32Size(final int fieldNumber, final int value) { - return computeTagSize(fieldNumber) + computeInt32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code fixed64} field, including tag. - */ - public static int computeFixed64Size(final int fieldNumber, - final long value) { - return computeTagSize(fieldNumber) + computeFixed64SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code fixed32} field, including tag. - */ - public static int computeFixed32Size(final int fieldNumber, - final int value) { - return computeTagSize(fieldNumber) + computeFixed32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code bool} field, including tag. - */ - public static int computeBoolSize(final int fieldNumber, - final boolean value) { - return computeTagSize(fieldNumber) + computeBoolSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code string} field, including tag. - */ - public static int computeStringSize(final int fieldNumber, - final String value) { - return computeTagSize(fieldNumber) + computeStringSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code group} field, including tag. - */ - public static int computeGroupSize(final int fieldNumber, - final MessageLite value) { - return computeTagSize(fieldNumber) * 2 + computeGroupSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code group} field represented by an {@code UnknownFieldSet}, including - * tag. - * - * @deprecated UnknownFieldSet now implements MessageLite, so you can just - * call {@link #computeGroupSize}. - */ - @Deprecated - public static int computeUnknownGroupSize(final int fieldNumber, - final MessageLite value) { - return computeGroupSize(fieldNumber, value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * embedded message field, including tag. - */ - public static int computeMessageSize(final int fieldNumber, - final MessageLite value) { - return computeTagSize(fieldNumber) + computeMessageSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code bytes} field, including tag. - */ - public static int computeBytesSize(final int fieldNumber, - final ByteString value) { - return computeTagSize(fieldNumber) + computeBytesSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * embedded message in lazy field, including tag. - */ - public static int computeLazyFieldSize(final int fieldNumber, - final LazyField value) { - return computeTagSize(fieldNumber) + computeLazyFieldSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code uint32} field, including tag. - */ - public static int computeUInt32Size(final int fieldNumber, final int value) { - return computeTagSize(fieldNumber) + computeUInt32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * enum field, including tag. Caller is responsible for converting the - * enum value to its numeric value. - */ - public static int computeEnumSize(final int fieldNumber, final int value) { - return computeTagSize(fieldNumber) + computeEnumSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sfixed32} field, including tag. - */ - public static int computeSFixed32Size(final int fieldNumber, - final int value) { - return computeTagSize(fieldNumber) + computeSFixed32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sfixed64} field, including tag. - */ - public static int computeSFixed64Size(final int fieldNumber, - final long value) { - return computeTagSize(fieldNumber) + computeSFixed64SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sint32} field, including tag. - */ - public static int computeSInt32Size(final int fieldNumber, final int value) { - return computeTagSize(fieldNumber) + computeSInt32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sint64} field, including tag. - */ - public static int computeSInt64Size(final int fieldNumber, final long value) { - return computeTagSize(fieldNumber) + computeSInt64SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode a - * MessageSet extension to the stream. For historical reasons, - * the wire format differs from normal fields. - */ - public static int computeMessageSetExtensionSize( - final int fieldNumber, final MessageLite value) { - return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 + - computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) + - computeMessageSize(WireFormat.MESSAGE_SET_MESSAGE, value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * unparsed MessageSet extension field to the stream. For - * historical reasons, the wire format differs from normal fields. - */ - public static int computeRawMessageSetExtensionSize( - final int fieldNumber, final ByteString value) { - return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 + - computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) + - computeBytesSize(WireFormat.MESSAGE_SET_MESSAGE, value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * lazily parsed MessageSet extension field to the stream. For - * historical reasons, the wire format differs from normal fields. - */ - public static int computeLazyFieldMessageSetExtensionSize( - final int fieldNumber, final LazyField value) { - return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 + - computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) + - computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value); - } - - // ----------------------------------------------------------------- - - /** - * Compute the number of bytes that would be needed to encode a - * {@code double} field, including tag. - */ - public static int computeDoubleSizeNoTag(final double value) { - return LITTLE_ENDIAN_64_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code float} field, including tag. - */ - public static int computeFloatSizeNoTag(final float value) { - return LITTLE_ENDIAN_32_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code uint64} field, including tag. - */ - public static int computeUInt64SizeNoTag(final long value) { - return computeRawVarint64Size(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code int64} field, including tag. - */ - public static int computeInt64SizeNoTag(final long value) { - return computeRawVarint64Size(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code int32} field, including tag. - */ - public static int computeInt32SizeNoTag(final int value) { - if (value >= 0) { - return computeRawVarint32Size(value); - } else { - // Must sign-extend. - return 10; - } - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code fixed64} field. - */ - public static int computeFixed64SizeNoTag(final long value) { - return LITTLE_ENDIAN_64_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code fixed32} field. - */ - public static int computeFixed32SizeNoTag(final int value) { - return LITTLE_ENDIAN_32_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code bool} field. - */ - public static int computeBoolSizeNoTag(final boolean value) { - return 1; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code string} field. - */ - public static int computeStringSizeNoTag(final String value) { - final byte[] bytes = value.getBytes(StandardCharsets.UTF_8); - return computeRawVarint32Size(bytes.length) + - bytes.length; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code group} field. - */ - public static int computeGroupSizeNoTag(final MessageLite value) { - return value.getSerializedSize(); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code group} field represented by an {@code UnknownFieldSet}, including - * tag. - * - * @deprecated UnknownFieldSet now implements MessageLite, so you can just - * call {@link #computeUnknownGroupSizeNoTag}. - */ - @Deprecated - public static int computeUnknownGroupSizeNoTag(final MessageLite value) { - return computeGroupSizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an embedded - * message field. - */ - public static int computeMessageSizeNoTag(final MessageLite value) { - final int size = value.getSerializedSize(); - return computeRawVarint32Size(size) + size; - } - - /** - * Compute the number of bytes that would be needed to encode an embedded - * message stored in lazy field. - */ - public static int computeLazyFieldSizeNoTag(final LazyField value) { - final int size = value.getSerializedSize(); - return computeRawVarint32Size(size) + size; - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code bytes} field. - */ - public static int computeBytesSizeNoTag(final ByteString value) { - return computeRawVarint32Size(value.size()) + - value.size(); - } - - /** - * Compute the number of bytes that would be needed to encode a - * {@code uint32} field. - */ - public static int computeUInt32SizeNoTag(final int value) { - return computeRawVarint32Size(value); - } - - /** - * Compute the number of bytes that would be needed to encode an enum field. - * Caller is responsible for converting the enum value to its numeric value. - */ - public static int computeEnumSizeNoTag(final int value) { - return computeInt32SizeNoTag(value); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sfixed32} field. - */ - public static int computeSFixed32SizeNoTag(final int value) { - return LITTLE_ENDIAN_32_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sfixed64} field. - */ - public static int computeSFixed64SizeNoTag(final long value) { - return LITTLE_ENDIAN_64_SIZE; - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sint32} field. - */ - public static int computeSInt32SizeNoTag(final int value) { - return computeRawVarint32Size(encodeZigZag32(value)); - } - - /** - * Compute the number of bytes that would be needed to encode an - * {@code sint64} field. - */ - public static int computeSInt64SizeNoTag(final long value) { - return computeRawVarint64Size(encodeZigZag64(value)); - } - - // ================================================================= - - /** - * Internal helper that writes the current buffer to the output. The - * buffer position is reset to its initial value when this returns. - */ - private void refreshBuffer() throws IOException { - if (output == null) { - // We're writing to a single buffer. - throw new OutOfSpaceException(); - } - - // Since we have an output stream, this is our buffer - // and buffer offset == 0 - output.write(buffer, 0, position); - position = 0; - } - - /** - * Flushes the stream and forces any buffered bytes to be written. This - * does not flush the underlying OutputStream. - */ - public void flush() throws IOException { - if (output != null) { - refreshBuffer(); - } - } - - /** - * If writing to a flat array, return the space left in the array. - * Otherwise, throws {@code UnsupportedOperationException}. - */ - public int spaceLeft() { - if (output == null) { - return limit - position; - } else { - throw new UnsupportedOperationException( - "spaceLeft() can only be called on CodedOutputStreams that are " + - "writing to a flat array."); - } - } - - /** - * Verifies that {@link #spaceLeft()} returns zero. It's common to create - * a byte array that is exactly big enough to hold a message, then write to - * it with a {@code CodedOutputStream}. Calling {@code checkNoSpaceLeft()} - * after writing verifies that the message was actually as big as expected, - * which can help catch bugs. - */ - public void checkNoSpaceLeft() { - if (spaceLeft() != 0) { - throw new IllegalStateException( - "Did not write as much data as expected."); - } - } - - /** - * If you create a CodedOutputStream around a simple flat array, you must - * not attempt to write more bytes than the array has space. Otherwise, - * this exception will be thrown. - */ - public static class OutOfSpaceException extends IOException { - private static final long serialVersionUID = -6947486886997889499L; - - OutOfSpaceException() { - super("CodedOutputStream was writing to a flat byte array and ran " + - "out of space."); - } - } - - /** Write a single byte. */ - public void writeRawByte(final byte value) throws IOException { - if (position == limit) { - refreshBuffer(); - } - - buffer[position++] = value; - } - - /** Write a single byte, represented by an integer value. */ - public void writeRawByte(final int value) throws IOException { - writeRawByte((byte) value); - } - - /** Write a byte string. */ - public void writeRawBytes(final ByteString value) throws IOException { - writeRawBytes(value, 0, value.size()); - } - - /** Write an array of bytes. */ - public void writeRawBytes(final byte[] value) throws IOException { - writeRawBytes(value, 0, value.length); - } - - /** Write part of an array of bytes. */ - public void writeRawBytes(final byte[] value, int offset, int length) - throws IOException { - if (limit - position >= length) { - // We have room in the current buffer. - System.arraycopy(value, offset, buffer, position, length); - position += length; - } else { - // Write extends past current buffer. Fill the rest of this buffer and - // flush. - final int bytesWritten = limit - position; - System.arraycopy(value, offset, buffer, position, bytesWritten); - offset += bytesWritten; - length -= bytesWritten; - position = limit; - refreshBuffer(); - - // Now deal with the rest. - // Since we have an output stream, this is our buffer - // and buffer offset == 0 - if (length <= limit) { - // Fits in new buffer. - System.arraycopy(value, offset, buffer, 0, length); - position = length; - } else { - // Write is very big. Let's do it all at once. - output.write(value, offset, length); - } - } - } - - /** Write part of a byte string. */ - public void writeRawBytes(final ByteString value, int offset, int length) - throws IOException { - if (limit - position >= length) { - // We have room in the current buffer. - value.copyTo(buffer, offset, position, length); - position += length; - } else { - // Write extends past current buffer. Fill the rest of this buffer and - // flush. - final int bytesWritten = limit - position; - value.copyTo(buffer, offset, position, bytesWritten); - offset += bytesWritten; - length -= bytesWritten; - position = limit; - refreshBuffer(); - - // Now deal with the rest. - // Since we have an output stream, this is our buffer - // and buffer offset == 0 - if (length <= limit) { - // Fits in new buffer. - value.copyTo(buffer, offset, 0, length); - position = length; - } else { - // Write is very big, but we can't do it all at once without allocating - // an a copy of the byte array since ByteString does not give us access - // to the underlying bytes. Use the InputStream interface on the - // ByteString and our buffer to copy between the two. - InputStream inputStreamFrom = value.newInput(); - if (offset != inputStreamFrom.skip(offset)) { - throw new IllegalStateException("Skip failed? Should never happen."); - } - // Use the buffer as the temporary buffer to avoid allocating memory. - while (length > 0) { - int bytesToRead = Math.min(length, limit); - int bytesRead = inputStreamFrom.read(buffer, 0, bytesToRead); - if (bytesRead != bytesToRead) { - throw new IllegalStateException("Read failed? Should never happen"); - } - output.write(buffer, 0, bytesRead); - length -= bytesRead; - } - } - } - } - - /** Encode and write a tag. */ - public void writeTag(final int fieldNumber, final int wireType) - throws IOException { - writeRawVarint32(WireFormat.makeTag(fieldNumber, wireType)); - } - - /** Compute the number of bytes that would be needed to encode a tag. */ - public static int computeTagSize(final int fieldNumber) { - return computeRawVarint32Size(WireFormat.makeTag(fieldNumber, 0)); - } - - /** - * Encode and write a varint. {@code value} is treated as - * unsigned, so it won't be sign-extended if negative. - */ - public void writeRawVarint32(int value) throws IOException { - while (true) { - if ((value & ~0x7F) == 0) { - writeRawByte(value); - return; - } else { - writeRawByte((value & 0x7F) | 0x80); - value >>>= 7; - } - } - } - - /** - * Compute the number of bytes that would be needed to encode a varint. - * {@code value} is treated as unsigned, so it won't be sign-extended if - * negative. - */ - public static int computeRawVarint32Size(final int value) { - if ((value & (0xffffffff << 7)) == 0) return 1; - if ((value & (0xffffffff << 14)) == 0) return 2; - if ((value & (0xffffffff << 21)) == 0) return 3; - if ((value & (0xffffffff << 28)) == 0) return 4; - return 5; - } - - /** Encode and write a varint. */ - public void writeRawVarint64(long value) throws IOException { - while (true) { - if ((value & ~0x7FL) == 0) { - writeRawByte((int)value); - return; - } else { - writeRawByte(((int)value & 0x7F) | 0x80); - value >>>= 7; - } - } - } - - /** Compute the number of bytes that would be needed to encode a varint. */ - public static int computeRawVarint64Size(final long value) { - if ((value & (0xffffffffffffffffL << 7)) == 0) return 1; - if ((value & (0xffffffffffffffffL << 14)) == 0) return 2; - if ((value & (0xffffffffffffffffL << 21)) == 0) return 3; - if ((value & (0xffffffffffffffffL << 28)) == 0) return 4; - if ((value & (0xffffffffffffffffL << 35)) == 0) return 5; - if ((value & (0xffffffffffffffffL << 42)) == 0) return 6; - if ((value & (0xffffffffffffffffL << 49)) == 0) return 7; - if ((value & (0xffffffffffffffffL << 56)) == 0) return 8; - if ((value & (0xffffffffffffffffL << 63)) == 0) return 9; - return 10; - } - - /** Write a little-endian 32-bit integer. */ - public void writeRawLittleEndian32(final int value) throws IOException { - writeRawByte((value ) & 0xFF); - writeRawByte((value >> 8) & 0xFF); - writeRawByte((value >> 16) & 0xFF); - writeRawByte((value >> 24) & 0xFF); - } - - public static final int LITTLE_ENDIAN_32_SIZE = 4; - - /** Write a little-endian 64-bit integer. */ - public void writeRawLittleEndian64(final long value) throws IOException { - writeRawByte((int)(value ) & 0xFF); - writeRawByte((int)(value >> 8) & 0xFF); - writeRawByte((int)(value >> 16) & 0xFF); - writeRawByte((int)(value >> 24) & 0xFF); - writeRawByte((int)(value >> 32) & 0xFF); - writeRawByte((int)(value >> 40) & 0xFF); - writeRawByte((int)(value >> 48) & 0xFF); - writeRawByte((int)(value >> 56) & 0xFF); - } - - public static final int LITTLE_ENDIAN_64_SIZE = 8; - - /** - * Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers - * into values that can be efficiently encoded with varint. (Otherwise, - * negative values must be sign-extended to 64 bits to be varint encoded, - * thus always taking 10 bytes on the wire.) - * - * @param n A signed 32-bit integer. - * @return An unsigned 32-bit integer, stored in a signed int because - * Java has no explicit unsigned support. - */ - public static int encodeZigZag32(final int n) { - // Note: the right-shift must be arithmetic - return (n << 1) ^ (n >> 31); - } - - /** - * Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers - * into values that can be efficiently encoded with varint. (Otherwise, - * negative values must be sign-extended to 64 bits to be varint encoded, - * thus always taking 10 bytes on the wire.) - * - * @param n A signed 64-bit integer. - * @return An unsigned 64-bit integer, stored in a signed int because - * Java has no explicit unsigned support. - */ - public static long encodeZigZag64(final long n) { - // Note: the right-shift must be arithmetic - return (n << 1) ^ (n >> 63); - } -} diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java b/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java deleted file mode 100644 index 8d0300f3e42..00000000000 --- a/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java +++ /dev/null @@ -1,28513 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2018-2022 Lightbend Inc. - */ - -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/descriptor.proto - -package org.apache.pekko.protobuf; - -public final class DescriptorProtos { - private DescriptorProtos() {} - public static void registerAllExtensions( - org.apache.pekko.protobuf.ExtensionRegistry registry) { - } - public interface FileDescriptorSetOrBuilder - extends org.apache.pekko.protobuf.MessageOrBuilder { - - // repeated .google.protobuf.FileDescriptorProto file = 1; - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - java.util.List - getFileList(); - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index); - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - int getFileCount(); - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - java.util.List - getFileOrBuilderList(); - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder( - int index); - } - /** - * Protobuf type {@code google.protobuf.FileDescriptorSet} - * - *

-   * The protocol compiler can output a FileDescriptorSet containing the .proto
-   * files it parses.
-   * 
- */ - public static final class FileDescriptorSet extends - org.apache.pekko.protobuf.GeneratedMessage - implements FileDescriptorSetOrBuilder { - // Use FileDescriptorSet.newBuilder() to construct. - private FileDescriptorSet(org.apache.pekko.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private FileDescriptorSet(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final FileDescriptorSet defaultInstance; - public static FileDescriptorSet getDefaultInstance() { - return defaultInstance; - } - - public FileDescriptorSet getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final org.apache.pekko.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private FileDescriptorSet( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields = - org.apache.pekko.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - file_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - file_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.PARSER, extensionRegistry)); - break; - } - } - } - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.apache.pekko.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - file_ = java.util.Collections.unmodifiableList(file_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.Builder.class); - } - - public static org.apache.pekko.protobuf.Parser PARSER = - new org.apache.pekko.protobuf.AbstractParser() { - public FileDescriptorSet parsePartialFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return new FileDescriptorSet(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.apache.pekko.protobuf.Parser getParserForType() { - return PARSER; - } - - // repeated .google.protobuf.FileDescriptorProto file = 1; - public static final int FILE_FIELD_NUMBER = 1; - private java.util.List file_; - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public java.util.List getFileList() { - return file_; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public java.util.List - getFileOrBuilderList() { - return file_; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public int getFileCount() { - return file_.size(); - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index) { - return file_.get(index); - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder( - int index) { - return file_.get(index); - } - - private void initFields() { - file_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getFileCount(); i++) { - if (!getFile(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < file_.size(); i++) { - output.writeMessage(1, file_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < file_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(1, file_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - org.apache.pekko.protobuf.ByteString data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - org.apache.pekko.protobuf.ByteString data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(byte[] data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - byte[] data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseDelimitedFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - org.apache.pekko.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.protobuf.FileDescriptorSet} - * - *
-     * The protocol compiler can output a FileDescriptorSet containing the .proto
-     * files it parses.
-     * 
- */ - public static final class Builder extends - org.apache.pekko.protobuf.GeneratedMessage.Builder - implements org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSetOrBuilder { - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.Builder.class); - } - - // Construct using org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getFileFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (fileBuilder_ == null) { - file_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - fileBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor; - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet getDefaultInstanceForType() { - return org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.getDefaultInstance(); - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet build() { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet buildPartial() { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet result = new org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet(this); - int from_bitField0_ = bitField0_; - if (fileBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - file_ = java.util.Collections.unmodifiableList(file_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.file_ = file_; - } else { - result.file_ = fileBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(org.apache.pekko.protobuf.Message other) { - if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet) { - return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet other) { - if (other == org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.getDefaultInstance()) return this; - if (fileBuilder_ == null) { - if (!other.file_.isEmpty()) { - if (file_.isEmpty()) { - file_ = other.file_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureFileIsMutable(); - file_.addAll(other.file_); - } - onChanged(); - } - } else { - if (!other.file_.isEmpty()) { - if (fileBuilder_.isEmpty()) { - fileBuilder_.dispose(); - fileBuilder_ = null; - file_ = other.file_; - bitField0_ = (bitField0_ & ~0x00000001); - fileBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getFileFieldBuilder() : null; - } else { - fileBuilder_.addAllMessages(other.file_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getFileCount(); i++) { - if (!getFile(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // repeated .google.protobuf.FileDescriptorProto file = 1; - private java.util.List file_ = - java.util.Collections.emptyList(); - private void ensureFileIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - file_ = new java.util.ArrayList(file_); - bitField0_ |= 0x00000001; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder> fileBuilder_; - - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public java.util.List getFileList() { - if (fileBuilder_ == null) { - return java.util.Collections.unmodifiableList(file_); - } else { - return fileBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public int getFileCount() { - if (fileBuilder_ == null) { - return file_.size(); - } else { - return fileBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index) { - if (fileBuilder_ == null) { - return file_.get(index); - } else { - return fileBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder setFile( - int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) { - if (fileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFileIsMutable(); - file_.set(index, value); - onChanged(); - } else { - fileBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder setFile( - int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { - if (fileBuilder_ == null) { - ensureFileIsMutable(); - file_.set(index, builderForValue.build()); - onChanged(); - } else { - fileBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder addFile(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) { - if (fileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFileIsMutable(); - file_.add(value); - onChanged(); - } else { - fileBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder addFile( - int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) { - if (fileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFileIsMutable(); - file_.add(index, value); - onChanged(); - } else { - fileBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder addFile( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { - if (fileBuilder_ == null) { - ensureFileIsMutable(); - file_.add(builderForValue.build()); - onChanged(); - } else { - fileBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder addFile( - int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { - if (fileBuilder_ == null) { - ensureFileIsMutable(); - file_.add(index, builderForValue.build()); - onChanged(); - } else { - fileBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder addAllFile( - java.lang.Iterable values) { - if (fileBuilder_ == null) { - ensureFileIsMutable(); - super.addAll(values, file_); - onChanged(); - } else { - fileBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder clearFile() { - if (fileBuilder_ == null) { - file_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - fileBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public Builder removeFile(int index) { - if (fileBuilder_ == null) { - ensureFileIsMutable(); - file_.remove(index); - onChanged(); - } else { - fileBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder getFileBuilder( - int index) { - return getFileFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder( - int index) { - if (fileBuilder_ == null) { - return file_.get(index); } else { - return fileBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public java.util.List - getFileOrBuilderList() { - if (fileBuilder_ != null) { - return fileBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(file_); - } - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder addFileBuilder() { - return getFileFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder addFileBuilder( - int index) { - return getFileFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FileDescriptorProto file = 1; - */ - public java.util.List - getFileBuilderList() { - return getFileFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder> - getFileFieldBuilder() { - if (fileBuilder_ == null) { - fileBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>( - file_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - file_ = null; - } - return fileBuilder_; - } - - // @@protoc_insertion_point(builder_scope:google.protobuf.FileDescriptorSet) - } - - static { - defaultInstance = new FileDescriptorSet(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorSet) - } - - public interface FileDescriptorProtoOrBuilder - extends org.apache.pekko.protobuf.MessageOrBuilder { - - // optional string name = 1; - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - boolean hasName(); - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - java.lang.String getName(); - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getNameBytes(); - - // optional string package = 2; - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - boolean hasPackage(); - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - java.lang.String getPackage(); - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getPackageBytes(); - - // repeated string dependency = 3; - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - java.util.List - getDependencyList(); - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - int getDependencyCount(); - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - java.lang.String getDependency(int index); - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getDependencyBytes(int index); - - // repeated int32 public_dependency = 10; - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - java.util.List getPublicDependencyList(); - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - int getPublicDependencyCount(); - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - int getPublicDependency(int index); - - // repeated int32 weak_dependency = 11; - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - java.util.List getWeakDependencyList(); - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - int getWeakDependencyCount(); - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - int getWeakDependency(int index); - - // repeated .google.protobuf.DescriptorProto message_type = 4; - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - java.util.List - getMessageTypeList(); - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index); - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - int getMessageTypeCount(); - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - java.util.List - getMessageTypeOrBuilderList(); - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder( - int index); - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - java.util.List - getEnumTypeList(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - int getEnumTypeCount(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - java.util.List - getEnumTypeOrBuilderList(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index); - - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - java.util.List - getServiceList(); - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index); - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - int getServiceCount(); - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - java.util.List - getServiceOrBuilderList(); - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder( - int index); - - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - java.util.List - getExtensionList(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - int getExtensionCount(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - java.util.List - getExtensionOrBuilderList(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index); - - // optional .google.protobuf.FileOptions options = 8; - /** - * optional .google.protobuf.FileOptions options = 8; - */ - boolean hasOptions(); - /** - * optional .google.protobuf.FileOptions options = 8; - */ - org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions(); - /** - * optional .google.protobuf.FileOptions options = 8; - */ - org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder(); - - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - boolean hasSourceCodeInfo(); - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo(); - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder(); - } - /** - * Protobuf type {@code google.protobuf.FileDescriptorProto} - * - *
-   * Describes a complete .proto file.
-   * 
- */ - public static final class FileDescriptorProto extends - org.apache.pekko.protobuf.GeneratedMessage - implements FileDescriptorProtoOrBuilder { - // Use FileDescriptorProto.newBuilder() to construct. - private FileDescriptorProto(org.apache.pekko.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private FileDescriptorProto(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final FileDescriptorProto defaultInstance; - public static FileDescriptorProto getDefaultInstance() { - return defaultInstance; - } - - public FileDescriptorProto getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final org.apache.pekko.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private FileDescriptorProto( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields = - org.apache.pekko.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - package_ = input.readBytes(); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - dependency_ = new org.apache.pekko.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000004; - } - dependency_.add(input.readBytes()); - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - messageType_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; - } - messageType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.PARSER, extensionRegistry)); - break; - } - case 42: { - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - enumType_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000040; - } - enumType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 50: { - if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - service_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000080; - } - service_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 58: { - if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - extension_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000100; - } - extension_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 66: { - org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - subBuilder = options_.toBuilder(); - } - options_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FileOptions.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(options_); - options_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000004; - break; - } - case 74: { - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - subBuilder = sourceCodeInfo_.toBuilder(); - } - sourceCodeInfo_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(sourceCodeInfo_); - sourceCodeInfo_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000008; - break; - } - case 80: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - publicDependency_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - publicDependency_.add(input.readInt32()); - break; - } - case 82: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { - publicDependency_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - while (input.getBytesUntilLimit() > 0) { - publicDependency_.add(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 88: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - weakDependency_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000010; - } - weakDependency_.add(input.readInt32()); - break; - } - case 90: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010) && input.getBytesUntilLimit() > 0) { - weakDependency_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000010; - } - while (input.getBytesUntilLimit() > 0) { - weakDependency_.add(input.readInt32()); - } - input.popLimit(limit); - break; - } - } - } - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.apache.pekko.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - dependency_ = new org.apache.pekko.protobuf.UnmodifiableLazyStringList(dependency_); - } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - messageType_ = java.util.Collections.unmodifiableList(messageType_); - } - if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - enumType_ = java.util.Collections.unmodifiableList(enumType_); - } - if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - service_ = java.util.Collections.unmodifiableList(service_); - } - if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - extension_ = java.util.Collections.unmodifiableList(extension_); - } - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - publicDependency_ = java.util.Collections.unmodifiableList(publicDependency_); - } - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - weakDependency_ = java.util.Collections.unmodifiableList(weakDependency_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder.class); - } - - public static org.apache.pekko.protobuf.Parser PARSER = - new org.apache.pekko.protobuf.AbstractParser() { - public FileDescriptorProto parsePartialFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return new FileDescriptorProto(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.apache.pekko.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - org.apache.pekko.protobuf.ByteString bs = - (org.apache.pekko.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } - } - /** - * optional string name = 1; - * - *
-     * file name, relative to root of source tree
-     * 
- */ - public org.apache.pekko.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - - // optional string package = 2; - public static final int PACKAGE_FIELD_NUMBER = 2; - private java.lang.Object package_; - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - public boolean hasPackage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - public java.lang.String getPackage() { - java.lang.Object ref = package_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - org.apache.pekko.protobuf.ByteString bs = - (org.apache.pekko.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - package_ = s; - } - return s; - } - } - /** - * optional string package = 2; - * - *
-     * e.g. "foo", "foo.bar", etc.
-     * 
- */ - public org.apache.pekko.protobuf.ByteString - getPackageBytes() { - java.lang.Object ref = package_; - if (ref instanceof java.lang.String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - package_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - - // repeated string dependency = 3; - public static final int DEPENDENCY_FIELD_NUMBER = 3; - private org.apache.pekko.protobuf.LazyStringList dependency_; - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - public java.util.List - getDependencyList() { - return dependency_; - } - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - public int getDependencyCount() { - return dependency_.size(); - } - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - public java.lang.String getDependency(int index) { - return dependency_.get(index); - } - /** - * repeated string dependency = 3; - * - *
-     * Names of files imported by this file.
-     * 
- */ - public org.apache.pekko.protobuf.ByteString - getDependencyBytes(int index) { - return dependency_.getByteString(index); - } - - // repeated int32 public_dependency = 10; - public static final int PUBLIC_DEPENDENCY_FIELD_NUMBER = 10; - private java.util.List publicDependency_; - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - public java.util.List - getPublicDependencyList() { - return publicDependency_; - } - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - public int getPublicDependencyCount() { - return publicDependency_.size(); - } - /** - * repeated int32 public_dependency = 10; - * - *
-     * Indexes of the public imported files in the dependency list above.
-     * 
- */ - public int getPublicDependency(int index) { - return publicDependency_.get(index); - } - - // repeated int32 weak_dependency = 11; - public static final int WEAK_DEPENDENCY_FIELD_NUMBER = 11; - private java.util.List weakDependency_; - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - public java.util.List - getWeakDependencyList() { - return weakDependency_; - } - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - public int getWeakDependencyCount() { - return weakDependency_.size(); - } - /** - * repeated int32 weak_dependency = 11; - * - *
-     * Indexes of the weak imported files in the dependency list.
-     * For Google-internal migration only. Do not use.
-     * 
- */ - public int getWeakDependency(int index) { - return weakDependency_.get(index); - } - - // repeated .google.protobuf.DescriptorProto message_type = 4; - public static final int MESSAGE_TYPE_FIELD_NUMBER = 4; - private java.util.List messageType_; - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - public java.util.List getMessageTypeList() { - return messageType_; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - public java.util.List - getMessageTypeOrBuilderList() { - return messageType_; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - public int getMessageTypeCount() { - return messageType_.size(); - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index) { - return messageType_.get(index); - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-     * All top-level definitions in this file.
-     * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder( - int index) { - return messageType_.get(index); - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - public static final int ENUM_TYPE_FIELD_NUMBER = 5; - private java.util.List enumType_; - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public java.util.List getEnumTypeList() { - return enumType_; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public java.util.List - getEnumTypeOrBuilderList() { - return enumType_; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public int getEnumTypeCount() { - return enumType_.size(); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) { - return enumType_.get(index); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index) { - return enumType_.get(index); - } - - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - public static final int SERVICE_FIELD_NUMBER = 6; - private java.util.List service_; - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public java.util.List getServiceList() { - return service_; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public java.util.List - getServiceOrBuilderList() { - return service_; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public int getServiceCount() { - return service_.size(); - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index) { - return service_.get(index); - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder( - int index) { - return service_.get(index); - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - public static final int EXTENSION_FIELD_NUMBER = 7; - private java.util.List extension_; - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public java.util.List getExtensionList() { - return extension_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public java.util.List - getExtensionOrBuilderList() { - return extension_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public int getExtensionCount() { - return extension_.size(); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) { - return extension_.get(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index) { - return extension_.get(index); - } - - // optional .google.protobuf.FileOptions options = 8; - public static final int OPTIONS_FIELD_NUMBER = 8; - private org.apache.pekko.protobuf.DescriptorProtos.FileOptions options_; - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public boolean hasOptions() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions() { - return options_; - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder() { - return options_; - } - - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - public static final int SOURCE_CODE_INFO_FIELD_NUMBER = 9; - private org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo sourceCodeInfo_; - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - public boolean hasSourceCodeInfo() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo() { - return sourceCodeInfo_; - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-     * This field contains optional information about the original source code.
-     * You may safely remove this entire field whithout harming runtime
-     * functionality of the descriptors -- the information is needed only by
-     * development tools.
-     * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder() { - return sourceCodeInfo_; - } - - private void initFields() { - name_ = ""; - package_ = ""; - dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY; - publicDependency_ = java.util.Collections.emptyList(); - weakDependency_ = java.util.Collections.emptyList(); - messageType_ = java.util.Collections.emptyList(); - enumType_ = java.util.Collections.emptyList(); - service_ = java.util.Collections.emptyList(); - extension_ = java.util.Collections.emptyList(); - options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance(); - sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getMessageTypeCount(); i++) { - if (!getMessageType(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getEnumTypeCount(); i++) { - if (!getEnumType(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getServiceCount(); i++) { - if (!getService(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getExtensionCount(); i++) { - if (!getExtension(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasOptions()) { - if (!getOptions().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getPackageBytes()); - } - for (int i = 0; i < dependency_.size(); i++) { - output.writeBytes(3, dependency_.getByteString(i)); - } - for (int i = 0; i < messageType_.size(); i++) { - output.writeMessage(4, messageType_.get(i)); - } - for (int i = 0; i < enumType_.size(); i++) { - output.writeMessage(5, enumType_.get(i)); - } - for (int i = 0; i < service_.size(); i++) { - output.writeMessage(6, service_.get(i)); - } - for (int i = 0; i < extension_.size(); i++) { - output.writeMessage(7, extension_.get(i)); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(8, options_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(9, sourceCodeInfo_); - } - for (int i = 0; i < publicDependency_.size(); i++) { - output.writeInt32(10, publicDependency_.get(i)); - } - for (int i = 0; i < weakDependency_.size(); i++) { - output.writeInt32(11, weakDependency_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeBytesSize(2, getPackageBytes()); - } - { - int dataSize = 0; - for (int i = 0; i < dependency_.size(); i++) { - dataSize += org.apache.pekko.protobuf.CodedOutputStream - .computeBytesSizeNoTag(dependency_.getByteString(i)); - } - size += dataSize; - size += 1 * getDependencyList().size(); - } - for (int i = 0; i < messageType_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(4, messageType_.get(i)); - } - for (int i = 0; i < enumType_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(5, enumType_.get(i)); - } - for (int i = 0; i < service_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(6, service_.get(i)); - } - for (int i = 0; i < extension_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(7, extension_.get(i)); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(8, options_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(9, sourceCodeInfo_); - } - { - int dataSize = 0; - for (int i = 0; i < publicDependency_.size(); i++) { - dataSize += org.apache.pekko.protobuf.CodedOutputStream - .computeInt32SizeNoTag(publicDependency_.get(i)); - } - size += dataSize; - size += 1 * getPublicDependencyList().size(); - } - { - int dataSize = 0; - for (int i = 0; i < weakDependency_.size(); i++) { - dataSize += org.apache.pekko.protobuf.CodedOutputStream - .computeInt32SizeNoTag(weakDependency_.get(i)); - } - size += dataSize; - size += 1 * getWeakDependencyList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - org.apache.pekko.protobuf.ByteString data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - org.apache.pekko.protobuf.ByteString data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(byte[] data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - byte[] data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseDelimitedFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - org.apache.pekko.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.protobuf.FileDescriptorProto} - * - *
-     * Describes a complete .proto file.
-     * 
- */ - public static final class Builder extends - org.apache.pekko.protobuf.GeneratedMessage.Builder - implements org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder { - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder.class); - } - - // Construct using org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getMessageTypeFieldBuilder(); - getEnumTypeFieldBuilder(); - getServiceFieldBuilder(); - getExtensionFieldBuilder(); - getOptionsFieldBuilder(); - getSourceCodeInfoFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - package_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - publicDependency_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - weakDependency_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - if (messageTypeBuilder_ == null) { - messageType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - messageTypeBuilder_.clear(); - } - if (enumTypeBuilder_ == null) { - enumType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - } else { - enumTypeBuilder_.clear(); - } - if (serviceBuilder_ == null) { - service_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - } else { - serviceBuilder_.clear(); - } - if (extensionBuilder_ == null) { - extension_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - } else { - extensionBuilder_.clear(); - } - if (optionsBuilder_ == null) { - options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance(); - } else { - optionsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000200); - if (sourceCodeInfoBuilder_ == null) { - sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance(); - } else { - sourceCodeInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000400); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor; - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getDefaultInstanceForType() { - return org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance(); - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto build() { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto buildPartial() { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto result = new org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.package_ = package_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - dependency_ = new org.apache.pekko.protobuf.UnmodifiableLazyStringList( - dependency_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.dependency_ = dependency_; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - publicDependency_ = java.util.Collections.unmodifiableList(publicDependency_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.publicDependency_ = publicDependency_; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - weakDependency_ = java.util.Collections.unmodifiableList(weakDependency_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.weakDependency_ = weakDependency_; - if (messageTypeBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - messageType_ = java.util.Collections.unmodifiableList(messageType_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.messageType_ = messageType_; - } else { - result.messageType_ = messageTypeBuilder_.build(); - } - if (enumTypeBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040)) { - enumType_ = java.util.Collections.unmodifiableList(enumType_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.enumType_ = enumType_; - } else { - result.enumType_ = enumTypeBuilder_.build(); - } - if (serviceBuilder_ == null) { - if (((bitField0_ & 0x00000080) == 0x00000080)) { - service_ = java.util.Collections.unmodifiableList(service_); - bitField0_ = (bitField0_ & ~0x00000080); - } - result.service_ = service_; - } else { - result.service_ = serviceBuilder_.build(); - } - if (extensionBuilder_ == null) { - if (((bitField0_ & 0x00000100) == 0x00000100)) { - extension_ = java.util.Collections.unmodifiableList(extension_); - bitField0_ = (bitField0_ & ~0x00000100); - } - result.extension_ = extension_; - } else { - result.extension_ = extensionBuilder_.build(); - } - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000004; - } - if (optionsBuilder_ == null) { - result.options_ = options_; - } else { - result.options_ = optionsBuilder_.build(); - } - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { - to_bitField0_ |= 0x00000008; - } - if (sourceCodeInfoBuilder_ == null) { - result.sourceCodeInfo_ = sourceCodeInfo_; - } else { - result.sourceCodeInfo_ = sourceCodeInfoBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(org.apache.pekko.protobuf.Message other) { - if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto) { - return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto other) { - if (other == org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance()) return this; - if (other.hasName()) { - bitField0_ |= 0x00000001; - name_ = other.name_; - onChanged(); - } - if (other.hasPackage()) { - bitField0_ |= 0x00000002; - package_ = other.package_; - onChanged(); - } - if (!other.dependency_.isEmpty()) { - if (dependency_.isEmpty()) { - dependency_ = other.dependency_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureDependencyIsMutable(); - dependency_.addAll(other.dependency_); - } - onChanged(); - } - if (!other.publicDependency_.isEmpty()) { - if (publicDependency_.isEmpty()) { - publicDependency_ = other.publicDependency_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensurePublicDependencyIsMutable(); - publicDependency_.addAll(other.publicDependency_); - } - onChanged(); - } - if (!other.weakDependency_.isEmpty()) { - if (weakDependency_.isEmpty()) { - weakDependency_ = other.weakDependency_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureWeakDependencyIsMutable(); - weakDependency_.addAll(other.weakDependency_); - } - onChanged(); - } - if (messageTypeBuilder_ == null) { - if (!other.messageType_.isEmpty()) { - if (messageType_.isEmpty()) { - messageType_ = other.messageType_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureMessageTypeIsMutable(); - messageType_.addAll(other.messageType_); - } - onChanged(); - } - } else { - if (!other.messageType_.isEmpty()) { - if (messageTypeBuilder_.isEmpty()) { - messageTypeBuilder_.dispose(); - messageTypeBuilder_ = null; - messageType_ = other.messageType_; - bitField0_ = (bitField0_ & ~0x00000020); - messageTypeBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getMessageTypeFieldBuilder() : null; - } else { - messageTypeBuilder_.addAllMessages(other.messageType_); - } - } - } - if (enumTypeBuilder_ == null) { - if (!other.enumType_.isEmpty()) { - if (enumType_.isEmpty()) { - enumType_ = other.enumType_; - bitField0_ = (bitField0_ & ~0x00000040); - } else { - ensureEnumTypeIsMutable(); - enumType_.addAll(other.enumType_); - } - onChanged(); - } - } else { - if (!other.enumType_.isEmpty()) { - if (enumTypeBuilder_.isEmpty()) { - enumTypeBuilder_.dispose(); - enumTypeBuilder_ = null; - enumType_ = other.enumType_; - bitField0_ = (bitField0_ & ~0x00000040); - enumTypeBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getEnumTypeFieldBuilder() : null; - } else { - enumTypeBuilder_.addAllMessages(other.enumType_); - } - } - } - if (serviceBuilder_ == null) { - if (!other.service_.isEmpty()) { - if (service_.isEmpty()) { - service_ = other.service_; - bitField0_ = (bitField0_ & ~0x00000080); - } else { - ensureServiceIsMutable(); - service_.addAll(other.service_); - } - onChanged(); - } - } else { - if (!other.service_.isEmpty()) { - if (serviceBuilder_.isEmpty()) { - serviceBuilder_.dispose(); - serviceBuilder_ = null; - service_ = other.service_; - bitField0_ = (bitField0_ & ~0x00000080); - serviceBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getServiceFieldBuilder() : null; - } else { - serviceBuilder_.addAllMessages(other.service_); - } - } - } - if (extensionBuilder_ == null) { - if (!other.extension_.isEmpty()) { - if (extension_.isEmpty()) { - extension_ = other.extension_; - bitField0_ = (bitField0_ & ~0x00000100); - } else { - ensureExtensionIsMutable(); - extension_.addAll(other.extension_); - } - onChanged(); - } - } else { - if (!other.extension_.isEmpty()) { - if (extensionBuilder_.isEmpty()) { - extensionBuilder_.dispose(); - extensionBuilder_ = null; - extension_ = other.extension_; - bitField0_ = (bitField0_ & ~0x00000100); - extensionBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getExtensionFieldBuilder() : null; - } else { - extensionBuilder_.addAllMessages(other.extension_); - } - } - } - if (other.hasOptions()) { - mergeOptions(other.getOptions()); - } - if (other.hasSourceCodeInfo()) { - mergeSourceCodeInfo(other.getSourceCodeInfo()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getMessageTypeCount(); i++) { - if (!getMessageType(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getEnumTypeCount(); i++) { - if (!getEnumType(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getServiceCount(); i++) { - if (!getService(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getExtensionCount(); i++) { - if (!getExtension(i).isInitialized()) { - - return false; - } - } - if (hasOptions()) { - if (!getOptions().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional string name = 1; - private java.lang.Object name_ = ""; - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((org.apache.pekko.protobuf.ByteString) ref) - .toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public org.apache.pekko.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * optional string name = 1; - * - *
-       * file name, relative to root of source tree
-       * 
- */ - public Builder setNameBytes( - org.apache.pekko.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - - // optional string package = 2; - private java.lang.Object package_ = ""; - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public boolean hasPackage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public java.lang.String getPackage() { - java.lang.Object ref = package_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((org.apache.pekko.protobuf.ByteString) ref) - .toStringUtf8(); - package_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public org.apache.pekko.protobuf.ByteString - getPackageBytes() { - java.lang.Object ref = package_; - if (ref instanceof String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - package_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public Builder setPackage( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - package_ = value; - onChanged(); - return this; - } - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public Builder clearPackage() { - bitField0_ = (bitField0_ & ~0x00000002); - package_ = getDefaultInstance().getPackage(); - onChanged(); - return this; - } - /** - * optional string package = 2; - * - *
-       * e.g. "foo", "foo.bar", etc.
-       * 
- */ - public Builder setPackageBytes( - org.apache.pekko.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - package_ = value; - onChanged(); - return this; - } - - // repeated string dependency = 3; - private org.apache.pekko.protobuf.LazyStringList dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY; - private void ensureDependencyIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - dependency_ = new org.apache.pekko.protobuf.LazyStringArrayList(dependency_); - bitField0_ |= 0x00000004; - } - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public java.util.List - getDependencyList() { - return java.util.Collections.unmodifiableList(dependency_); - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public int getDependencyCount() { - return dependency_.size(); - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public java.lang.String getDependency(int index) { - return dependency_.get(index); - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public org.apache.pekko.protobuf.ByteString - getDependencyBytes(int index) { - return dependency_.getByteString(index); - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public Builder setDependency( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureDependencyIsMutable(); - dependency_.set(index, value); - onChanged(); - return this; - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public Builder addDependency( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureDependencyIsMutable(); - dependency_.add(value); - onChanged(); - return this; - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public Builder addAllDependency( - java.lang.Iterable values) { - ensureDependencyIsMutable(); - super.addAll(values, dependency_); - onChanged(); - return this; - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public Builder clearDependency() { - dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - /** - * repeated string dependency = 3; - * - *
-       * Names of files imported by this file.
-       * 
- */ - public Builder addDependencyBytes( - org.apache.pekko.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureDependencyIsMutable(); - dependency_.add(value); - onChanged(); - return this; - } - - // repeated int32 public_dependency = 10; - private java.util.List publicDependency_ = java.util.Collections.emptyList(); - private void ensurePublicDependencyIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - publicDependency_ = new java.util.ArrayList(publicDependency_); - bitField0_ |= 0x00000008; - } - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public java.util.List - getPublicDependencyList() { - return java.util.Collections.unmodifiableList(publicDependency_); - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public int getPublicDependencyCount() { - return publicDependency_.size(); - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public int getPublicDependency(int index) { - return publicDependency_.get(index); - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public Builder setPublicDependency( - int index, int value) { - ensurePublicDependencyIsMutable(); - publicDependency_.set(index, value); - onChanged(); - return this; - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public Builder addPublicDependency(int value) { - ensurePublicDependencyIsMutable(); - publicDependency_.add(value); - onChanged(); - return this; - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public Builder addAllPublicDependency( - java.lang.Iterable values) { - ensurePublicDependencyIsMutable(); - super.addAll(values, publicDependency_); - onChanged(); - return this; - } - /** - * repeated int32 public_dependency = 10; - * - *
-       * Indexes of the public imported files in the dependency list above.
-       * 
- */ - public Builder clearPublicDependency() { - publicDependency_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - return this; - } - - // repeated int32 weak_dependency = 11; - private java.util.List weakDependency_ = java.util.Collections.emptyList(); - private void ensureWeakDependencyIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - weakDependency_ = new java.util.ArrayList(weakDependency_); - bitField0_ |= 0x00000010; - } - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public java.util.List - getWeakDependencyList() { - return java.util.Collections.unmodifiableList(weakDependency_); - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public int getWeakDependencyCount() { - return weakDependency_.size(); - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public int getWeakDependency(int index) { - return weakDependency_.get(index); - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public Builder setWeakDependency( - int index, int value) { - ensureWeakDependencyIsMutable(); - weakDependency_.set(index, value); - onChanged(); - return this; - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public Builder addWeakDependency(int value) { - ensureWeakDependencyIsMutable(); - weakDependency_.add(value); - onChanged(); - return this; - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public Builder addAllWeakDependency( - java.lang.Iterable values) { - ensureWeakDependencyIsMutable(); - super.addAll(values, weakDependency_); - onChanged(); - return this; - } - /** - * repeated int32 weak_dependency = 11; - * - *
-       * Indexes of the weak imported files in the dependency list.
-       * For Google-internal migration only. Do not use.
-       * 
- */ - public Builder clearWeakDependency() { - weakDependency_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - return this; - } - - // repeated .google.protobuf.DescriptorProto message_type = 4; - private java.util.List messageType_ = - java.util.Collections.emptyList(); - private void ensureMessageTypeIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - messageType_ = new java.util.ArrayList(messageType_); - bitField0_ |= 0x00000020; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder> messageTypeBuilder_; - - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public java.util.List getMessageTypeList() { - if (messageTypeBuilder_ == null) { - return java.util.Collections.unmodifiableList(messageType_); - } else { - return messageTypeBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public int getMessageTypeCount() { - if (messageTypeBuilder_ == null) { - return messageType_.size(); - } else { - return messageTypeBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index) { - if (messageTypeBuilder_ == null) { - return messageType_.get(index); - } else { - return messageTypeBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder setMessageType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (messageTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMessageTypeIsMutable(); - messageType_.set(index, value); - onChanged(); - } else { - messageTypeBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder setMessageType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (messageTypeBuilder_ == null) { - ensureMessageTypeIsMutable(); - messageType_.set(index, builderForValue.build()); - onChanged(); - } else { - messageTypeBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder addMessageType(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (messageTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMessageTypeIsMutable(); - messageType_.add(value); - onChanged(); - } else { - messageTypeBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder addMessageType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (messageTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMessageTypeIsMutable(); - messageType_.add(index, value); - onChanged(); - } else { - messageTypeBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder addMessageType( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (messageTypeBuilder_ == null) { - ensureMessageTypeIsMutable(); - messageType_.add(builderForValue.build()); - onChanged(); - } else { - messageTypeBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder addMessageType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (messageTypeBuilder_ == null) { - ensureMessageTypeIsMutable(); - messageType_.add(index, builderForValue.build()); - onChanged(); - } else { - messageTypeBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder addAllMessageType( - java.lang.Iterable values) { - if (messageTypeBuilder_ == null) { - ensureMessageTypeIsMutable(); - super.addAll(values, messageType_); - onChanged(); - } else { - messageTypeBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder clearMessageType() { - if (messageTypeBuilder_ == null) { - messageType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - messageTypeBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public Builder removeMessageType(int index) { - if (messageTypeBuilder_ == null) { - ensureMessageTypeIsMutable(); - messageType_.remove(index); - onChanged(); - } else { - messageTypeBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder getMessageTypeBuilder( - int index) { - return getMessageTypeFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder( - int index) { - if (messageTypeBuilder_ == null) { - return messageType_.get(index); } else { - return messageTypeBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public java.util.List - getMessageTypeOrBuilderList() { - if (messageTypeBuilder_ != null) { - return messageTypeBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(messageType_); - } - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addMessageTypeBuilder() { - return getMessageTypeFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addMessageTypeBuilder( - int index) { - return getMessageTypeFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto message_type = 4; - * - *
-       * All top-level definitions in this file.
-       * 
- */ - public java.util.List - getMessageTypeBuilderList() { - return getMessageTypeFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder> - getMessageTypeFieldBuilder() { - if (messageTypeBuilder_ == null) { - messageTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>( - messageType_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - messageType_ = null; - } - return messageTypeBuilder_; - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - private java.util.List enumType_ = - java.util.Collections.emptyList(); - private void ensureEnumTypeIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { - enumType_ = new java.util.ArrayList(enumType_); - bitField0_ |= 0x00000040; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder> enumTypeBuilder_; - - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public java.util.List getEnumTypeList() { - if (enumTypeBuilder_ == null) { - return java.util.Collections.unmodifiableList(enumType_); - } else { - return enumTypeBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public int getEnumTypeCount() { - if (enumTypeBuilder_ == null) { - return enumType_.size(); - } else { - return enumTypeBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) { - if (enumTypeBuilder_ == null) { - return enumType_.get(index); - } else { - return enumTypeBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder setEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.set(index, value); - onChanged(); - } else { - enumTypeBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder setEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.set(index, builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder addEnumType(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.add(value); - onChanged(); - } else { - enumTypeBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder addEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.add(index, value); - onChanged(); - } else { - enumTypeBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder addEnumType( - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.add(builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder addEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.add(index, builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder addAllEnumType( - java.lang.Iterable values) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - super.addAll(values, enumType_); - onChanged(); - } else { - enumTypeBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder clearEnumType() { - if (enumTypeBuilder_ == null) { - enumType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - } else { - enumTypeBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public Builder removeEnumType(int index) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.remove(index); - onChanged(); - } else { - enumTypeBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder getEnumTypeBuilder( - int index) { - return getEnumTypeFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index) { - if (enumTypeBuilder_ == null) { - return enumType_.get(index); } else { - return enumTypeBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public java.util.List - getEnumTypeOrBuilderList() { - if (enumTypeBuilder_ != null) { - return enumTypeBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(enumType_); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder() { - return getEnumTypeFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder( - int index) { - return getEnumTypeFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - */ - public java.util.List - getEnumTypeBuilderList() { - return getEnumTypeFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder> - getEnumTypeFieldBuilder() { - if (enumTypeBuilder_ == null) { - enumTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>( - enumType_, - ((bitField0_ & 0x00000040) == 0x00000040), - getParentForChildren(), - isClean()); - enumType_ = null; - } - return enumTypeBuilder_; - } - - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - private java.util.List service_ = - java.util.Collections.emptyList(); - private void ensureServiceIsMutable() { - if (!((bitField0_ & 0x00000080) == 0x00000080)) { - service_ = new java.util.ArrayList(service_); - bitField0_ |= 0x00000080; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder> serviceBuilder_; - - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public java.util.List getServiceList() { - if (serviceBuilder_ == null) { - return java.util.Collections.unmodifiableList(service_); - } else { - return serviceBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public int getServiceCount() { - if (serviceBuilder_ == null) { - return service_.size(); - } else { - return serviceBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index) { - if (serviceBuilder_ == null) { - return service_.get(index); - } else { - return serviceBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder setService( - int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) { - if (serviceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureServiceIsMutable(); - service_.set(index, value); - onChanged(); - } else { - serviceBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder setService( - int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { - if (serviceBuilder_ == null) { - ensureServiceIsMutable(); - service_.set(index, builderForValue.build()); - onChanged(); - } else { - serviceBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder addService(org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) { - if (serviceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureServiceIsMutable(); - service_.add(value); - onChanged(); - } else { - serviceBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder addService( - int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) { - if (serviceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureServiceIsMutable(); - service_.add(index, value); - onChanged(); - } else { - serviceBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder addService( - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { - if (serviceBuilder_ == null) { - ensureServiceIsMutable(); - service_.add(builderForValue.build()); - onChanged(); - } else { - serviceBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder addService( - int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { - if (serviceBuilder_ == null) { - ensureServiceIsMutable(); - service_.add(index, builderForValue.build()); - onChanged(); - } else { - serviceBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder addAllService( - java.lang.Iterable values) { - if (serviceBuilder_ == null) { - ensureServiceIsMutable(); - super.addAll(values, service_); - onChanged(); - } else { - serviceBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder clearService() { - if (serviceBuilder_ == null) { - service_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - onChanged(); - } else { - serviceBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public Builder removeService(int index) { - if (serviceBuilder_ == null) { - ensureServiceIsMutable(); - service_.remove(index); - onChanged(); - } else { - serviceBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder getServiceBuilder( - int index) { - return getServiceFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder( - int index) { - if (serviceBuilder_ == null) { - return service_.get(index); } else { - return serviceBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public java.util.List - getServiceOrBuilderList() { - if (serviceBuilder_ != null) { - return serviceBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(service_); - } - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder addServiceBuilder() { - return getServiceFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder addServiceBuilder( - int index) { - return getServiceFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; - */ - public java.util.List - getServiceBuilderList() { - return getServiceFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder> - getServiceFieldBuilder() { - if (serviceBuilder_ == null) { - serviceBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>( - service_, - ((bitField0_ & 0x00000080) == 0x00000080), - getParentForChildren(), - isClean()); - service_ = null; - } - return serviceBuilder_; - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - private java.util.List extension_ = - java.util.Collections.emptyList(); - private void ensureExtensionIsMutable() { - if (!((bitField0_ & 0x00000100) == 0x00000100)) { - extension_ = new java.util.ArrayList(extension_); - bitField0_ |= 0x00000100; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> extensionBuilder_; - - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public java.util.List getExtensionList() { - if (extensionBuilder_ == null) { - return java.util.Collections.unmodifiableList(extension_); - } else { - return extensionBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public int getExtensionCount() { - if (extensionBuilder_ == null) { - return extension_.size(); - } else { - return extensionBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) { - if (extensionBuilder_ == null) { - return extension_.get(index); - } else { - return extensionBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder setExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.set(index, value); - onChanged(); - } else { - extensionBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder setExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.set(index, builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder addExtension(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.add(value); - onChanged(); - } else { - extensionBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder addExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.add(index, value); - onChanged(); - } else { - extensionBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder addExtension( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.add(builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder addExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.add(index, builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder addAllExtension( - java.lang.Iterable values) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - super.addAll(values, extension_); - onChanged(); - } else { - extensionBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder clearExtension() { - if (extensionBuilder_ == null) { - extension_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - onChanged(); - } else { - extensionBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public Builder removeExtension(int index) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.remove(index); - onChanged(); - } else { - extensionBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder getExtensionBuilder( - int index) { - return getExtensionFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index) { - if (extensionBuilder_ == null) { - return extension_.get(index); } else { - return extensionBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public java.util.List - getExtensionOrBuilderList() { - if (extensionBuilder_ != null) { - return extensionBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(extension_); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder() { - return getExtensionFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder( - int index) { - return getExtensionFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; - */ - public java.util.List - getExtensionBuilderList() { - return getExtensionFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> - getExtensionFieldBuilder() { - if (extensionBuilder_ == null) { - extensionBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>( - extension_, - ((bitField0_ & 0x00000100) == 0x00000100), - getParentForChildren(), - isClean()); - extension_ = null; - } - return extensionBuilder_; - } - - // optional .google.protobuf.FileOptions options = 8; - private org.apache.pekko.protobuf.DescriptorProtos.FileOptions options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance(); - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder> optionsBuilder_; - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public boolean hasOptions() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions() { - if (optionsBuilder_ == null) { - return options_; - } else { - return optionsBuilder_.getMessage(); - } - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public Builder setOptions(org.apache.pekko.protobuf.DescriptorProtos.FileOptions value) { - if (optionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - options_ = value; - onChanged(); - } else { - optionsBuilder_.setMessage(value); - } - bitField0_ |= 0x00000200; - return this; - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public Builder setOptions( - org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder builderForValue) { - if (optionsBuilder_ == null) { - options_ = builderForValue.build(); - onChanged(); - } else { - optionsBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000200; - return this; - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public Builder mergeOptions(org.apache.pekko.protobuf.DescriptorProtos.FileOptions value) { - if (optionsBuilder_ == null) { - if (((bitField0_ & 0x00000200) == 0x00000200) && - options_ != org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance()) { - options_ = - org.apache.pekko.protobuf.DescriptorProtos.FileOptions.newBuilder(options_).mergeFrom(value).buildPartial(); - } else { - options_ = value; - } - onChanged(); - } else { - optionsBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000200; - return this; - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public Builder clearOptions() { - if (optionsBuilder_ == null) { - options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance(); - onChanged(); - } else { - optionsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000200); - return this; - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder getOptionsBuilder() { - bitField0_ |= 0x00000200; - onChanged(); - return getOptionsFieldBuilder().getBuilder(); - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder() { - if (optionsBuilder_ != null) { - return optionsBuilder_.getMessageOrBuilder(); - } else { - return options_; - } - } - /** - * optional .google.protobuf.FileOptions options = 8; - */ - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder> - getOptionsFieldBuilder() { - if (optionsBuilder_ == null) { - optionsBuilder_ = new org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder>( - options_, - getParentForChildren(), - isClean()); - options_ = null; - } - return optionsBuilder_; - } - - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - private org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance(); - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder> sourceCodeInfoBuilder_; - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public boolean hasSourceCodeInfo() { - return ((bitField0_ & 0x00000400) == 0x00000400); - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo() { - if (sourceCodeInfoBuilder_ == null) { - return sourceCodeInfo_; - } else { - return sourceCodeInfoBuilder_.getMessage(); - } - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public Builder setSourceCodeInfo(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo value) { - if (sourceCodeInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - sourceCodeInfo_ = value; - onChanged(); - } else { - sourceCodeInfoBuilder_.setMessage(value); - } - bitField0_ |= 0x00000400; - return this; - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public Builder setSourceCodeInfo( - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder builderForValue) { - if (sourceCodeInfoBuilder_ == null) { - sourceCodeInfo_ = builderForValue.build(); - onChanged(); - } else { - sourceCodeInfoBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000400; - return this; - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public Builder mergeSourceCodeInfo(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo value) { - if (sourceCodeInfoBuilder_ == null) { - if (((bitField0_ & 0x00000400) == 0x00000400) && - sourceCodeInfo_ != org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance()) { - sourceCodeInfo_ = - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.newBuilder(sourceCodeInfo_).mergeFrom(value).buildPartial(); - } else { - sourceCodeInfo_ = value; - } - onChanged(); - } else { - sourceCodeInfoBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000400; - return this; - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public Builder clearSourceCodeInfo() { - if (sourceCodeInfoBuilder_ == null) { - sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance(); - onChanged(); - } else { - sourceCodeInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000400); - return this; - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder getSourceCodeInfoBuilder() { - bitField0_ |= 0x00000400; - onChanged(); - return getSourceCodeInfoFieldBuilder().getBuilder(); - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder() { - if (sourceCodeInfoBuilder_ != null) { - return sourceCodeInfoBuilder_.getMessageOrBuilder(); - } else { - return sourceCodeInfo_; - } - } - /** - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; - * - *
-       * This field contains optional information about the original source code.
-       * You may safely remove this entire field whithout harming runtime
-       * functionality of the descriptors -- the information is needed only by
-       * development tools.
-       * 
- */ - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder> - getSourceCodeInfoFieldBuilder() { - if (sourceCodeInfoBuilder_ == null) { - sourceCodeInfoBuilder_ = new org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder>( - sourceCodeInfo_, - getParentForChildren(), - isClean()); - sourceCodeInfo_ = null; - } - return sourceCodeInfoBuilder_; - } - - // @@protoc_insertion_point(builder_scope:google.protobuf.FileDescriptorProto) - } - - static { - defaultInstance = new FileDescriptorProto(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto) - } - - public interface DescriptorProtoOrBuilder - extends org.apache.pekko.protobuf.MessageOrBuilder { - - // optional string name = 1; - /** - * optional string name = 1; - */ - boolean hasName(); - /** - * optional string name = 1; - */ - java.lang.String getName(); - /** - * optional string name = 1; - */ - org.apache.pekko.protobuf.ByteString - getNameBytes(); - - // repeated .google.protobuf.FieldDescriptorProto field = 2; - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - java.util.List - getFieldList(); - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getField(int index); - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - int getFieldCount(); - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - java.util.List - getFieldOrBuilderList(); - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getFieldOrBuilder( - int index); - - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - java.util.List - getExtensionList(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - int getExtensionCount(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - java.util.List - getExtensionOrBuilderList(); - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index); - - // repeated .google.protobuf.DescriptorProto nested_type = 3; - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - java.util.List - getNestedTypeList(); - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getNestedType(int index); - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - int getNestedTypeCount(); - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - java.util.List - getNestedTypeOrBuilderList(); - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getNestedTypeOrBuilder( - int index); - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - java.util.List - getEnumTypeList(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - int getEnumTypeCount(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - java.util.List - getEnumTypeOrBuilderList(); - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index); - - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - java.util.List - getExtensionRangeList(); - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange getExtensionRange(int index); - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - int getExtensionRangeCount(); - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - java.util.List - getExtensionRangeOrBuilderList(); - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder getExtensionRangeOrBuilder( - int index); - - // optional .google.protobuf.MessageOptions options = 7; - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - boolean hasOptions(); - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions getOptions(); - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder getOptionsOrBuilder(); - } - /** - * Protobuf type {@code google.protobuf.DescriptorProto} - * - *
-   * Describes a message type.
-   * 
- */ - public static final class DescriptorProto extends - org.apache.pekko.protobuf.GeneratedMessage - implements DescriptorProtoOrBuilder { - // Use DescriptorProto.newBuilder() to construct. - private DescriptorProto(org.apache.pekko.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private DescriptorProto(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final DescriptorProto defaultInstance; - public static DescriptorProto getDefaultInstance() { - return defaultInstance; - } - - public DescriptorProto getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final org.apache.pekko.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private DescriptorProto( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields = - org.apache.pekko.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - field_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - field_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - nestedType_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - nestedType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.PARSER, extensionRegistry)); - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - enumType_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000010; - } - enumType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 42: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - extensionRange_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; - } - extensionRange_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.PARSER, extensionRegistry)); - break; - } - case 50: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - extension_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - extension_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry)); - break; - } - case 58: { - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = options_.toBuilder(); - } - options_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(options_); - options_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - } - } - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.apache.pekko.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - field_ = java.util.Collections.unmodifiableList(field_); - } - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - nestedType_ = java.util.Collections.unmodifiableList(nestedType_); - } - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - enumType_ = java.util.Collections.unmodifiableList(enumType_); - } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - extensionRange_ = java.util.Collections.unmodifiableList(extensionRange_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - extension_ = java.util.Collections.unmodifiableList(extension_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder.class); - } - - public static org.apache.pekko.protobuf.Parser PARSER = - new org.apache.pekko.protobuf.AbstractParser() { - public DescriptorProto parsePartialFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return new DescriptorProto(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.apache.pekko.protobuf.Parser getParserForType() { - return PARSER; - } - - public interface ExtensionRangeOrBuilder - extends org.apache.pekko.protobuf.MessageOrBuilder { - - // optional int32 start = 1; - /** - * optional int32 start = 1; - */ - boolean hasStart(); - /** - * optional int32 start = 1; - */ - int getStart(); - - // optional int32 end = 2; - /** - * optional int32 end = 2; - */ - boolean hasEnd(); - /** - * optional int32 end = 2; - */ - int getEnd(); - } - /** - * Protobuf type {@code google.protobuf.DescriptorProto.ExtensionRange} - */ - public static final class ExtensionRange extends - org.apache.pekko.protobuf.GeneratedMessage - implements ExtensionRangeOrBuilder { - // Use ExtensionRange.newBuilder() to construct. - private ExtensionRange(org.apache.pekko.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private ExtensionRange(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final ExtensionRange defaultInstance; - public static ExtensionRange getDefaultInstance() { - return defaultInstance; - } - - public ExtensionRange getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final org.apache.pekko.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private ExtensionRange( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields = - org.apache.pekko.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - start_ = input.readInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - end_ = input.readInt32(); - break; - } - } - } - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.apache.pekko.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_ExtensionRange_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_ExtensionRange_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.class, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder.class); - } - - public static org.apache.pekko.protobuf.Parser PARSER = - new org.apache.pekko.protobuf.AbstractParser() { - public ExtensionRange parsePartialFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return new ExtensionRange(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.apache.pekko.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional int32 start = 1; - public static final int START_FIELD_NUMBER = 1; - private int start_; - /** - * optional int32 start = 1; - */ - public boolean hasStart() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional int32 start = 1; - */ - public int getStart() { - return start_; - } - - // optional int32 end = 2; - public static final int END_FIELD_NUMBER = 2; - private int end_; - /** - * optional int32 end = 2; - */ - public boolean hasEnd() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional int32 end = 2; - */ - public int getEnd() { - return end_; - } - - private void initFields() { - start_ = 0; - end_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, start_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, end_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeInt32Size(1, start_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeInt32Size(2, end_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - org.apache.pekko.protobuf.ByteString data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - org.apache.pekko.protobuf.ByteString data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom(byte[] data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - byte[] data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseDelimitedFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - org.apache.pekko.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parseFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.protobuf.DescriptorProto.ExtensionRange} - */ - public static final class Builder extends - org.apache.pekko.protobuf.GeneratedMessage.Builder - implements org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder { - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_ExtensionRange_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_ExtensionRange_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.class, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder.class); - } - - // Construct using org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - start_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - end_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_ExtensionRange_descriptor; - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange getDefaultInstanceForType() { - return org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.getDefaultInstance(); - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange build() { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange buildPartial() { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange result = new org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.start_ = start_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.end_ = end_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(org.apache.pekko.protobuf.Message other) { - if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange) { - return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange other) { - if (other == org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.getDefaultInstance()) return this; - if (other.hasStart()) { - setStart(other.getStart()); - } - if (other.hasEnd()) { - setEnd(other.getEnd()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional int32 start = 1; - private int start_ ; - /** - * optional int32 start = 1; - */ - public boolean hasStart() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional int32 start = 1; - */ - public int getStart() { - return start_; - } - /** - * optional int32 start = 1; - */ - public Builder setStart(int value) { - bitField0_ |= 0x00000001; - start_ = value; - onChanged(); - return this; - } - /** - * optional int32 start = 1; - */ - public Builder clearStart() { - bitField0_ = (bitField0_ & ~0x00000001); - start_ = 0; - onChanged(); - return this; - } - - // optional int32 end = 2; - private int end_ ; - /** - * optional int32 end = 2; - */ - public boolean hasEnd() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional int32 end = 2; - */ - public int getEnd() { - return end_; - } - /** - * optional int32 end = 2; - */ - public Builder setEnd(int value) { - bitField0_ |= 0x00000002; - end_ = value; - onChanged(); - return this; - } - /** - * optional int32 end = 2; - */ - public Builder clearEnd() { - bitField0_ = (bitField0_ & ~0x00000002); - end_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:google.protobuf.DescriptorProto.ExtensionRange) - } - - static { - defaultInstance = new ExtensionRange(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange) - } - - private int bitField0_; - // optional string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - org.apache.pekko.protobuf.ByteString bs = - (org.apache.pekko.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } - } - /** - * optional string name = 1; - */ - public org.apache.pekko.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - - // repeated .google.protobuf.FieldDescriptorProto field = 2; - public static final int FIELD_FIELD_NUMBER = 2; - private java.util.List field_; - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public java.util.List getFieldList() { - return field_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public java.util.List - getFieldOrBuilderList() { - return field_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public int getFieldCount() { - return field_.size(); - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getField(int index) { - return field_.get(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getFieldOrBuilder( - int index) { - return field_.get(index); - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - public static final int EXTENSION_FIELD_NUMBER = 6; - private java.util.List extension_; - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public java.util.List getExtensionList() { - return extension_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public java.util.List - getExtensionOrBuilderList() { - return extension_; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public int getExtensionCount() { - return extension_.size(); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) { - return extension_.get(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index) { - return extension_.get(index); - } - - // repeated .google.protobuf.DescriptorProto nested_type = 3; - public static final int NESTED_TYPE_FIELD_NUMBER = 3; - private java.util.List nestedType_; - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public java.util.List getNestedTypeList() { - return nestedType_; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public java.util.List - getNestedTypeOrBuilderList() { - return nestedType_; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public int getNestedTypeCount() { - return nestedType_.size(); - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getNestedType(int index) { - return nestedType_.get(index); - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getNestedTypeOrBuilder( - int index) { - return nestedType_.get(index); - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - public static final int ENUM_TYPE_FIELD_NUMBER = 4; - private java.util.List enumType_; - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public java.util.List getEnumTypeList() { - return enumType_; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public java.util.List - getEnumTypeOrBuilderList() { - return enumType_; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public int getEnumTypeCount() { - return enumType_.size(); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) { - return enumType_.get(index); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index) { - return enumType_.get(index); - } - - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - public static final int EXTENSION_RANGE_FIELD_NUMBER = 5; - private java.util.List extensionRange_; - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public java.util.List getExtensionRangeList() { - return extensionRange_; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public java.util.List - getExtensionRangeOrBuilderList() { - return extensionRange_; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public int getExtensionRangeCount() { - return extensionRange_.size(); - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange getExtensionRange(int index) { - return extensionRange_.get(index); - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder getExtensionRangeOrBuilder( - int index) { - return extensionRange_.get(index); - } - - // optional .google.protobuf.MessageOptions options = 7; - public static final int OPTIONS_FIELD_NUMBER = 7; - private org.apache.pekko.protobuf.DescriptorProtos.MessageOptions options_; - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public boolean hasOptions() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.MessageOptions getOptions() { - return options_; - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder getOptionsOrBuilder() { - return options_; - } - - private void initFields() { - name_ = ""; - field_ = java.util.Collections.emptyList(); - extension_ = java.util.Collections.emptyList(); - nestedType_ = java.util.Collections.emptyList(); - enumType_ = java.util.Collections.emptyList(); - extensionRange_ = java.util.Collections.emptyList(); - options_ = org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getFieldCount(); i++) { - if (!getField(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getExtensionCount(); i++) { - if (!getExtension(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getNestedTypeCount(); i++) { - if (!getNestedType(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getEnumTypeCount(); i++) { - if (!getEnumType(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasOptions()) { - if (!getOptions().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - for (int i = 0; i < field_.size(); i++) { - output.writeMessage(2, field_.get(i)); - } - for (int i = 0; i < nestedType_.size(); i++) { - output.writeMessage(3, nestedType_.get(i)); - } - for (int i = 0; i < enumType_.size(); i++) { - output.writeMessage(4, enumType_.get(i)); - } - for (int i = 0; i < extensionRange_.size(); i++) { - output.writeMessage(5, extensionRange_.get(i)); - } - for (int i = 0; i < extension_.size(); i++) { - output.writeMessage(6, extension_.get(i)); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(7, options_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - for (int i = 0; i < field_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(2, field_.get(i)); - } - for (int i = 0; i < nestedType_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(3, nestedType_.get(i)); - } - for (int i = 0; i < enumType_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(4, enumType_.get(i)); - } - for (int i = 0; i < extensionRange_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(5, extensionRange_.get(i)); - } - for (int i = 0; i < extension_.size(); i++) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(6, extension_.get(i)); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.apache.pekko.protobuf.CodedOutputStream - .computeMessageSize(7, options_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - org.apache.pekko.protobuf.ByteString data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - org.apache.pekko.protobuf.ByteString data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom(byte[] data) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - byte[] data, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseDelimitedFrom( - java.io.InputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - org.apache.pekko.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parseFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.protobuf.DescriptorProto} - * - *
-     * Describes a message type.
-     * 
- */ - public static final class Builder extends - org.apache.pekko.protobuf.GeneratedMessage.Builder - implements org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder { - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder.class); - } - - // Construct using org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getFieldFieldBuilder(); - getExtensionFieldBuilder(); - getNestedTypeFieldBuilder(); - getEnumTypeFieldBuilder(); - getExtensionRangeFieldBuilder(); - getOptionsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (fieldBuilder_ == null) { - field_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - fieldBuilder_.clear(); - } - if (extensionBuilder_ == null) { - extension_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - extensionBuilder_.clear(); - } - if (nestedTypeBuilder_ == null) { - nestedType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - nestedTypeBuilder_.clear(); - } - if (enumTypeBuilder_ == null) { - enumType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - enumTypeBuilder_.clear(); - } - if (extensionRangeBuilder_ == null) { - extensionRange_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - extensionRangeBuilder_.clear(); - } - if (optionsBuilder_ == null) { - options_ = org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.getDefaultInstance(); - } else { - optionsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_descriptor; - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getDefaultInstanceForType() { - return org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance(); - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto build() { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto buildPartial() { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto result = new org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (fieldBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - field_ = java.util.Collections.unmodifiableList(field_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.field_ = field_; - } else { - result.field_ = fieldBuilder_.build(); - } - if (extensionBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - extension_ = java.util.Collections.unmodifiableList(extension_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.extension_ = extension_; - } else { - result.extension_ = extensionBuilder_.build(); - } - if (nestedTypeBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - nestedType_ = java.util.Collections.unmodifiableList(nestedType_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.nestedType_ = nestedType_; - } else { - result.nestedType_ = nestedTypeBuilder_.build(); - } - if (enumTypeBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - enumType_ = java.util.Collections.unmodifiableList(enumType_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.enumType_ = enumType_; - } else { - result.enumType_ = enumTypeBuilder_.build(); - } - if (extensionRangeBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - extensionRange_ = java.util.Collections.unmodifiableList(extensionRange_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.extensionRange_ = extensionRange_; - } else { - result.extensionRange_ = extensionRangeBuilder_.build(); - } - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000002; - } - if (optionsBuilder_ == null) { - result.options_ = options_; - } else { - result.options_ = optionsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(org.apache.pekko.protobuf.Message other) { - if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto) { - return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto other) { - if (other == org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance()) return this; - if (other.hasName()) { - bitField0_ |= 0x00000001; - name_ = other.name_; - onChanged(); - } - if (fieldBuilder_ == null) { - if (!other.field_.isEmpty()) { - if (field_.isEmpty()) { - field_ = other.field_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureFieldIsMutable(); - field_.addAll(other.field_); - } - onChanged(); - } - } else { - if (!other.field_.isEmpty()) { - if (fieldBuilder_.isEmpty()) { - fieldBuilder_.dispose(); - fieldBuilder_ = null; - field_ = other.field_; - bitField0_ = (bitField0_ & ~0x00000002); - fieldBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getFieldFieldBuilder() : null; - } else { - fieldBuilder_.addAllMessages(other.field_); - } - } - } - if (extensionBuilder_ == null) { - if (!other.extension_.isEmpty()) { - if (extension_.isEmpty()) { - extension_ = other.extension_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureExtensionIsMutable(); - extension_.addAll(other.extension_); - } - onChanged(); - } - } else { - if (!other.extension_.isEmpty()) { - if (extensionBuilder_.isEmpty()) { - extensionBuilder_.dispose(); - extensionBuilder_ = null; - extension_ = other.extension_; - bitField0_ = (bitField0_ & ~0x00000004); - extensionBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getExtensionFieldBuilder() : null; - } else { - extensionBuilder_.addAllMessages(other.extension_); - } - } - } - if (nestedTypeBuilder_ == null) { - if (!other.nestedType_.isEmpty()) { - if (nestedType_.isEmpty()) { - nestedType_ = other.nestedType_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureNestedTypeIsMutable(); - nestedType_.addAll(other.nestedType_); - } - onChanged(); - } - } else { - if (!other.nestedType_.isEmpty()) { - if (nestedTypeBuilder_.isEmpty()) { - nestedTypeBuilder_.dispose(); - nestedTypeBuilder_ = null; - nestedType_ = other.nestedType_; - bitField0_ = (bitField0_ & ~0x00000008); - nestedTypeBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getNestedTypeFieldBuilder() : null; - } else { - nestedTypeBuilder_.addAllMessages(other.nestedType_); - } - } - } - if (enumTypeBuilder_ == null) { - if (!other.enumType_.isEmpty()) { - if (enumType_.isEmpty()) { - enumType_ = other.enumType_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureEnumTypeIsMutable(); - enumType_.addAll(other.enumType_); - } - onChanged(); - } - } else { - if (!other.enumType_.isEmpty()) { - if (enumTypeBuilder_.isEmpty()) { - enumTypeBuilder_.dispose(); - enumTypeBuilder_ = null; - enumType_ = other.enumType_; - bitField0_ = (bitField0_ & ~0x00000010); - enumTypeBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getEnumTypeFieldBuilder() : null; - } else { - enumTypeBuilder_.addAllMessages(other.enumType_); - } - } - } - if (extensionRangeBuilder_ == null) { - if (!other.extensionRange_.isEmpty()) { - if (extensionRange_.isEmpty()) { - extensionRange_ = other.extensionRange_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureExtensionRangeIsMutable(); - extensionRange_.addAll(other.extensionRange_); - } - onChanged(); - } - } else { - if (!other.extensionRange_.isEmpty()) { - if (extensionRangeBuilder_.isEmpty()) { - extensionRangeBuilder_.dispose(); - extensionRangeBuilder_ = null; - extensionRange_ = other.extensionRange_; - bitField0_ = (bitField0_ & ~0x00000020); - extensionRangeBuilder_ = - org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getExtensionRangeFieldBuilder() : null; - } else { - extensionRangeBuilder_.addAllMessages(other.extensionRange_); - } - } - } - if (other.hasOptions()) { - mergeOptions(other.getOptions()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getFieldCount(); i++) { - if (!getField(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getExtensionCount(); i++) { - if (!getExtension(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getNestedTypeCount(); i++) { - if (!getNestedType(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getEnumTypeCount(); i++) { - if (!getEnumType(i).isInitialized()) { - - return false; - } - } - if (hasOptions()) { - if (!getOptions().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional string name = 1; - private java.lang.Object name_ = ""; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((org.apache.pekko.protobuf.ByteString) ref) - .toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string name = 1; - */ - public org.apache.pekko.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - org.apache.pekko.protobuf.ByteString b = - org.apache.pekko.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (org.apache.pekko.protobuf.ByteString) ref; - } - } - /** - * optional string name = 1; - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder setNameBytes( - org.apache.pekko.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - - // repeated .google.protobuf.FieldDescriptorProto field = 2; - private java.util.List field_ = - java.util.Collections.emptyList(); - private void ensureFieldIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - field_ = new java.util.ArrayList(field_); - bitField0_ |= 0x00000002; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> fieldBuilder_; - - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public java.util.List getFieldList() { - if (fieldBuilder_ == null) { - return java.util.Collections.unmodifiableList(field_); - } else { - return fieldBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public int getFieldCount() { - if (fieldBuilder_ == null) { - return field_.size(); - } else { - return fieldBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getField(int index) { - if (fieldBuilder_ == null) { - return field_.get(index); - } else { - return fieldBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder setField( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (fieldBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFieldIsMutable(); - field_.set(index, value); - onChanged(); - } else { - fieldBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder setField( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (fieldBuilder_ == null) { - ensureFieldIsMutable(); - field_.set(index, builderForValue.build()); - onChanged(); - } else { - fieldBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder addField(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (fieldBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFieldIsMutable(); - field_.add(value); - onChanged(); - } else { - fieldBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder addField( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (fieldBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFieldIsMutable(); - field_.add(index, value); - onChanged(); - } else { - fieldBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder addField( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (fieldBuilder_ == null) { - ensureFieldIsMutable(); - field_.add(builderForValue.build()); - onChanged(); - } else { - fieldBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder addField( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (fieldBuilder_ == null) { - ensureFieldIsMutable(); - field_.add(index, builderForValue.build()); - onChanged(); - } else { - fieldBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder addAllField( - java.lang.Iterable values) { - if (fieldBuilder_ == null) { - ensureFieldIsMutable(); - super.addAll(values, field_); - onChanged(); - } else { - fieldBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder clearField() { - if (fieldBuilder_ == null) { - field_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - fieldBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public Builder removeField(int index) { - if (fieldBuilder_ == null) { - ensureFieldIsMutable(); - field_.remove(index); - onChanged(); - } else { - fieldBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder getFieldBuilder( - int index) { - return getFieldFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getFieldOrBuilder( - int index) { - if (fieldBuilder_ == null) { - return field_.get(index); } else { - return fieldBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public java.util.List - getFieldOrBuilderList() { - if (fieldBuilder_ != null) { - return fieldBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(field_); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addFieldBuilder() { - return getFieldFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addFieldBuilder( - int index) { - return getFieldFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; - */ - public java.util.List - getFieldBuilderList() { - return getFieldFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> - getFieldFieldBuilder() { - if (fieldBuilder_ == null) { - fieldBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>( - field_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - field_ = null; - } - return fieldBuilder_; - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - private java.util.List extension_ = - java.util.Collections.emptyList(); - private void ensureExtensionIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - extension_ = new java.util.ArrayList(extension_); - bitField0_ |= 0x00000004; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> extensionBuilder_; - - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public java.util.List getExtensionList() { - if (extensionBuilder_ == null) { - return java.util.Collections.unmodifiableList(extension_); - } else { - return extensionBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public int getExtensionCount() { - if (extensionBuilder_ == null) { - return extension_.size(); - } else { - return extensionBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) { - if (extensionBuilder_ == null) { - return extension_.get(index); - } else { - return extensionBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder setExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.set(index, value); - onChanged(); - } else { - extensionBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder setExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.set(index, builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder addExtension(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.add(value); - onChanged(); - } else { - extensionBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder addExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) { - if (extensionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionIsMutable(); - extension_.add(index, value); - onChanged(); - } else { - extensionBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder addExtension( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.add(builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder addExtension( - int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.add(index, builderForValue.build()); - onChanged(); - } else { - extensionBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder addAllExtension( - java.lang.Iterable values) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - super.addAll(values, extension_); - onChanged(); - } else { - extensionBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder clearExtension() { - if (extensionBuilder_ == null) { - extension_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - extensionBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public Builder removeExtension(int index) { - if (extensionBuilder_ == null) { - ensureExtensionIsMutable(); - extension_.remove(index); - onChanged(); - } else { - extensionBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder getExtensionBuilder( - int index) { - return getExtensionFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder( - int index) { - if (extensionBuilder_ == null) { - return extension_.get(index); } else { - return extensionBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public java.util.List - getExtensionOrBuilderList() { - if (extensionBuilder_ != null) { - return extensionBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(extension_); - } - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder() { - return getExtensionFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder( - int index) { - return getExtensionFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; - */ - public java.util.List - getExtensionBuilderList() { - return getExtensionFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> - getExtensionFieldBuilder() { - if (extensionBuilder_ == null) { - extensionBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>( - extension_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - extension_ = null; - } - return extensionBuilder_; - } - - // repeated .google.protobuf.DescriptorProto nested_type = 3; - private java.util.List nestedType_ = - java.util.Collections.emptyList(); - private void ensureNestedTypeIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - nestedType_ = new java.util.ArrayList(nestedType_); - bitField0_ |= 0x00000008; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder> nestedTypeBuilder_; - - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public java.util.List getNestedTypeList() { - if (nestedTypeBuilder_ == null) { - return java.util.Collections.unmodifiableList(nestedType_); - } else { - return nestedTypeBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public int getNestedTypeCount() { - if (nestedTypeBuilder_ == null) { - return nestedType_.size(); - } else { - return nestedTypeBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getNestedType(int index) { - if (nestedTypeBuilder_ == null) { - return nestedType_.get(index); - } else { - return nestedTypeBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder setNestedType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (nestedTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNestedTypeIsMutable(); - nestedType_.set(index, value); - onChanged(); - } else { - nestedTypeBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder setNestedType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (nestedTypeBuilder_ == null) { - ensureNestedTypeIsMutable(); - nestedType_.set(index, builderForValue.build()); - onChanged(); - } else { - nestedTypeBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder addNestedType(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (nestedTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNestedTypeIsMutable(); - nestedType_.add(value); - onChanged(); - } else { - nestedTypeBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder addNestedType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) { - if (nestedTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNestedTypeIsMutable(); - nestedType_.add(index, value); - onChanged(); - } else { - nestedTypeBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder addNestedType( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (nestedTypeBuilder_ == null) { - ensureNestedTypeIsMutable(); - nestedType_.add(builderForValue.build()); - onChanged(); - } else { - nestedTypeBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder addNestedType( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) { - if (nestedTypeBuilder_ == null) { - ensureNestedTypeIsMutable(); - nestedType_.add(index, builderForValue.build()); - onChanged(); - } else { - nestedTypeBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder addAllNestedType( - java.lang.Iterable values) { - if (nestedTypeBuilder_ == null) { - ensureNestedTypeIsMutable(); - super.addAll(values, nestedType_); - onChanged(); - } else { - nestedTypeBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder clearNestedType() { - if (nestedTypeBuilder_ == null) { - nestedType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - nestedTypeBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public Builder removeNestedType(int index) { - if (nestedTypeBuilder_ == null) { - ensureNestedTypeIsMutable(); - nestedType_.remove(index); - onChanged(); - } else { - nestedTypeBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder getNestedTypeBuilder( - int index) { - return getNestedTypeFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getNestedTypeOrBuilder( - int index) { - if (nestedTypeBuilder_ == null) { - return nestedType_.get(index); } else { - return nestedTypeBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public java.util.List - getNestedTypeOrBuilderList() { - if (nestedTypeBuilder_ != null) { - return nestedTypeBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(nestedType_); - } - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addNestedTypeBuilder() { - return getNestedTypeFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addNestedTypeBuilder( - int index) { - return getNestedTypeFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; - */ - public java.util.List - getNestedTypeBuilderList() { - return getNestedTypeFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder> - getNestedTypeFieldBuilder() { - if (nestedTypeBuilder_ == null) { - nestedTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>( - nestedType_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - nestedType_ = null; - } - return nestedTypeBuilder_; - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - private java.util.List enumType_ = - java.util.Collections.emptyList(); - private void ensureEnumTypeIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - enumType_ = new java.util.ArrayList(enumType_); - bitField0_ |= 0x00000010; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder> enumTypeBuilder_; - - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public java.util.List getEnumTypeList() { - if (enumTypeBuilder_ == null) { - return java.util.Collections.unmodifiableList(enumType_); - } else { - return enumTypeBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public int getEnumTypeCount() { - if (enumTypeBuilder_ == null) { - return enumType_.size(); - } else { - return enumTypeBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) { - if (enumTypeBuilder_ == null) { - return enumType_.get(index); - } else { - return enumTypeBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder setEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.set(index, value); - onChanged(); - } else { - enumTypeBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder setEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.set(index, builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder addEnumType(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.add(value); - onChanged(); - } else { - enumTypeBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder addEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) { - if (enumTypeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEnumTypeIsMutable(); - enumType_.add(index, value); - onChanged(); - } else { - enumTypeBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder addEnumType( - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.add(builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder addEnumType( - int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.add(index, builderForValue.build()); - onChanged(); - } else { - enumTypeBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder addAllEnumType( - java.lang.Iterable values) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - super.addAll(values, enumType_); - onChanged(); - } else { - enumTypeBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder clearEnumType() { - if (enumTypeBuilder_ == null) { - enumType_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - enumTypeBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public Builder removeEnumType(int index) { - if (enumTypeBuilder_ == null) { - ensureEnumTypeIsMutable(); - enumType_.remove(index); - onChanged(); - } else { - enumTypeBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder getEnumTypeBuilder( - int index) { - return getEnumTypeFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder( - int index) { - if (enumTypeBuilder_ == null) { - return enumType_.get(index); } else { - return enumTypeBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public java.util.List - getEnumTypeOrBuilderList() { - if (enumTypeBuilder_ != null) { - return enumTypeBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(enumType_); - } - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder() { - return getEnumTypeFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder( - int index) { - return getEnumTypeFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance()); - } - /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - */ - public java.util.List - getEnumTypeBuilderList() { - return getEnumTypeFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder> - getEnumTypeFieldBuilder() { - if (enumTypeBuilder_ == null) { - enumTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>( - enumType_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - enumType_ = null; - } - return enumTypeBuilder_; - } - - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - private java.util.List extensionRange_ = - java.util.Collections.emptyList(); - private void ensureExtensionRangeIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - extensionRange_ = new java.util.ArrayList(extensionRange_); - bitField0_ |= 0x00000020; - } - } - - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder> extensionRangeBuilder_; - - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public java.util.List getExtensionRangeList() { - if (extensionRangeBuilder_ == null) { - return java.util.Collections.unmodifiableList(extensionRange_); - } else { - return extensionRangeBuilder_.getMessageList(); - } - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public int getExtensionRangeCount() { - if (extensionRangeBuilder_ == null) { - return extensionRange_.size(); - } else { - return extensionRangeBuilder_.getCount(); - } - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange getExtensionRange(int index) { - if (extensionRangeBuilder_ == null) { - return extensionRange_.get(index); - } else { - return extensionRangeBuilder_.getMessage(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder setExtensionRange( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange value) { - if (extensionRangeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionRangeIsMutable(); - extensionRange_.set(index, value); - onChanged(); - } else { - extensionRangeBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder setExtensionRange( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder builderForValue) { - if (extensionRangeBuilder_ == null) { - ensureExtensionRangeIsMutable(); - extensionRange_.set(index, builderForValue.build()); - onChanged(); - } else { - extensionRangeBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder addExtensionRange(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange value) { - if (extensionRangeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionRangeIsMutable(); - extensionRange_.add(value); - onChanged(); - } else { - extensionRangeBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder addExtensionRange( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange value) { - if (extensionRangeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExtensionRangeIsMutable(); - extensionRange_.add(index, value); - onChanged(); - } else { - extensionRangeBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder addExtensionRange( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder builderForValue) { - if (extensionRangeBuilder_ == null) { - ensureExtensionRangeIsMutable(); - extensionRange_.add(builderForValue.build()); - onChanged(); - } else { - extensionRangeBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder addExtensionRange( - int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder builderForValue) { - if (extensionRangeBuilder_ == null) { - ensureExtensionRangeIsMutable(); - extensionRange_.add(index, builderForValue.build()); - onChanged(); - } else { - extensionRangeBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder addAllExtensionRange( - java.lang.Iterable values) { - if (extensionRangeBuilder_ == null) { - ensureExtensionRangeIsMutable(); - super.addAll(values, extensionRange_); - onChanged(); - } else { - extensionRangeBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder clearExtensionRange() { - if (extensionRangeBuilder_ == null) { - extensionRange_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - extensionRangeBuilder_.clear(); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public Builder removeExtensionRange(int index) { - if (extensionRangeBuilder_ == null) { - ensureExtensionRangeIsMutable(); - extensionRange_.remove(index); - onChanged(); - } else { - extensionRangeBuilder_.remove(index); - } - return this; - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder getExtensionRangeBuilder( - int index) { - return getExtensionRangeFieldBuilder().getBuilder(index); - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder getExtensionRangeOrBuilder( - int index) { - if (extensionRangeBuilder_ == null) { - return extensionRange_.get(index); } else { - return extensionRangeBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public java.util.List - getExtensionRangeOrBuilderList() { - if (extensionRangeBuilder_ != null) { - return extensionRangeBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(extensionRange_); - } - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder addExtensionRangeBuilder() { - return getExtensionRangeFieldBuilder().addBuilder( - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder addExtensionRangeBuilder( - int index) { - return getExtensionRangeFieldBuilder().addBuilder( - index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.getDefaultInstance()); - } - /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - */ - public java.util.List - getExtensionRangeBuilderList() { - return getExtensionRangeFieldBuilder().getBuilderList(); - } - private org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder> - getExtensionRangeFieldBuilder() { - if (extensionRangeBuilder_ == null) { - extensionRangeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder>( - extensionRange_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - extensionRange_ = null; - } - return extensionRangeBuilder_; - } - - // optional .google.protobuf.MessageOptions options = 7; - private org.apache.pekko.protobuf.DescriptorProtos.MessageOptions options_ = org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.getDefaultInstance(); - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions, org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder> optionsBuilder_; - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public boolean hasOptions() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.MessageOptions getOptions() { - if (optionsBuilder_ == null) { - return options_; - } else { - return optionsBuilder_.getMessage(); - } - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public Builder setOptions(org.apache.pekko.protobuf.DescriptorProtos.MessageOptions value) { - if (optionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - options_ = value; - onChanged(); - } else { - optionsBuilder_.setMessage(value); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public Builder setOptions( - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder builderForValue) { - if (optionsBuilder_ == null) { - options_ = builderForValue.build(); - onChanged(); - } else { - optionsBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public Builder mergeOptions(org.apache.pekko.protobuf.DescriptorProtos.MessageOptions value) { - if (optionsBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040) && - options_ != org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.getDefaultInstance()) { - options_ = - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.newBuilder(options_).mergeFrom(value).buildPartial(); - } else { - options_ = value; - } - onChanged(); - } else { - optionsBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public Builder clearOptions() { - if (optionsBuilder_ == null) { - options_ = org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.getDefaultInstance(); - onChanged(); - } else { - optionsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder getOptionsBuilder() { - bitField0_ |= 0x00000040; - onChanged(); - return getOptionsFieldBuilder().getBuilder(); - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - public org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder getOptionsOrBuilder() { - if (optionsBuilder_ != null) { - return optionsBuilder_.getMessageOrBuilder(); - } else { - return options_; - } - } - /** - * optional .google.protobuf.MessageOptions options = 7; - */ - private org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions, org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder> - getOptionsFieldBuilder() { - if (optionsBuilder_ == null) { - optionsBuilder_ = new org.apache.pekko.protobuf.SingleFieldBuilder< - org.apache.pekko.protobuf.DescriptorProtos.MessageOptions, org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder>( - options_, - getParentForChildren(), - isClean()); - options_ = null; - } - return optionsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:google.protobuf.DescriptorProto) - } - - static { - defaultInstance = new DescriptorProto(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto) - } - - public interface FieldDescriptorProtoOrBuilder - extends org.apache.pekko.protobuf.MessageOrBuilder { - - // optional string name = 1; - /** - * optional string name = 1; - */ - boolean hasName(); - /** - * optional string name = 1; - */ - java.lang.String getName(); - /** - * optional string name = 1; - */ - org.apache.pekko.protobuf.ByteString - getNameBytes(); - - // optional int32 number = 3; - /** - * optional int32 number = 3; - */ - boolean hasNumber(); - /** - * optional int32 number = 3; - */ - int getNumber(); - - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; - /** - * optional .google.protobuf.FieldDescriptorProto.Label label = 4; - */ - boolean hasLabel(); - /** - * optional .google.protobuf.FieldDescriptorProto.Label label = 4; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Label getLabel(); - - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; - /** - * optional .google.protobuf.FieldDescriptorProto.Type type = 5; - * - *
-     * If type_name is set, this need not be set.  If both this and type_name
-     * are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
-     * 
- */ - boolean hasType(); - /** - * optional .google.protobuf.FieldDescriptorProto.Type type = 5; - * - *
-     * If type_name is set, this need not be set.  If both this and type_name
-     * are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
-     * 
- */ - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Type getType(); - - // optional string type_name = 6; - /** - * optional string type_name = 6; - * - *
-     * For message and enum types, this is the name of the type.  If the name
-     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
-     * rules are used to find the type (i.e. first the nested types within this
-     * message are searched, then within the parent, on up to the root
-     * namespace).
-     * 
- */ - boolean hasTypeName(); - /** - * optional string type_name = 6; - * - *
-     * For message and enum types, this is the name of the type.  If the name
-     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
-     * rules are used to find the type (i.e. first the nested types within this
-     * message are searched, then within the parent, on up to the root
-     * namespace).
-     * 
- */ - java.lang.String getTypeName(); - /** - * optional string type_name = 6; - * - *
-     * For message and enum types, this is the name of the type.  If the name
-     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
-     * rules are used to find the type (i.e. first the nested types within this
-     * message are searched, then within the parent, on up to the root
-     * namespace).
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getTypeNameBytes(); - - // optional string extendee = 2; - /** - * optional string extendee = 2; - * - *
-     * For extensions, this is the name of the type being extended.  It is
-     * resolved in the same manner as type_name.
-     * 
- */ - boolean hasExtendee(); - /** - * optional string extendee = 2; - * - *
-     * For extensions, this is the name of the type being extended.  It is
-     * resolved in the same manner as type_name.
-     * 
- */ - java.lang.String getExtendee(); - /** - * optional string extendee = 2; - * - *
-     * For extensions, this is the name of the type being extended.  It is
-     * resolved in the same manner as type_name.
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getExtendeeBytes(); - - // optional string default_value = 7; - /** - * optional string default_value = 7; - * - *
-     * For numeric types, contains the original text representation of the value.
-     * For booleans, "true" or "false".
-     * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
-     * TODO(kenton):  Base-64 encode?
-     * 
- */ - boolean hasDefaultValue(); - /** - * optional string default_value = 7; - * - *
-     * For numeric types, contains the original text representation of the value.
-     * For booleans, "true" or "false".
-     * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
-     * TODO(kenton):  Base-64 encode?
-     * 
- */ - java.lang.String getDefaultValue(); - /** - * optional string default_value = 7; - * - *
-     * For numeric types, contains the original text representation of the value.
-     * For booleans, "true" or "false".
-     * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
-     * TODO(kenton):  Base-64 encode?
-     * 
- */ - org.apache.pekko.protobuf.ByteString - getDefaultValueBytes(); - - // optional .google.protobuf.FieldOptions options = 8; - /** - * optional .google.protobuf.FieldOptions options = 8; - */ - boolean hasOptions(); - /** - * optional .google.protobuf.FieldOptions options = 8; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldOptions getOptions(); - /** - * optional .google.protobuf.FieldOptions options = 8; - */ - org.apache.pekko.protobuf.DescriptorProtos.FieldOptionsOrBuilder getOptionsOrBuilder(); - } - /** - * Protobuf type {@code google.protobuf.FieldDescriptorProto} - * - *
-   * Describes a field within a message.
-   * 
- */ - public static final class FieldDescriptorProto extends - org.apache.pekko.protobuf.GeneratedMessage - implements FieldDescriptorProtoOrBuilder { - // Use FieldDescriptorProto.newBuilder() to construct. - private FieldDescriptorProto(org.apache.pekko.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private FieldDescriptorProto(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final FieldDescriptorProto defaultInstance; - public static FieldDescriptorProto getDefaultInstance() { - return defaultInstance; - } - - public FieldDescriptorProto getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final org.apache.pekko.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private FieldDescriptorProto( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields = - org.apache.pekko.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000020; - extendee_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000002; - number_ = input.readInt32(); - break; - } - case 32: { - int rawValue = input.readEnum(); - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Label value = org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Label.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(4, rawValue); - } else { - bitField0_ |= 0x00000004; - label_ = value; - } - break; - } - case 40: { - int rawValue = input.readEnum(); - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Type value = org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Type.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(5, rawValue); - } else { - bitField0_ |= 0x00000008; - type_ = value; - } - break; - } - case 50: { - bitField0_ |= 0x00000010; - typeName_ = input.readBytes(); - break; - } - case 58: { - bitField0_ |= 0x00000040; - defaultValue_ = input.readBytes(); - break; - } - case 66: { - org.apache.pekko.protobuf.DescriptorProtos.FieldOptions.Builder subBuilder = null; - if (((bitField0_ & 0x00000080) == 0x00000080)) { - subBuilder = options_.toBuilder(); - } - options_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldOptions.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(options_); - options_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000080; - break; - } - } - } - } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.apache.pekko.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final org.apache.pekko.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FieldDescriptorProto_descriptor; - } - - protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FieldDescriptorProto_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder.class); - } - - public static org.apache.pekko.protobuf.Parser PARSER = - new org.apache.pekko.protobuf.AbstractParser() { - public FieldDescriptorProto parsePartialFrom( - org.apache.pekko.protobuf.CodedInputStream input, - org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.apache.pekko.protobuf.InvalidProtocolBufferException { - return new FieldDescriptorProto(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.apache.pekko.protobuf.Parser getParserForType() { - return PARSER; - } - - /** - * Protobuf enum {@code google.protobuf.FieldDescriptorProto.Type} - */ - public enum Type - implements org.apache.pekko.protobuf.ProtocolMessageEnum { - /** - * TYPE_DOUBLE = 1; - * - *
-       * 0 is reserved for errors.
-       * Order is weird for historical reasons.
-       * 
- */ - TYPE_DOUBLE(0, 1), - /** - * TYPE_FLOAT = 2; - */ - TYPE_FLOAT(1, 2), - /** - * TYPE_INT64 = 3; - * - *
-       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
-       * negative values are likely.
-       * 
- */ - TYPE_INT64(2, 3), - /** - * TYPE_UINT64 = 4; - */ - TYPE_UINT64(3, 4), - /** - * TYPE_INT32 = 5; - * - *
-       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
-       * negative values are likely.
-       * 
- */ - TYPE_INT32(4, 5), - /** - * TYPE_FIXED64 = 6; - */ - TYPE_FIXED64(5, 6), - /** - * TYPE_FIXED32 = 7; - */ - TYPE_FIXED32(6, 7), - /** - * TYPE_BOOL = 8; - */ - TYPE_BOOL(7, 8), - /** - * TYPE_STRING = 9; - */ - TYPE_STRING(8, 9), - /** - * TYPE_GROUP = 10; - * - *
-       * Tag-delimited aggregate.
-       * 
- */ - TYPE_GROUP(9, 10), - /** - * TYPE_MESSAGE = 11; - * - *
-       * Length-delimited aggregate.
-       * 
- */ - TYPE_MESSAGE(10, 11), - /** - * TYPE_BYTES = 12; - * - *
-       * New in version 2.
-       * 
- */ - TYPE_BYTES(11, 12), - /** - * TYPE_UINT32 = 13; - */ - TYPE_UINT32(12, 13), - /** - * TYPE_ENUM = 14; - */ - TYPE_ENUM(13, 14), - /** - * TYPE_SFIXED32 = 15; - */ - TYPE_SFIXED32(14, 15), - /** - * TYPE_SFIXED64 = 16; - */ - TYPE_SFIXED64(15, 16), - /** - * TYPE_SINT32 = 17; - * - *
-       * Uses ZigZag encoding.
-       * 
- */ - TYPE_SINT32(16, 17), - /** - * TYPE_SINT64 = 18; - * - *
-       * Uses ZigZag encoding.
-       * 
- */ - TYPE_SINT64(17, 18), - ; - - /** - * TYPE_DOUBLE = 1; - * - *
-       * 0 is reserved for errors.
-       * Order is weird for historical reasons.
-       * 
- */ - public static final int TYPE_DOUBLE_VALUE = 1; - /** - * TYPE_FLOAT = 2; - */ - public static final int TYPE_FLOAT_VALUE = 2; - /** - * TYPE_INT64 = 3; - * - *
-       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
-       * negative values are likely.
-       * 
- */ - public static final int TYPE_INT64_VALUE = 3; - /** - * TYPE_UINT64 = 4; - */ - public static final int TYPE_UINT64_VALUE = 4; - /** - * TYPE_INT32 = 5; - * - *
-       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
-       * negative values are likely.
-       * 
- */ - public static final int TYPE_INT32_VALUE = 5; - /** - * TYPE_FIXED64 = 6; - */ - public static final int TYPE_FIXED64_VALUE = 6; - /** - * TYPE_FIXED32 = 7; - */ - public static final int TYPE_FIXED32_VALUE = 7; - /** - * TYPE_BOOL = 8; - */ - public static final int TYPE_BOOL_VALUE = 8; - /** - * TYPE_STRING = 9; - */ - public static final int TYPE_STRING_VALUE = 9; - /** - * TYPE_GROUP = 10; - * - *
-       * Tag-delimited aggregate.
-       * 
- */ - public static final int TYPE_GROUP_VALUE = 10; - /** - * TYPE_MESSAGE = 11; - * - *
-       * Length-delimited aggregate.
-       * 
- */ - public static final int TYPE_MESSAGE_VALUE = 11; - /** - * TYPE_BYTES = 12; - * - *
-       * New in version 2.
-       * 
- */ - public static final int TYPE_BYTES_VALUE = 12; - /** - * TYPE_UINT32 = 13; - */ - public static final int TYPE_UINT32_VALUE = 13; - /** - * TYPE_ENUM = 14; - */ - public static final int TYPE_ENUM_VALUE = 14; - /** - * TYPE_SFIXED32 = 15; - */ - public static final int TYPE_SFIXED32_VALUE = 15; - /** - * TYPE_SFIXED64 = 16; - */ - public static final int TYPE_SFIXED64_VALUE = 16; - /** - * TYPE_SINT32 = 17; - * - *
-       * Uses ZigZag encoding.
-       * 
- */ - public static final int TYPE_SINT32_VALUE = 17; - /** - * TYPE_SINT64 = 18; - * - *
-       * Uses ZigZag encoding.
-       * 
- */ - public static final int TYPE_SINT64_VALUE = 18; - - - public final int getNumber() { return value; } - - public static Type valueOf(int value) { - switch (value) { - case 1: return TYPE_DOUBLE; - case 2: return TYPE_FLOAT; - case 3: return TYPE_INT64; - case 4: return TYPE_UINT64; - case 5: return TYPE_INT32; - case 6: return TYPE_FIXED64; - case 7: return TYPE_FIXED32; - case 8: return TYPE_BOOL; - case 9: return TYPE_STRING; - case 10: return TYPE_GROUP; - case 11: return TYPE_MESSAGE; - case 12: return TYPE_BYTES; - case 13: return TYPE_UINT32; - case 14: return TYPE_ENUM; - case 15: return TYPE_SFIXED32; - case 16: return TYPE_SFIXED64; - case 17: return TYPE_SINT32; - case 18: return TYPE_SINT64; - default: return null; - } - } - - public static org.apache.pekko.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static org.apache.pekko.protobuf.Internal.EnumLiteMap - internalValueMap = - new org.apache.pekko.protobuf.Internal.EnumLiteMap() { - public Type findValueByNumber(int number) { - return Type.valueOf(number); - } - }; - - public final org.apache.pekko.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final org.apache.pekko.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final org.apache.pekko.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDescriptor().getEnumTypes().get(0); - } - - private static final Type[] VALUES = values(); - - public static Type valueOf( - org.apache.pekko.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Type(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.protobuf.FieldDescriptorProto.Type) - } - - /** - * Protobuf enum {@code google.protobuf.FieldDescriptorProto.Label} - */ - public enum Label - implements org.apache.pekko.protobuf.ProtocolMessageEnum { - /** - * LABEL_OPTIONAL = 1; - * - *
-       * 0 is reserved for errors
-       * 
- */ - LABEL_OPTIONAL(0, 1), - /** - * LABEL_REQUIRED = 2; - */ - LABEL_REQUIRED(1, 2), - /** - * LABEL_REPEATED = 3; - * - *
-       * TODO(sanjay): Should we add LABEL_MAP?
-       * 
- */ - LABEL_REPEATED(2, 3), - ; - - /** - * LABEL_OPTIONAL = 1; - * - *
-       * 0 is reserved for errors
-       * 
- */ - public static final int LABEL_OPTIONAL_VALUE = 1; - /** - * LABEL_REQUIRED = 2; - */ - public static final int LABEL_REQUIRED_VALUE = 2; - /** - * LABEL_REPEATED = 3; - * - *
-       * TODO(sanjay): Should we add LABEL_MAP?
-       * 
- */ - public static final int LABEL_REPEATED_VALUE = 3; - - - public final int getNumber() { return value; } - - public static Label valueOf(int value) { - switch (value) { - case 1: return LABEL_OPTIONAL; - case 2: return LABEL_REQUIRED; - case 3: return LABEL_REPEATED; - default: return null; - } - } - - public static org.apache.pekko.protobuf.Internal.EnumLiteMap