1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 //     * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //     * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 //     * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 package com.google.protobuf;
32 
33 import static com.google.protobuf.FieldInfo.forField;
34 import static com.google.protobuf.FieldInfo.forFieldWithEnumVerifier;
35 import static com.google.protobuf.FieldInfo.forMapField;
36 import static com.google.protobuf.FieldInfo.forOneofMemberField;
37 import static com.google.protobuf.FieldInfo.forProto2OptionalField;
38 import static com.google.protobuf.FieldInfo.forProto2RequiredField;
39 import static com.google.protobuf.FieldInfo.forRepeatedMessageField;
40 
41 import com.google.protobuf.testing.Proto2TestingLite;
42 import com.google.protobuf.testing.Proto2TestingLite.Proto2EmptyLite;
43 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite;
44 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.FieldGroup49;
45 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.FieldGroup69;
46 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.FieldGroupList51;
47 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.FieldRequiredGroup88;
48 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.RequiredNestedMessage;
49 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite.TestEnum;
50 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLiteWithExtensions;
51 import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLiteWithMaps;
52 import java.lang.reflect.Field;
53 
54 /** A factory that generates a hard-coded info for {@link Proto2MessageLite}. */
55 public final class Proto2MessageLiteInfoFactory implements MessageInfoFactory {
56   private static final Proto2MessageLiteInfoFactory instanceForRawMessageInfo =
57       new Proto2MessageLiteInfoFactory(true);
58   private static final Proto2MessageLiteInfoFactory instanceForStructuralMessageInfo =
59       new Proto2MessageLiteInfoFactory(false);
60 
getInstanceForRawMessageInfo()61   public static Proto2MessageLiteInfoFactory getInstanceForRawMessageInfo() {
62     return instanceForRawMessageInfo;
63   }
64 
getInstanceForStructuralMessageInfo()65   public static Proto2MessageLiteInfoFactory getInstanceForStructuralMessageInfo() {
66     return instanceForStructuralMessageInfo;
67   }
68 
69   private final boolean produceRawMessageInfo;
70 
Proto2MessageLiteInfoFactory(boolean produceRawMessageInfo)71   private Proto2MessageLiteInfoFactory(boolean produceRawMessageInfo) {
72     this.produceRawMessageInfo = produceRawMessageInfo;
73   }
74 
75   @Override
isSupported(Class<?> clazz)76   public boolean isSupported(Class<?> clazz) {
77     return true;
78   }
79 
80   @Override
messageInfoFor(Class<?> clazz)81   public MessageInfo messageInfoFor(Class<?> clazz) {
82     return produceRawMessageInfo ? rawMessageInfoFor(clazz) : structuralMessageInfoFor(clazz);
83   }
84 
rawMessageInfoFor(Class<?> clazz)85   private MessageInfo rawMessageInfoFor(Class<?> clazz) {
86     if (Proto2MessageLite.class.isAssignableFrom(clazz)) {
87       return newRawMessageInfoForProto2MessageLite();
88     } else {
89       throw new IllegalArgumentException("Unsupported class: " + clazz.getName());
90     }
91   }
92 
newRawMessageInfoForProto2MessageLite()93   private MessageInfo newRawMessageInfoForProto2MessageLite() {
94     java.lang.Object[] objects =
95         new java.lang.Object[] {
96           "testOneof_",
97           "testOneofCase_",
98           "bitField0_",
99           "bitField1_",
100           "fieldDouble1_",
101           "fieldFloat2_",
102           "fieldInt643_",
103           "fieldUint644_",
104           "fieldInt325_",
105           "fieldFixed646_",
106           "fieldFixed327_",
107           "fieldBool8_",
108           "fieldString9_",
109           "fieldMessage10_",
110           "fieldBytes11_",
111           "fieldUint3212_",
112           "fieldEnum13_",
113           Proto2MessageLite.TestEnum.internalGetVerifier(),
114           "fieldSfixed3214_",
115           "fieldSfixed6415_",
116           "fieldSint3216_",
117           "fieldSint6417_",
118           "fieldDoubleList18_",
119           "fieldFloatList19_",
120           "fieldInt64List20_",
121           "fieldUint64List21_",
122           "fieldInt32List22_",
123           "fieldFixed64List23_",
124           "fieldFixed32List24_",
125           "fieldBoolList25_",
126           "fieldStringList26_",
127           "fieldMessageList27_",
128           Proto2MessageLite.class,
129           "fieldBytesList28_",
130           "fieldUint32List29_",
131           "fieldEnumList30_",
132           Proto2MessageLite.TestEnum.internalGetVerifier(),
133           "fieldSfixed32List31_",
134           "fieldSfixed64List32_",
135           "fieldSint32List33_",
136           "fieldSint64List34_",
137           "fieldDoubleListPacked35_",
138           "fieldFloatListPacked36_",
139           "fieldInt64ListPacked37_",
140           "fieldUint64ListPacked38_",
141           "fieldInt32ListPacked39_",
142           "fieldFixed64ListPacked40_",
143           "fieldFixed32ListPacked41_",
144           "fieldBoolListPacked42_",
145           "fieldUint32ListPacked43_",
146           "fieldEnumListPacked44_",
147           Proto2MessageLite.TestEnum.internalGetVerifier(),
148           "fieldSfixed32ListPacked45_",
149           "fieldSfixed64ListPacked46_",
150           "fieldSint32ListPacked47_",
151           "fieldSint64ListPacked48_",
152           "fieldGroup49_",
153           "fieldGroupList51_",
154           Proto2MessageLite.FieldGroupList51.class,
155           Proto2MessageLite.class,
156           Proto2MessageLite.FieldGroup69.class,
157           "fieldRequiredDouble71_",
158           "fieldRequiredFloat72_",
159           "fieldRequiredInt6473_",
160           "fieldRequiredUint6474_",
161           "fieldRequiredInt3275_",
162           "fieldRequiredFixed6476_",
163           "fieldRequiredFixed3277_",
164           "fieldRequiredBool78_",
165           "fieldRequiredString79_",
166           "fieldRequiredMessage80_",
167           "fieldRequiredBytes81_",
168           "fieldRequiredUint3282_",
169           "fieldRequiredEnum83_",
170           Proto2MessageLite.TestEnum.internalGetVerifier(),
171           "fieldRequiredSfixed3284_",
172           "fieldRequiredSfixed6485_",
173           "fieldRequiredSint3286_",
174           "fieldRequiredSint6487_",
175           "fieldRequiredGroup88_",
176         };
177     // To update this after a proto change, run protoc on proto2_message_lite.proto and copy over
178     // the content of the generated buildMessageInfo() method here.
179     java.lang.String info =
180         "\u0001U\u0001\u0002\u0001XU\u0000 \u0015\u0001\u0000\u0000\u0002\u0001\u0001\u0003"
181             + "\u0002\u0002\u0004\u0003\u0003\u0005\u0004\u0004\u0006\u0005\u0005\u0007\u0006\u0006"
182             + "\b\u0007\u0007\t\b\b\n\u0409\t\u000b\n\n\f\u000b\u000b\r\f\f\u000e\r\r\u000f\u000e"
183             + "\u000e\u0010\u000f\u000f\u0011\u0010\u0010\u0012\u0012\u0013\u0013\u0014\u0014\u0015"
184             + "\u0015\u0016\u0016\u0017\u0017\u0018\u0018\u0019\u0019\u001a\u001a\u001b\u041b\u001c"
185             + "\u001c\u001d\u001d\u001e\u001e\u001f\u001f  !!\"\"##$$%%&&\'\'(())**++,,--..//00"
186             + "1\u0011\u00113153\u000064\u000075\u000086\u000097\u0000:8\u0000;9\u0000<:\u0000="
187             + ";\u0000>\u043c\u0000?=\u0000@>\u0000A@\u0000BA\u0000CB\u0000DC\u0000ED\u0000G\u0500"
188             + "#H\u0501$I\u0502%J\u0503&K\u0504\'L\u0505(M\u0506)N\u0507*O\u0508+P\u0509,Q\u050a"
189             + "-R\u050b.S\u050c/T\u050d0U\u050e1V\u050f2W\u05103X\u05114";
190     return new RawMessageInfo(Proto2MessageLite.getDefaultInstance(), info, objects);
191   }
192 
structuralMessageInfoFor(Class<?> clazz)193   private MessageInfo structuralMessageInfoFor(Class<?> clazz) {
194     if (Proto2MessageLite.class.isAssignableFrom(clazz)) {
195       return newMessageInfoForProto2MessageLite();
196     } else if (FieldGroup49.class.isAssignableFrom(clazz)) {
197       return newMessageInfoForFieldGroup49();
198     } else if (FieldGroupList51.class.isAssignableFrom(clazz)) {
199       return newMessageInfoForFieldGroupList51();
200     } else if (FieldGroup69.class.isAssignableFrom(clazz)) {
201       return newMessageInfoForFieldGroup69();
202     } else if (FieldRequiredGroup88.class.isAssignableFrom(clazz)) {
203       return newMessageInfoForFieldRequiredGroup88();
204     } else if (RequiredNestedMessage.class.isAssignableFrom(clazz)) {
205       return newMessageInfoForRequiredNestedMessage();
206     } else if (Proto2EmptyLite.class.isAssignableFrom(clazz)) {
207       return newMessageInfoForProto2EmptyLite();
208     } else if (Proto2MessageLiteWithExtensions.class.isAssignableFrom(clazz)) {
209       return newMessageInfoForProto2MessageLiteWithExtensions();
210     } else if (Proto2TestingLite.FieldGroup49.class.isAssignableFrom(clazz)) {
211       return newMessageInfoForExtensionFieldGroup49();
212     } else if (Proto2TestingLite.FieldGroupList51.class.isAssignableFrom(clazz)) {
213       return newMessageInfoForExtensionFieldGroupList51();
214     } else if (Proto2TestingLite.Proto2MessageLiteWithMaps.class.isAssignableFrom(clazz)) {
215       return newMessageInfoForProto2MessageLiteWithMaps();
216     } else {
217       throw new IllegalArgumentException("Unsupported class: " + clazz.getName());
218     }
219   }
220 
221   /**
222    * Creates a new hard-coded info for {@link Proto2MessageLite}. Each time this is called, we
223    * manually go through the entire process of what a message would do if it self-registered its own
224    * info, including looking up each field by name. This is done for benchmarking purposes, so that
225    * we get a more accurate representation of the time it takes to perform this process.
226    */
newMessageInfoForProto2MessageLite()227   private static StructuralMessageInfo newMessageInfoForProto2MessageLite() {
228     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(48);
229     builder.withCheckInitialized(
230         new int[] {
231           10, 27, 62, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
232         });
233     lookupFieldsByName(builder);
234     return builder.build();
235   }
236 
lookupFieldsByName(StructuralMessageInfo.Builder builder)237   private static void lookupFieldsByName(StructuralMessageInfo.Builder builder) {
238     Field bitField0 = field(Proto2MessageLite.class, "bitField0_");
239 
240     builder.withDefaultInstance(Proto2MessageLite.getDefaultInstance());
241     builder.withSyntax(ProtoSyntax.PROTO2);
242     builder.withField(
243         forProto2OptionalField(
244             field(Proto2MessageLite.class, "fieldDouble1_"),
245             1,
246             FieldType.DOUBLE,
247             bitField0,
248             0x00000001,
249             false,
250             null));
251     builder.withField(
252         forProto2OptionalField(
253             field(Proto2MessageLite.class, "fieldFloat2_"),
254             2,
255             FieldType.FLOAT,
256             bitField0,
257             0x00000002,
258             false,
259             null));
260     builder.withField(
261         forProto2OptionalField(
262             field(Proto2MessageLite.class, "fieldInt643_"),
263             3,
264             FieldType.INT64,
265             bitField0,
266             0x00000004,
267             false,
268             null));
269     builder.withField(
270         forProto2OptionalField(
271             field(Proto2MessageLite.class, "fieldUint644_"),
272             4,
273             FieldType.UINT64,
274             bitField0,
275             0x00000008,
276             false,
277             null));
278     builder.withField(
279         forProto2OptionalField(
280             field(Proto2MessageLite.class, "fieldInt325_"),
281             5,
282             FieldType.INT32,
283             bitField0,
284             0x00000010,
285             false,
286             null));
287     builder.withField(
288         forProto2OptionalField(
289             field(Proto2MessageLite.class, "fieldFixed646_"),
290             6,
291             FieldType.FIXED64,
292             bitField0,
293             0x00000020,
294             false,
295             null));
296     builder.withField(
297         forProto2OptionalField(
298             field(Proto2MessageLite.class, "fieldFixed327_"),
299             7,
300             FieldType.FIXED32,
301             bitField0,
302             0x00000040,
303             false,
304             null));
305     builder.withField(
306         forProto2OptionalField(
307             field(Proto2MessageLite.class, "fieldBool8_"),
308             8,
309             FieldType.BOOL,
310             bitField0,
311             0x00000080,
312             false,
313             null));
314     builder.withField(
315         forProto2OptionalField(
316             field(Proto2MessageLite.class, "fieldString9_"),
317             9,
318             FieldType.STRING,
319             bitField0,
320             0x00000100,
321             false,
322             null));
323     builder.withField(
324         forProto2OptionalField(
325             field(Proto2MessageLite.class, "fieldMessage10_"),
326             10,
327             FieldType.MESSAGE,
328             bitField0,
329             0x00000200,
330             false,
331             null));
332     builder.withField(
333         forProto2OptionalField(
334             field(Proto2MessageLite.class, "fieldBytes11_"),
335             11,
336             FieldType.BYTES,
337             bitField0,
338             0x00000400,
339             false,
340             null));
341     builder.withField(
342         forProto2OptionalField(
343             field(Proto2MessageLite.class, "fieldUint3212_"),
344             12,
345             FieldType.UINT32,
346             bitField0,
347             0x00000800,
348             false,
349             null));
350     builder.withField(
351         forProto2OptionalField(
352             field(Proto2MessageLite.class, "fieldEnum13_"),
353             13,
354             FieldType.ENUM,
355             bitField0,
356             0x00001000,
357             false,
358             TestEnum.internalGetVerifier()));
359     builder.withField(
360         forProto2OptionalField(
361             field(Proto2MessageLite.class, "fieldSfixed3214_"),
362             14,
363             FieldType.SFIXED32,
364             bitField0,
365             0x00002000,
366             false,
367             null));
368     builder.withField(
369         forProto2OptionalField(
370             field(Proto2MessageLite.class, "fieldSfixed6415_"),
371             15,
372             FieldType.SFIXED64,
373             bitField0,
374             0x00004000,
375             false,
376             null));
377     builder.withField(
378         forProto2OptionalField(
379             field(Proto2MessageLite.class, "fieldSint3216_"),
380             16,
381             FieldType.SINT32,
382             bitField0,
383             0x00008000,
384             false,
385             null));
386     builder.withField(
387         forProto2OptionalField(
388             field(Proto2MessageLite.class, "fieldSint6417_"),
389             17,
390             FieldType.SINT64,
391             bitField0,
392             0x00010000,
393             false,
394             null));
395     builder.withField(
396         forField(
397             field(Proto2MessageLite.class, "fieldDoubleList18_"),
398             18,
399             FieldType.DOUBLE_LIST,
400             false));
401     builder.withField(
402         forField(
403             field(Proto2MessageLite.class, "fieldFloatList19_"), 19, FieldType.FLOAT_LIST, false));
404     builder.withField(
405         forField(
406             field(Proto2MessageLite.class, "fieldInt64List20_"), 20, FieldType.INT64_LIST, false));
407     builder.withField(
408         forField(
409             field(Proto2MessageLite.class, "fieldUint64List21_"),
410             21,
411             FieldType.UINT64_LIST,
412             false));
413     builder.withField(
414         forField(
415             field(Proto2MessageLite.class, "fieldInt32List22_"), 22, FieldType.INT32_LIST, false));
416     builder.withField(
417         forField(
418             field(Proto2MessageLite.class, "fieldFixed64List23_"),
419             23,
420             FieldType.FIXED64_LIST,
421             false));
422     builder.withField(
423         forField(
424             field(Proto2MessageLite.class, "fieldFixed32List24_"),
425             24,
426             FieldType.FIXED32_LIST,
427             false));
428     builder.withField(
429         forField(
430             field(Proto2MessageLite.class, "fieldBoolList25_"), 25, FieldType.BOOL_LIST, false));
431     builder.withField(
432         forField(
433             field(Proto2MessageLite.class, "fieldStringList26_"),
434             26,
435             FieldType.STRING_LIST,
436             false));
437     builder.withField(
438         forRepeatedMessageField(
439             field(Proto2MessageLite.class, "fieldMessageList27_"),
440             27,
441             FieldType.MESSAGE_LIST,
442             Proto2MessageLite.class));
443     builder.withField(
444         forField(
445             field(Proto2MessageLite.class, "fieldBytesList28_"), 28, FieldType.BYTES_LIST, false));
446     builder.withField(
447         forField(
448             field(Proto2MessageLite.class, "fieldUint32List29_"),
449             29,
450             FieldType.UINT32_LIST,
451             false));
452     builder.withField(
453         forFieldWithEnumVerifier(
454             field(Proto2MessageLite.class, "fieldEnumList30_"),
455             30,
456             FieldType.ENUM_LIST,
457             TestEnum.internalGetVerifier()));
458     builder.withField(
459         forField(
460             field(Proto2MessageLite.class, "fieldSfixed32List31_"),
461             31,
462             FieldType.SFIXED32_LIST,
463             false));
464     builder.withField(
465         forField(
466             field(Proto2MessageLite.class, "fieldSfixed64List32_"),
467             32,
468             FieldType.SFIXED64_LIST,
469             false));
470     builder.withField(
471         forField(
472             field(Proto2MessageLite.class, "fieldSint32List33_"),
473             33,
474             FieldType.SINT32_LIST,
475             false));
476     builder.withField(
477         forField(
478             field(Proto2MessageLite.class, "fieldSint64List34_"),
479             34,
480             FieldType.SINT64_LIST,
481             false));
482     builder.withField(
483         forField(
484             field(Proto2MessageLite.class, "fieldDoubleListPacked35_"),
485             35,
486             FieldType.DOUBLE_LIST_PACKED,
487             false));
488     builder.withField(
489         forField(
490             field(Proto2MessageLite.class, "fieldFloatListPacked36_"),
491             36,
492             FieldType.FLOAT_LIST_PACKED,
493             false));
494     builder.withField(
495         forField(
496             field(Proto2MessageLite.class, "fieldInt64ListPacked37_"),
497             37,
498             FieldType.INT64_LIST_PACKED,
499             false));
500     builder.withField(
501         forField(
502             field(Proto2MessageLite.class, "fieldUint64ListPacked38_"),
503             38,
504             FieldType.UINT64_LIST_PACKED,
505             false));
506     builder.withField(
507         forField(
508             field(Proto2MessageLite.class, "fieldInt32ListPacked39_"),
509             39,
510             FieldType.INT32_LIST_PACKED,
511             false));
512     builder.withField(
513         forField(
514             field(Proto2MessageLite.class, "fieldFixed64ListPacked40_"),
515             40,
516             FieldType.FIXED64_LIST_PACKED,
517             false));
518     builder.withField(
519         forField(
520             field(Proto2MessageLite.class, "fieldFixed32ListPacked41_"),
521             41,
522             FieldType.FIXED32_LIST_PACKED,
523             false));
524     builder.withField(
525         forField(
526             field(Proto2MessageLite.class, "fieldBoolListPacked42_"),
527             42,
528             FieldType.BOOL_LIST_PACKED,
529             false));
530     builder.withField(
531         forField(
532             field(Proto2MessageLite.class, "fieldUint32ListPacked43_"),
533             43,
534             FieldType.UINT32_LIST_PACKED,
535             false));
536     builder.withField(
537         forFieldWithEnumVerifier(
538             field(Proto2MessageLite.class, "fieldEnumListPacked44_"),
539             44,
540             FieldType.ENUM_LIST_PACKED,
541             TestEnum.internalGetVerifier()));
542     builder.withField(
543         forField(
544             field(Proto2MessageLite.class, "fieldSfixed32ListPacked45_"),
545             45,
546             FieldType.SFIXED32_LIST_PACKED,
547             false));
548     builder.withField(
549         forField(
550             field(Proto2MessageLite.class, "fieldSfixed64ListPacked46_"),
551             46,
552             FieldType.SFIXED64_LIST_PACKED,
553             false));
554     builder.withField(
555         forField(
556             field(Proto2MessageLite.class, "fieldSint32ListPacked47_"),
557             47,
558             FieldType.SINT32_LIST_PACKED,
559             false));
560     builder.withField(
561         forField(
562             field(Proto2MessageLite.class, "fieldSint64ListPacked48_"),
563             48,
564             FieldType.SINT64_LIST_PACKED,
565             false));
566 
567     builder.withField(
568         forProto2OptionalField(
569             field(Proto2MessageLite.class, "fieldGroup49_"),
570             49,
571             FieldType.GROUP,
572             bitField0,
573             0x00020000,
574             false,
575             null));
576     builder.withField(
577         forRepeatedMessageField(
578             field(Proto2MessageLite.class, "fieldGroupList51_"),
579             51,
580             FieldType.GROUP_LIST,
581             Proto2MessageLite.FieldGroupList51.class));
582 
583     OneofInfo oneof =
584         new OneofInfo(
585             0,
586             field(Proto2MessageLite.class, "testOneofCase_"),
587             field(Proto2MessageLite.class, "testOneof_"));
588     builder.withField(forOneofMemberField(53, FieldType.DOUBLE, oneof, Double.class, false, null));
589     builder.withField(forOneofMemberField(54, FieldType.FLOAT, oneof, Float.class, false, null));
590     builder.withField(forOneofMemberField(55, FieldType.INT64, oneof, Long.class, false, null));
591     builder.withField(forOneofMemberField(56, FieldType.UINT64, oneof, Long.class, false, null));
592     builder.withField(forOneofMemberField(57, FieldType.INT32, oneof, Integer.class, false, null));
593     builder.withField(forOneofMemberField(58, FieldType.FIXED64, oneof, Long.class, false, null));
594     builder.withField(
595         forOneofMemberField(59, FieldType.FIXED32, oneof, Integer.class, false, null));
596     builder.withField(forOneofMemberField(60, FieldType.BOOL, oneof, Boolean.class, false, null));
597     builder.withField(forOneofMemberField(61, FieldType.STRING, oneof, String.class, false, null));
598     builder.withField(
599         forOneofMemberField(62, FieldType.MESSAGE, oneof, Proto2MessageLite.class, false, null));
600     builder.withField(
601         forOneofMemberField(63, FieldType.BYTES, oneof, ByteString.class, false, null));
602     builder.withField(forOneofMemberField(64, FieldType.UINT32, oneof, Integer.class, false, null));
603     builder.withField(
604         forOneofMemberField(65, FieldType.SFIXED32, oneof, Integer.class, false, null));
605     builder.withField(forOneofMemberField(66, FieldType.SFIXED64, oneof, Long.class, false, null));
606     builder.withField(forOneofMemberField(67, FieldType.SINT32, oneof, Integer.class, false, null));
607     builder.withField(forOneofMemberField(68, FieldType.SINT64, oneof, Long.class, false, null));
608     builder.withField(
609         forOneofMemberField(
610             69, FieldType.GROUP, oneof, Proto2MessageLite.FieldGroup69.class, false, null));
611 
612     Field bitField1 = field(Proto2MessageLite.class, "bitField1_");
613     builder.withField(
614         forProto2RequiredField(
615             field(Proto2MessageLite.class, "fieldRequiredDouble71_"),
616             71,
617             FieldType.DOUBLE,
618             bitField1,
619             0x00000008,
620             false,
621             null));
622     builder.withField(
623         forProto2RequiredField(
624             field(Proto2MessageLite.class, "fieldRequiredFloat72_"),
625             72,
626             FieldType.FLOAT,
627             bitField1,
628             0x00000010,
629             false,
630             null));
631     builder.withField(
632         forProto2RequiredField(
633             field(Proto2MessageLite.class, "fieldRequiredInt6473_"),
634             73,
635             FieldType.INT64,
636             bitField1,
637             0x00000020,
638             false,
639             null));
640     builder.withField(
641         forProto2RequiredField(
642             field(Proto2MessageLite.class, "fieldRequiredUint6474_"),
643             74,
644             FieldType.UINT64,
645             bitField1,
646             0x00000040,
647             false,
648             null));
649     builder.withField(
650         forProto2RequiredField(
651             field(Proto2MessageLite.class, "fieldRequiredInt3275_"),
652             75,
653             FieldType.INT32,
654             bitField1,
655             0x00000080,
656             false,
657             null));
658     builder.withField(
659         forProto2RequiredField(
660             field(Proto2MessageLite.class, "fieldRequiredFixed6476_"),
661             76,
662             FieldType.FIXED64,
663             bitField1,
664             0x00000100,
665             false,
666             null));
667     builder.withField(
668         forProto2RequiredField(
669             field(Proto2MessageLite.class, "fieldRequiredFixed3277_"),
670             77,
671             FieldType.FIXED32,
672             bitField1,
673             0x00000200,
674             false,
675             null));
676     builder.withField(
677         forProto2RequiredField(
678             field(Proto2MessageLite.class, "fieldRequiredBool78_"),
679             78,
680             FieldType.BOOL,
681             bitField1,
682             0x00000400,
683             false,
684             null));
685     builder.withField(
686         forProto2RequiredField(
687             field(Proto2MessageLite.class, "fieldRequiredString79_"),
688             79,
689             FieldType.STRING,
690             bitField1,
691             0x00000800,
692             false,
693             null));
694     builder.withField(
695         forProto2RequiredField(
696             field(Proto2MessageLite.class, "fieldRequiredMessage80_"),
697             80,
698             FieldType.MESSAGE,
699             bitField1,
700             0x00001000,
701             false,
702             null));
703     builder.withField(
704         forProto2RequiredField(
705             field(Proto2MessageLite.class, "fieldRequiredBytes81_"),
706             81,
707             FieldType.BYTES,
708             bitField1,
709             0x00002000,
710             false,
711             null));
712     builder.withField(
713         forProto2RequiredField(
714             field(Proto2MessageLite.class, "fieldRequiredUint3282_"),
715             82,
716             FieldType.UINT32,
717             bitField1,
718             0x00004000,
719             false,
720             null));
721     builder.withField(
722         forProto2RequiredField(
723             field(Proto2MessageLite.class, "fieldRequiredEnum83_"),
724             83,
725             FieldType.ENUM,
726             bitField1,
727             0x00008000,
728             false,
729             TestEnum.internalGetVerifier()));
730     builder.withField(
731         forProto2RequiredField(
732             field(Proto2MessageLite.class, "fieldRequiredSfixed3284_"),
733             84,
734             FieldType.SFIXED32,
735             bitField1,
736             0x00010000,
737             false,
738             null));
739     builder.withField(
740         forProto2RequiredField(
741             field(Proto2MessageLite.class, "fieldRequiredSfixed6485_"),
742             85,
743             FieldType.SFIXED64,
744             bitField1,
745             0x00020000,
746             false,
747             null));
748     builder.withField(
749         forProto2RequiredField(
750             field(Proto2MessageLite.class, "fieldRequiredSint3286_"),
751             86,
752             FieldType.SINT32,
753             bitField1,
754             0x00040000,
755             false,
756             null));
757     builder.withField(
758         forProto2RequiredField(
759             field(Proto2MessageLite.class, "fieldRequiredSint6487_"),
760             87,
761             FieldType.SINT64,
762             bitField1,
763             0x00080000,
764             false,
765             null));
766     builder.withField(
767         forProto2RequiredField(
768             field(Proto2MessageLite.class, "fieldRequiredGroup88_"),
769             88,
770             FieldType.GROUP,
771             bitField1,
772             0x00100000,
773             false,
774             null));
775   }
776 
newMessageInfoForFieldGroup49()777   private static StructuralMessageInfo newMessageInfoForFieldGroup49() {
778     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
779     builder.withSyntax(ProtoSyntax.PROTO2);
780     Field bitField0 = field(FieldGroup49.class, "bitField0_");
781     builder.withField(
782         forProto2OptionalField(
783             field(FieldGroup49.class, "fieldInt3250_"),
784             50,
785             FieldType.INT32,
786             bitField0,
787             0x00000001,
788             false,
789             null));
790     return builder.build();
791   }
792 
newMessageInfoForFieldGroupList51()793   private static StructuralMessageInfo newMessageInfoForFieldGroupList51() {
794     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
795     builder.withSyntax(ProtoSyntax.PROTO2);
796     Field bitField0 = field(FieldGroup49.class, "bitField0_");
797     builder.withField(
798         forProto2OptionalField(
799             field(FieldGroupList51.class, "fieldInt3252_"),
800             52,
801             FieldType.INT32,
802             bitField0,
803             0x00000001,
804             false,
805             null));
806     return builder.build();
807   }
808 
newMessageInfoForFieldGroup69()809   private static StructuralMessageInfo newMessageInfoForFieldGroup69() {
810     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
811     builder.withSyntax(ProtoSyntax.PROTO2);
812     Field bitField0 = field(FieldGroup69.class, "bitField0_");
813     builder.withField(
814         forProto2OptionalField(
815             field(FieldGroup69.class, "fieldInt3270_"),
816             70,
817             FieldType.INT32,
818             bitField0,
819             0x00000001,
820             false,
821             null));
822     return builder.build();
823   }
824 
newMessageInfoForRequiredNestedMessage()825   private static StructuralMessageInfo newMessageInfoForRequiredNestedMessage() {
826     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
827     builder.withSyntax(ProtoSyntax.PROTO2);
828     Field bitField0 = field(RequiredNestedMessage.class, "bitField0_");
829     builder.withField(
830         forProto2OptionalField(
831             field(RequiredNestedMessage.class, "value_"),
832             1,
833             FieldType.INT32,
834             bitField0,
835             0x00000001,
836             false,
837             null));
838     return builder.build();
839   }
840 
newMessageInfoForFieldRequiredGroup88()841   private static StructuralMessageInfo newMessageInfoForFieldRequiredGroup88() {
842     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
843     builder.withSyntax(ProtoSyntax.PROTO2);
844     Field bitField0 = field(FieldRequiredGroup88.class, "bitField0_");
845     builder.withField(
846         forProto2OptionalField(
847             field(FieldRequiredGroup88.class, "fieldInt3289_"),
848             89,
849             FieldType.INT32,
850             bitField0,
851             0x00000001,
852             false,
853             null));
854     return builder.build();
855   }
856 
newMessageInfoForProto2EmptyLite()857   private static StructuralMessageInfo newMessageInfoForProto2EmptyLite() {
858     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
859     builder.withSyntax(ProtoSyntax.PROTO2);
860     return builder.build();
861   }
862 
newMessageInfoForProto2MessageLiteWithExtensions()863   private static StructuralMessageInfo newMessageInfoForProto2MessageLiteWithExtensions() {
864     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(0);
865     builder.withSyntax(ProtoSyntax.PROTO2);
866     return builder.build();
867   }
868 
newMessageInfoForExtensionFieldGroup49()869   private static StructuralMessageInfo newMessageInfoForExtensionFieldGroup49() {
870     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
871     builder.withSyntax(ProtoSyntax.PROTO2);
872     Field bitField0 = field(Proto2TestingLite.FieldGroup49.class, "bitField0_");
873     builder.withField(
874         forProto2OptionalField(
875             field(Proto2TestingLite.FieldGroup49.class, "fieldInt3250_"),
876             50,
877             FieldType.INT32,
878             bitField0,
879             0x00000001,
880             false,
881             null));
882     return builder.build();
883   }
884 
newMessageInfoForExtensionFieldGroupList51()885   private static StructuralMessageInfo newMessageInfoForExtensionFieldGroupList51() {
886     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder(1);
887     builder.withSyntax(ProtoSyntax.PROTO2);
888     Field bitField0 = field(Proto2TestingLite.FieldGroup49.class, "bitField0_");
889     builder.withField(
890         forProto2OptionalField(
891             field(Proto2TestingLite.FieldGroupList51.class, "fieldInt3252_"),
892             52,
893             FieldType.INT32,
894             bitField0,
895             0x00000001,
896             false,
897             null));
898     return builder.build();
899   }
900 
901 
newMessageInfoForProto2MessageLiteWithMaps()902   private static StructuralMessageInfo newMessageInfoForProto2MessageLiteWithMaps() {
903     StructuralMessageInfo.Builder builder = StructuralMessageInfo.newBuilder();
904     builder.withCheckInitialized(
905         new int[] {
906           10, 27, 44, 61, 78, 95, 112, 129, 146, 163, 180, 197,
907         });
908     builder.withSyntax(ProtoSyntax.PROTO2);
909     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_bool_1", 1));
910     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_bytes_2", 2));
911     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_double_3", 3));
912     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_enum_4", 4));
913     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_fixed32_5", 5));
914     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_fixed64_6", 6));
915     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_float_7", 7));
916     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_int32_8", 8));
917     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_int64_9", 9));
918     builder.withField(
919         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_message_10", 10));
920     builder.withField(
921         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_sfixed32_11", 11));
922     builder.withField(
923         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_sfixed64_12", 12));
924     builder.withField(
925         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_sint32_13", 13));
926     builder.withField(
927         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_sint64_14", 14));
928     builder.withField(
929         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_string_15", 15));
930     builder.withField(
931         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_uint32_16", 16));
932     builder.withField(
933         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_bool_uint64_17", 17));
934     builder.withField(
935         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_bool_18", 18));
936     builder.withField(
937         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_bytes_19", 19));
938     builder.withField(
939         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_double_20", 20));
940     builder.withField(
941         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_enum_21", 21));
942     builder.withField(
943         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_fixed32_22", 22));
944     builder.withField(
945         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_fixed64_23", 23));
946     builder.withField(
947         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_float_24", 24));
948     builder.withField(
949         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_int32_25", 25));
950     builder.withField(
951         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_int64_26", 26));
952     builder.withField(
953         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_message_27", 27));
954     builder.withField(
955         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_sfixed32_28", 28));
956     builder.withField(
957         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_sfixed64_29", 29));
958     builder.withField(
959         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_sint32_30", 30));
960     builder.withField(
961         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_sint64_31", 31));
962     builder.withField(
963         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_string_32", 32));
964     builder.withField(
965         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_uint32_33", 33));
966     builder.withField(
967         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed32_uint64_34", 34));
968     builder.withField(
969         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_bool_35", 35));
970     builder.withField(
971         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_bytes_36", 36));
972     builder.withField(
973         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_double_37", 37));
974     builder.withField(
975         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_enum_38", 38));
976     builder.withField(
977         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_fixed32_39", 39));
978     builder.withField(
979         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_fixed64_40", 40));
980     builder.withField(
981         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_float_41", 41));
982     builder.withField(
983         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_int32_42", 42));
984     builder.withField(
985         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_int64_43", 43));
986     builder.withField(
987         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_message_44", 44));
988     builder.withField(
989         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_sfixed32_45", 45));
990     builder.withField(
991         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_sfixed64_46", 46));
992     builder.withField(
993         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_sint32_47", 47));
994     builder.withField(
995         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_sint64_48", 48));
996     builder.withField(
997         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_string_49", 49));
998     builder.withField(
999         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_uint32_50", 50));
1000     builder.withField(
1001         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_fixed64_uint64_51", 51));
1002     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_bool_52", 52));
1003     builder.withField(
1004         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_bytes_53", 53));
1005     builder.withField(
1006         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_double_54", 54));
1007     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_enum_55", 55));
1008     builder.withField(
1009         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_fixed32_56", 56));
1010     builder.withField(
1011         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_fixed64_57", 57));
1012     builder.withField(
1013         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_float_58", 58));
1014     builder.withField(
1015         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_int32_59", 59));
1016     builder.withField(
1017         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_int64_60", 60));
1018     builder.withField(
1019         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_message_61", 61));
1020     builder.withField(
1021         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_sfixed32_62", 62));
1022     builder.withField(
1023         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_sfixed64_63", 63));
1024     builder.withField(
1025         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_sint32_64", 64));
1026     builder.withField(
1027         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_sint64_65", 65));
1028     builder.withField(
1029         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_string_66", 66));
1030     builder.withField(
1031         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_uint32_67", 67));
1032     builder.withField(
1033         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int32_uint64_68", 68));
1034     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_bool_69", 69));
1035     builder.withField(
1036         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_bytes_70", 70));
1037     builder.withField(
1038         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_double_71", 71));
1039     builder.withField(mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_enum_72", 72));
1040     builder.withField(
1041         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_fixed32_73", 73));
1042     builder.withField(
1043         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_fixed64_74", 74));
1044     builder.withField(
1045         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_float_75", 75));
1046     builder.withField(
1047         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_int32_76", 76));
1048     builder.withField(
1049         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_int64_77", 77));
1050     builder.withField(
1051         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_message_78", 78));
1052     builder.withField(
1053         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_sfixed32_79", 79));
1054     builder.withField(
1055         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_sfixed64_80", 80));
1056     builder.withField(
1057         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_sint32_81", 81));
1058     builder.withField(
1059         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_sint64_82", 82));
1060     builder.withField(
1061         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_string_83", 83));
1062     builder.withField(
1063         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_uint32_84", 84));
1064     builder.withField(
1065         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_int64_uint64_85", 85));
1066     builder.withField(
1067         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_bool_86", 86));
1068     builder.withField(
1069         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_bytes_87", 87));
1070     builder.withField(
1071         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_double_88", 88));
1072     builder.withField(
1073         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_enum_89", 89));
1074     builder.withField(
1075         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_fixed32_90", 90));
1076     builder.withField(
1077         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_fixed64_91", 91));
1078     builder.withField(
1079         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_float_92", 92));
1080     builder.withField(
1081         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_int32_93", 93));
1082     builder.withField(
1083         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_int64_94", 94));
1084     builder.withField(
1085         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_message_95", 95));
1086     builder.withField(
1087         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_sfixed32_96", 96));
1088     builder.withField(
1089         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_sfixed64_97", 97));
1090     builder.withField(
1091         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_sint32_98", 98));
1092     builder.withField(
1093         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_sint64_99", 99));
1094     builder.withField(
1095         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_string_100", 100));
1096     builder.withField(
1097         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_uint32_101", 101));
1098     builder.withField(
1099         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed32_uint64_102", 102));
1100     builder.withField(
1101         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_bool_103", 103));
1102     builder.withField(
1103         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_bytes_104", 104));
1104     builder.withField(
1105         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_double_105", 105));
1106     builder.withField(
1107         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_enum_106", 106));
1108     builder.withField(
1109         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_fixed32_107", 107));
1110     builder.withField(
1111         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_fixed64_108", 108));
1112     builder.withField(
1113         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_float_109", 109));
1114     builder.withField(
1115         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_int32_110", 110));
1116     builder.withField(
1117         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_int64_111", 111));
1118     builder.withField(
1119         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_message_112", 112));
1120     builder.withField(
1121         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_sfixed32_113", 113));
1122     builder.withField(
1123         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_sfixed64_114", 114));
1124     builder.withField(
1125         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_sint32_115", 115));
1126     builder.withField(
1127         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_sint64_116", 116));
1128     builder.withField(
1129         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_string_117", 117));
1130     builder.withField(
1131         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_uint32_118", 118));
1132     builder.withField(
1133         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sfixed64_uint64_119", 119));
1134     builder.withField(
1135         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_bool_120", 120));
1136     builder.withField(
1137         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_bytes_121", 121));
1138     builder.withField(
1139         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_double_122", 122));
1140     builder.withField(
1141         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_enum_123", 123));
1142     builder.withField(
1143         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_fixed32_124", 124));
1144     builder.withField(
1145         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_fixed64_125", 125));
1146     builder.withField(
1147         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_float_126", 126));
1148     builder.withField(
1149         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_int32_127", 127));
1150     builder.withField(
1151         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_int64_128", 128));
1152     builder.withField(
1153         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_message_129", 129));
1154     builder.withField(
1155         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_sfixed32_130", 130));
1156     builder.withField(
1157         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_sfixed64_131", 131));
1158     builder.withField(
1159         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_sint32_132", 132));
1160     builder.withField(
1161         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_sint64_133", 133));
1162     builder.withField(
1163         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_string_134", 134));
1164     builder.withField(
1165         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_uint32_135", 135));
1166     builder.withField(
1167         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint32_uint64_136", 136));
1168     builder.withField(
1169         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_bool_137", 137));
1170     builder.withField(
1171         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_bytes_138", 138));
1172     builder.withField(
1173         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_double_139", 139));
1174     builder.withField(
1175         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_enum_140", 140));
1176     builder.withField(
1177         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_fixed32_141", 141));
1178     builder.withField(
1179         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_fixed64_142", 142));
1180     builder.withField(
1181         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_float_143", 143));
1182     builder.withField(
1183         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_int32_144", 144));
1184     builder.withField(
1185         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_int64_145", 145));
1186     builder.withField(
1187         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_message_146", 146));
1188     builder.withField(
1189         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_sfixed32_147", 147));
1190     builder.withField(
1191         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_sfixed64_148", 148));
1192     builder.withField(
1193         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_sint32_149", 149));
1194     builder.withField(
1195         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_sint64_150", 150));
1196     builder.withField(
1197         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_string_151", 151));
1198     builder.withField(
1199         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_uint32_152", 152));
1200     builder.withField(
1201         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_sint64_uint64_153", 153));
1202     builder.withField(
1203         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_bool_154", 154));
1204     builder.withField(
1205         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_bytes_155", 155));
1206     builder.withField(
1207         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_double_156", 156));
1208     builder.withField(
1209         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_enum_157", 157));
1210     builder.withField(
1211         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_fixed32_158", 158));
1212     builder.withField(
1213         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_fixed64_159", 159));
1214     builder.withField(
1215         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_float_160", 160));
1216     builder.withField(
1217         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_int32_161", 161));
1218     builder.withField(
1219         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_int64_162", 162));
1220     builder.withField(
1221         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_message_163", 163));
1222     builder.withField(
1223         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_sfixed32_164", 164));
1224     builder.withField(
1225         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_sfixed64_165", 165));
1226     builder.withField(
1227         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_sint32_166", 166));
1228     builder.withField(
1229         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_sint64_167", 167));
1230     builder.withField(
1231         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_string_168", 168));
1232     builder.withField(
1233         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_uint32_169", 169));
1234     builder.withField(
1235         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_string_uint64_170", 170));
1236     builder.withField(
1237         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_bool_171", 171));
1238     builder.withField(
1239         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_bytes_172", 172));
1240     builder.withField(
1241         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_double_173", 173));
1242     builder.withField(
1243         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_enum_174", 174));
1244     builder.withField(
1245         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_fixed32_175", 175));
1246     builder.withField(
1247         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_fixed64_176", 176));
1248     builder.withField(
1249         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_float_177", 177));
1250     builder.withField(
1251         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_int32_178", 178));
1252     builder.withField(
1253         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_int64_179", 179));
1254     builder.withField(
1255         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_message_180", 180));
1256     builder.withField(
1257         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_sfixed32_181", 181));
1258     builder.withField(
1259         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_sfixed64_182", 182));
1260     builder.withField(
1261         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_sint32_183", 183));
1262     builder.withField(
1263         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_sint64_184", 184));
1264     builder.withField(
1265         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_string_185", 185));
1266     builder.withField(
1267         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_uint32_186", 186));
1268     builder.withField(
1269         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint32_uint64_187", 187));
1270     builder.withField(
1271         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_bool_188", 188));
1272     builder.withField(
1273         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_bytes_189", 189));
1274     builder.withField(
1275         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_double_190", 190));
1276     builder.withField(
1277         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_enum_191", 191));
1278     builder.withField(
1279         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_fixed32_192", 192));
1280     builder.withField(
1281         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_fixed64_193", 193));
1282     builder.withField(
1283         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_float_194", 194));
1284     builder.withField(
1285         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_int32_195", 195));
1286     builder.withField(
1287         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_int64_196", 196));
1288     builder.withField(
1289         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_message_197", 197));
1290     builder.withField(
1291         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_sfixed32_198", 198));
1292     builder.withField(
1293         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_sfixed64_199", 199));
1294     builder.withField(
1295         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_sint32_200", 200));
1296     builder.withField(
1297         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_sint64_201", 201));
1298     builder.withField(
1299         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_string_202", 202));
1300     builder.withField(
1301         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_uint32_203", 203));
1302     builder.withField(
1303         mapFieldInfo(Proto2MessageLiteWithMaps.class, "field_map_uint64_uint64_204", 204));
1304 
1305     return builder.build();
1306   }
1307 
field(Class<?> clazz, String name)1308   private static Field field(Class<?> clazz, String name) {
1309     try {
1310       return clazz.getDeclaredField(name);
1311     } catch (NoSuchFieldException | SecurityException e) {
1312       throw new RuntimeException(e);
1313     }
1314   }
1315 
mapFieldInfo(Class<?> clazz, String fieldName, int fieldNumber)1316   private static FieldInfo mapFieldInfo(Class<?> clazz, String fieldName, int fieldNumber) {
1317     try {
1318       return forMapField(
1319           field(clazz, SchemaUtil.toCamelCase(fieldName, false) + "_"),
1320           fieldNumber,
1321           SchemaUtil.getMapDefaultEntry(clazz, fieldName),
1322           fieldName.contains("_enum_") ? TestEnum.internalGetVerifier() : null);
1323     } catch (Throwable t) {
1324       throw new RuntimeException(t);
1325     }
1326   }
1327 }
1328