nscn.polaris2.protoc.codegen
Members list
Type members
Classlikes
What a field's element is, once the proto type has been classified.
What a field's element is, once the proto type has been classified.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Emits a proto enum as a Scala 3 enum plus its companion.
Emits a proto enum as a Scala 3 enum plus its companion.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
This project's option extensions, typed as ExtensionLite.
This project's option extensions, typed as ExtensionLite.
The annotation is what makes them usable from Scala at all. hasExtension/getExtension are overloaded three ways - for GeneratedExtension, Extension and ExtensionLite - and since the generated constant's type satisfies all three, Scala reports "Ambiguous overload" where Java would pick the most specific one. Widening each constant to the least specific type leaves exactly one applicable overload.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Extensions.type
One field, with every decision the printers need already made.
One field, with every decision the printers need already made.
The reason this is a class rather than a pile of functions on FieldDescriptor is that most of the decisions - presence, packing, the Scala type, whether a TypeMapper is in play - are interdependent, and computing them once keeps the printers free of conditionals.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Resolves the effective ScalaFileOptions for a file, including package-scoped ones.
Resolves the effective ScalaFileOptions for a file, including package-scoped ones.
A file can declare options for its whole proto package (scope = PACKAGE), which then apply to every file in that package and its subpackages. That exists so a file that cannot import nscn/polaris2/protoc/options.proto - a third-party schema, say - can still be configured, and it means the options on a descriptor are not the whole story.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FileOptionsResolver.type
Emits every Scala file for one .proto.
Emits every Scala file for one .proto.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FilePrinter.type
An immutable, indentation-aware accumulator of source lines.
An immutable, indentation-aware accumulator of source lines.
Ported from ScalaPB's printer of the same name. Generated code is built by threading one of these through the generators, which keeps indentation out of every string literal and makes a generator a plain FunctionalPrinter => FunctionalPrinter.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
FunctionalPrinter.type
Everything the generators need that is not on a descriptor.
Everything the generators need that is not on a descriptor.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
The generator's command-line parameters, i.e. what protoc passes after --scala3_opt=.
The generator's command-line parameters, i.e. what protoc passes after --scala3_opt=.
These are the settings a build tool sets for a whole invocation. Anything that should vary per file, message or field belongs in nscn/polaris2/protoc/options.proto instead.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
GeneratorParams.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Literals.type
Emits a proto message as a Scala 3 case class plus its companion.
Emits a proto message as a Scala 3 case class plus its companion.
The shape is fixed by runtime/test's hand-written Person, which is checked against protobuf-java's class for the same schema. Reading that file alongside this one is the quickest way to see what any given piece here is building.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Translating proto names into Scala ones.
Translating proto names into Scala ones.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Names.type
Emits a proto oneof as a nested Scala 3 enum.
Emits a proto oneof as a nested Scala 3 enum.
This is the shape that makes a oneof pleasant to use: exhaustive matching, no "which getter is valid" question, and an explicit Empty case instead of a null.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Emits a message's parser.
Emits a message's parser.
The parser is expressed as mergeFrom(input, prev) with parseFrom delegating to it against the default instance. That is not a convenience: protobuf says a singular message field occurring twice is merged, and a parser that can continue from an existing value gets that for free, where a parseFrom-only design needs a separate hand-written merge for every message.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Fully-qualified names of everything the generated code refers to.
Fully-qualified names of everything the generated code refers to.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Runtime.type
The protoc plugin.
The protoc plugin.
Runs as a protoc-gen-scala3 executable, or in-process through the bridge. Everything interesting is in the printers; this is the entry point, the parameter parsing, and the validation that turns an unsupportable schema into a readable error rather than generated code that will not compile.
Attributes
- Supertypes
-
trait CodeGenApptrait ProtocCodeGeneratorclass Objecttrait Matchableclass Any
- Self type
-
Scala3Generator.type
The main entry point, for running the generator as a protoc plugin executable.
The main entry point, for running the generator as a protoc plugin executable.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Scala3GeneratorMain.type
How one scalar proto type is spelled in Scala and on the wire.
How one scalar proto type is spelled in Scala and on the wire.
codedName is the suffix protobuf-java uses consistently across computeXSize / writeX / readX, which is what lets the generators emit all three from one table entry.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ScalarType.type
The Well-Known Types that map to a standard library type by default.
The Well-Known Types that map to a standard library type by default.
The base of each mapping is protobuf-java's own class, so RAW needs no generated message and the mapped form needs no second implementation of the semantics.
This table is the generator's half of a pair; the other half is nscn.polaris2.protoc.runtime.WellKnownTypes, which the generator cannot link against because the two modules are on different Scala versions. The e2e tests compile generated code against the real runtime, which is what keeps the two in step.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Extensions
Extensions
Whether the field's element is a message, generated here or protobuf's own.
Whether the field's element is a message, generated here or protobuf's own.
Attributes
A value to give the field in defaultInstance when it has no constructor default.
A value to give the field in defaultInstance when it has no constructor default.
Only reached for a required or no_box field: those deliberately have no default in the constructor, so that forgetting one is a compile error, but defaultInstance still has to produce something.