Skip to content

Commit fe30f9a

Browse files
Mute the minor version warning #18096 (#18923)
PiperOrigin-RevId: 676977787 Co-authored-by: Protobuf Team Bot <[email protected]>
1 parent d82fb47 commit fe30f9a

File tree

4 files changed

+0
-45
lines changed

4 files changed

+0
-45
lines changed

java/core/src/main/java/com/google/protobuf/RuntimeVersion.java

-6
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ private static void validateProtobufGencodeVersionImpl(
109109
"Detected incompatible Protobuf Gencode/Runtime versions when loading %s: gencode %s,"
110110
+ " runtime %s. Runtime version cannot be older than the linked gencode version.",
111111
location, gencodeVersionString, VERSION_STRING));
112-
} else if (MINOR > minor || PATCH > patch) {
113-
logger.warning(
114-
String.format(
115-
" Protobuf gencode version %s is older than the runtime version %s at %s. Please"
116-
+ " avoid checked-in Protobuf gencode that can be obsolete.",
117-
gencodeVersionString, VERSION_STRING, location));
118112
}
119113

120114
// Check that runtime version suffix is the same as the gencode version suffix.

java/core/src/test/java/com/google/protobuf/RuntimeVersionTest.java

-17
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,6 @@ public void versionValidation_differentVesionSuffixDisallowed() {
146146
+ " testing.Foo");
147147
}
148148

149-
@Test
150-
public void versionValidation_warnOlderGencodeVersion() {
151-
TestUtil.TestLogHandler logHandler = new TestUtil.TestLogHandler();
152-
Logger logger = Logger.getLogger(RuntimeVersion.class.getName());
153-
logger.addHandler(logHandler);
154-
RuntimeVersion.validateProtobufGencodeVersion(
155-
RuntimeVersion.DOMAIN,
156-
RuntimeVersion.MAJOR,
157-
RuntimeVersion.MINOR - 1,
158-
RuntimeVersion.PATCH,
159-
RuntimeVersion.SUFFIX,
160-
"dummy");
161-
assertThat(logHandler.getStoredLogRecords()).hasSize(1);
162-
assertThat(logHandler.getStoredLogRecords().get(0).getMessage())
163-
.contains("Please avoid checked-in Protobuf gencode that can be obsolete.");
164-
}
165-
166149
@Test
167150
public void versionValidation_gencodeOneMajorVersionOlderWarning() {
168151
TestUtil.TestLogHandler logHandler = new TestUtil.TestLogHandler();

python/google/protobuf/internal/runtime_version_test.py

-16
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,6 @@ def test_different_suffix_disallowed(self):
118118
'foo.proto',
119119
)
120120

121-
def test_gencode_older_than_runtime_version_warning(self):
122-
with self.assertWarnsRegex(
123-
Warning,
124-
expected_regex=(
125-
'Please avoid checked-in Protobuf gencode that can be obsolete.'
126-
),
127-
):
128-
runtime_version.ValidateProtobufRuntimeVersion(
129-
runtime_version.DOMAIN,
130-
runtime_version.MAJOR,
131-
runtime_version.MINOR - 1,
132-
runtime_version.PATCH,
133-
runtime_version.SUFFIX,
134-
'foo.proto',
135-
)
136-
137121
def test_gencode_one_major_version_older_warning(self):
138122
with self.assertWarnsRegex(
139123
Warning, expected_regex='is exactly one major version older'

python/google/protobuf/runtime_version.py

-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ def ValidateProtobufRuntimeVersion(
108108
f' {location}: gencode {gen_version} runtime {version}. Runtime version'
109109
f' cannot be older than the linked gencode version. {error_prompt}'
110110
)
111-
elif MINOR > gen_minor or PATCH > gen_patch:
112-
warnings.warn(
113-
'Protobuf gencode version %s is older than the runtime version %s at'
114-
' %s. Please avoid checked-in Protobuf gencode that can be obsolete.'
115-
% (gen_version, version, location)
116-
)
117111

118112
if gen_suffix != SUFFIX:
119113
_ReportVersionError(

0 commit comments

Comments
 (0)