Package com.google.protobuf
Class RuntimeVersion
java.lang.Object
com.google.protobuf.RuntimeVersion
Provides the version of this Protobuf Java runtime, and methods for Protobuf Java gencode to
validate that versions are compatible. Fields and methods in this class should be only accessed
by related unit tests and Protobuf Java gencode, and should not be used elsewhere.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA runtime exception to be thrown by the version validator if version is not well defined or versions mismatch.static enumIndicates the domain of the Protobuf artifact. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RuntimeVersion.RuntimeDomainprivate static final Loggerstatic final int(package private) static intprivate static final intstatic final int(package private) static intstatic final RuntimeVersion.RuntimeDomainstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanstatic voidvalidateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain domain, int major, int minor, int patch, String suffix, String location) Validates that the gencode version is compatible with this runtime version according to https://protobuf.dev/support/cross-version-runtime-guarantee/.private static voidvalidateProtobufGencodeVersionImpl(RuntimeVersion.RuntimeDomain domain, int major, int minor, int patch, String suffix, String location) The actual implementation of version validation.private static StringversionString(int major, int minor, int patch, String suffix) Gets the version string given the version segments.
-
Field Details
-
OSS_DOMAIN
-
OSS_MAJOR
public static final int OSS_MAJOR- See Also:
-
OSS_MINOR
public static final int OSS_MINOR- See Also:
-
OSS_PATCH
public static final int OSS_PATCH- See Also:
-
OSS_SUFFIX
- See Also:
-
DOMAIN
-
MAJOR
public static final int MAJOR- See Also:
-
MINOR
public static final int MINOR- See Also:
-
PATCH
public static final int PATCH- See Also:
-
SUFFIX
- See Also:
-
MAX_WARNING_COUNT
private static final int MAX_WARNING_COUNT- See Also:
-
majorWarningLoggedCount
static int majorWarningLoggedCount -
minorWarningLoggedCount
static int minorWarningLoggedCount -
VERSION_STRING
-
logger
-
-
Constructor Details
-
RuntimeVersion
private RuntimeVersion()
-
-
Method Details
-
validateProtobufGencodeVersion
public static void validateProtobufGencodeVersion(RuntimeVersion.RuntimeDomain domain, int major, int minor, int patch, String suffix, String location) Validates that the gencode version is compatible with this runtime version according to https://protobuf.dev/support/cross-version-runtime-guarantee/.This method is currently only used by Protobuf Java **full version** gencode. Do not call it elsewhere.
- Parameters:
domain- the domain where Protobuf Java code was generated.major- the major version of Protobuf Java gencode.minor- the minor version of Protobuf Java gencode.patch- the micro/patch version of Protobuf Java gencode.suffix- the version suffix e.g. "-rc2", "-dev", etc.location- the debugging location e.g. generated Java class to put in the error messages.- Throws:
RuntimeVersion.ProtobufRuntimeVersionException- if versions are incompatible.
-
validateProtobufGencodeVersionImpl
private static void validateProtobufGencodeVersionImpl(RuntimeVersion.RuntimeDomain domain, int major, int minor, int patch, String suffix, String location) The actual implementation of version validation. -
versionString
Gets the version string given the version segments. -
checkDisabled
private static boolean checkDisabled()
-