Package com.google.protobuf

# Class RuntimeVersion

java.lang.Object
com.google.protobuf.RuntimeVersion

public final class RuntimeVersion extends Object
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 Classes
Modifier and Type
Class
Description
`static final class`
`RuntimeVersion.ProtobufRuntimeVersionException`
A runtime exception to be thrown by the version validator if version is not well defined or versions mismatch.
`static enum`
`RuntimeVersion.RuntimeDomain`
Indicates the domain of the Protobuf artifact.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final RuntimeVersion.RuntimeDomain`
`DOMAIN`
`static final int`
`MAJOR`
`static final int`
`MINOR`
`static final RuntimeVersion.RuntimeDomain`
`OSS_DOMAIN`
`static final int`
`OSS_MAJOR`
`static final int`
`OSS_MINOR`
`static final int`
`OSS_PATCH`
`static final String`
`OSS_SUFFIX`
`static final int`
`PATCH`
`static final String`
`SUFFIX`

## Method Summary

Modifier and Type
Method
Description
`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/.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### OSS_DOMAIN

public static final RuntimeVersion.RuntimeDomain OSS_DOMAIN

### OSS_MAJOR

public static final int OSS_MAJOR

See Also:
  - Constant Field Values

### OSS_MINOR

public static final int OSS_MINOR

See Also:
  - Constant Field Values

### OSS_PATCH

public static final int OSS_PATCH

See Also:
  - Constant Field Values

### OSS_SUFFIX

public static final String OSS_SUFFIX

See Also:
  - Constant Field Values

### DOMAIN

public static final RuntimeVersion.RuntimeDomain DOMAIN

### MAJOR

public static final int MAJOR

See Also:
  - Constant Field Values

### MINOR

public static final int MINOR

See Also:
  - Constant Field Values

### PATCH

public static final int PATCH

See Also:
  - Constant Field Values

### SUFFIX

public static final String SUFFIX

See Also:
  - Constant Field Values

## 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.