1// Protocol Buffers - Google's data interchange format 2// Copyright 2008 Google Inc. All rights reserved. 3// 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file or at 6// https://developers.google.com/open-source/licenses/bsd 7 8// Regression test for a map initialization order bug. The bug only manifests 9// when: 10// 1. A message contains map fields and is also extendable. 11// 2. There is a file-level extension defined in the same file referencing 12// the above message as the extension type. 13// 3. The program executes in the following order: 14// a. getDescriptor() is called on another message in the same file. 15// b. use protobuf reflection to access the map field. 16// The symptom is a NullPointerException being thrown. 17edition = "2023"; 18 19package map_test; 20 21option features.utf8_validation = NONE; 22option java_package = "map_test"; 23option java_outer_classname = "MapInitializationOrderTest"; 24option java_multiple_files = true; 25 26// Mirrors the structure of 27// javatests/com/google/cloud/common/logging/logging_test.proto. 28 29message Message1 { 30 map<string, bool> map_field = 1; 31 32 extensions 1000 to max; 33} 34 35extend Message1 { 36 Message1 recursive_extension = 1001; 37} 38 39message RedactAllTypes {} 40