Adds GeneratedMessageLite to j2objc protobuf runtime..

PiperOrigin-RevId: 284989825
diff --git a/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.h b/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.h
index 0ecea0a..74ae4cc 100644
--- a/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.h
+++ b/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.h
@@ -78,4 +78,4 @@
 
 CF_EXTERN_C_END
 
-#endif // __ComGoogleProtobufExtensionRegistryLite_H__
+#endif  // __ComGoogleProtobufExtensionRegistryLite_H__
diff --git a/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.mm b/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.mm
index bcee10a..494ef2d 100644
--- a/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.mm
+++ b/protobuf/runtime/src/com/google/protobuf/ExtensionRegistryLite.mm
@@ -35,6 +35,8 @@
 #import "com/google/protobuf/Descriptors_PackagePrivate.h"
 #import "com/google/protobuf/Extension.h"
 
+#include "J2ObjC_source.h"
+
 typedef std::pair<const CGPDescriptor *, jint> ExtensionRegistryKey;
 typedef std::map<ExtensionRegistryKey, CGPFieldDescriptor *> ExtensionRegistryMap;
 
@@ -62,6 +64,11 @@
   return self;
 }
 
+- (instancetype)initWithBoolean:(jboolean)empty {
+  ComGoogleProtobufExtensionRegistryLite_initWithBoolean_(self, empty);
+  return self;
+}
+
 + (void)initialize {
   if (self == [CGPExtensionRegistryLite class]) {
     CGPExtensionRegistryLite_EMPTY_ = [[CGPExtensionRegistryLite alloc] init];
@@ -87,16 +94,6 @@
   registry->map_[ExtensionRegistryKey(containingType, CGPFieldGetNumber(field))] = field;
 }
 
-CGPFieldDescriptor *CGPExtensionRegistryFind(
-    CGPExtensionRegistryLite *registry, CGPDescriptor *descriptor, jint fieldNumber) {
-  ExtensionRegistryMap *map = &registry->map_;
-  ExtensionRegistryMap::iterator it = map->find(ExtensionRegistryKey(descriptor, fieldNumber));
-  if (it != map->end()) {
-    return it->second;
-  }
-  return nil;
-}
-
 void ComGoogleProtobufExtensionRegistryLite_initWithBoolean_(
     ComGoogleProtobufExtensionRegistryLite *self, jboolean empty) {
   NSObject_init(self);
@@ -109,4 +106,14 @@
   return [self autorelease];
 }
 
+CGPFieldDescriptor *CGPExtensionRegistryFind(
+    CGPExtensionRegistryLite *registry, CGPDescriptor *descriptor, jint fieldNumber) {
+  ExtensionRegistryMap *map = &registry->map_;
+  ExtensionRegistryMap::iterator it = map->find(ExtensionRegistryKey(descriptor, fieldNumber));
+  if (it != map->end()) {
+    return it->second;
+  }
+  return nil;
+}
+
 J2OBJC_CLASS_TYPE_LITERAL_SOURCE(ComGoogleProtobufExtensionRegistryLite)
diff --git a/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm b/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm
index 62b9c88..10b1c5a 100644
--- a/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm
+++ b/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm
@@ -42,6 +42,7 @@
 #include "com/google/protobuf/ByteString.h"
 #include "com/google/protobuf/CodedInputStream.h"
 #include "com/google/protobuf/Descriptors_PackagePrivate.h"
+#include "com/google/protobuf/ExtensionRegistry.h"
 #include "com/google/protobuf/ExtensionRegistryLite.h"
 #include "com/google/protobuf/Internal.h"
 #include "com/google/protobuf/InvalidProtocolBufferException.h"
@@ -1698,6 +1699,15 @@
   if (registry != nil && extensionMap != NULL) {
     uint32_t fieldNumber = CGPWireFormatGetTagFieldNumber(tag);
     CGPFieldDescriptor *field = CGPExtensionRegistryFind(registry, descriptor, fieldNumber);
+    if (!field && [registry isKindOfClass:[ComGoogleProtobufExtensionRegistry class]]) {
+      ComGoogleProtobufExtensionRegistry_ExtensionInfo *extension =
+          [(ComGoogleProtobufExtensionRegistry *)registry
+              findExtensionByNumberWithComGoogleProtobufDescriptors_Descriptor:descriptor
+                                                                       withInt:fieldNumber];
+      if (extension) {
+        field = extension->descriptor_;
+      }
+    }
     if (field != nil && field->tag_ == tag) {
       return MergeExtensionFromStream(stream, field, registry, extensionMap);
     }
diff --git a/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.h b/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.h
new file mode 100644
index 0000000..3db1f06
--- /dev/null
+++ b/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.h
@@ -0,0 +1,153 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef __ComGoogleProtobufGeneratedMessageLite_H__
+#define __ComGoogleProtobufGeneratedMessageLite_H__
+
+#include "J2ObjC_header.h"
+#include "com/google/protobuf/AbstractMessageLite.h"
+#include "com/google/protobuf/ExtensionLite.h"
+
+@class ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor;
+@class ComGoogleProtobufWireFormat_FieldType;
+@class ComGoogleProtobufWireFormat_FieldType;
+@class IOSClass;
+@protocol ComGoogleProtobufInternal_EnumLiteMap;
+@protocol ComGoogleProtobufMessageLite;
+
+@interface ComGoogleProtobufGeneratedMessageLite : ComGoogleProtobufAbstractMessageLite
+
+#pragma mark Public
+
+- (instancetype)init;
+
+@end
+
+J2OBJC_EMPTY_STATIC_INIT(ComGoogleProtobufGeneratedMessageLite)
+
+FOUNDATION_EXPORT void ComGoogleProtobufGeneratedMessageLite_init(
+    ComGoogleProtobufGeneratedMessageLite *self);
+
+J2OBJC_TYPE_LITERAL_HEADER(ComGoogleProtobufGeneratedMessageLite)
+
+
+@interface ComGoogleProtobufGeneratedMessageLite_GeneratedExtension
+    : ComGoogleProtobufExtensionLite {
+ @public
+  id<ComGoogleProtobufMessageLite> containingTypeDefaultInstance_;
+  id defaultValue_;
+  id<ComGoogleProtobufMessageLite> messageDefaultInstance_;
+  ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *descriptor_;
+}
+
+#pragma mark Public
+
+- (id<ComGoogleProtobufMessageLite>)getContainingTypeDefaultInstance;
+
+- (id)getDefaultValue;
+
+- (ComGoogleProtobufWireFormat_FieldType *)getLiteType;
+
+- (id<ComGoogleProtobufMessageLite>)getMessageDefaultInstance;
+
+- (jint)getNumber;
+
+- (jboolean)isRepeated;
+
+#pragma mark Package-Private
+
+- (instancetype)initWithComGoogleProtobufMessageLite:
+                    (id<ComGoogleProtobufMessageLite>)containingTypeDefaultInstance
+                                                           withId:(id)defaultValue
+                                 withComGoogleProtobufMessageLite:
+                                     (id<ComGoogleProtobufMessageLite>)messageDefaultInstance
+    withComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor:
+        (ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)descriptor
+                                                     withIOSClass:(IOSClass *)singularType;
+
+// Disallowed inherited constructor, do not use.
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+J2OBJC_EMPTY_STATIC_INIT(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension)
+
+J2OBJC_FIELD_SETTER(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension,
+                    containingTypeDefaultInstance_, id<ComGoogleProtobufMessageLite>)
+J2OBJC_FIELD_SETTER(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension, defaultValue_, id)
+J2OBJC_FIELD_SETTER(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension,
+                    messageDefaultInstance_, id<ComGoogleProtobufMessageLite>)
+J2OBJC_FIELD_SETTER(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension, descriptor_,
+                    ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)
+
+J2OBJC_TYPE_LITERAL_HEADER(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension)
+
+
+@interface ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor : NSObject {
+ @public
+  jint number_;
+  ComGoogleProtobufWireFormat_FieldType *type_;
+  jboolean isRepeated_;
+  jboolean isPacked_;
+}
+
+#pragma mark Public
+
+- (ComGoogleProtobufWireFormat_FieldType *)getLiteType;
+
+- (jint)getNumber;
+
+- (jboolean)isPacked;
+
+- (jboolean)isRepeated;
+
+#pragma mark Package-Private
+
+- (instancetype)initWithComGoogleProtobufInternal_EnumLiteMap:
+                    (id<ComGoogleProtobufInternal_EnumLiteMap>)enumTypeMap
+                                                      withInt:(jint)number
+                    withComGoogleProtobufWireFormat_FieldType:
+                        (ComGoogleProtobufWireFormat_FieldType *)type
+                                                  withBoolean:(jboolean)isRepeated
+                                                  withBoolean:(jboolean)isPacked;
+
+// Disallowed inherited constructors, do not use.
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+J2OBJC_EMPTY_STATIC_INIT(ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor)
+
+J2OBJC_FIELD_SETTER(ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor, type_,
+                    ComGoogleProtobufWireFormat_FieldType *)
+
+J2OBJC_TYPE_LITERAL_HEADER(ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor)
+
+#endif  // __ComGoogleProtobufGeneratedMessageLite_H__
diff --git a/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.m b/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.m
new file mode 100644
index 0000000..9fef776
--- /dev/null
+++ b/protobuf/runtime/src/com/google/protobuf/GeneratedMessageLite.m
@@ -0,0 +1,134 @@
+//
+//  Generated by the J2ObjC translator.  DO NOT EDIT!
+//  source: GeneratedMessageLite.java
+//
+
+#include "com/google/protobuf/GeneratedMessageLite.h"
+#include "IOSClass.h"
+#include "J2ObjC_source.h"
+#include "com/google/protobuf/AbstractMessageLite.h"
+#include "com/google/protobuf/ExtensionLite.h"
+#include "com/google/protobuf/Internal.h"
+#include "com/google/protobuf/MessageLite.h"
+#include "com/google/protobuf/WireFormat.h"
+#include "java/lang/IllegalArgumentException.h"
+
+@implementation ComGoogleProtobufGeneratedMessageLite
+
+J2OBJC_IGNORE_DESIGNATED_BEGIN
+- (instancetype)init {
+  ComGoogleProtobufGeneratedMessageLite_init(self);
+  return self;
+}
+J2OBJC_IGNORE_DESIGNATED_END
+
+@end
+
+void ComGoogleProtobufGeneratedMessageLite_init(ComGoogleProtobufGeneratedMessageLite *self) {
+  ComGoogleProtobufAbstractMessageLite_init(self);
+}
+
+J2OBJC_CLASS_TYPE_LITERAL_SOURCE(ComGoogleProtobufGeneratedMessageLite)
+
+
+@implementation ComGoogleProtobufGeneratedMessageLite_GeneratedExtension
+
+- (instancetype)initWithComGoogleProtobufMessageLite:
+                    (id<ComGoogleProtobufMessageLite>)containingTypeDefaultInstance
+                                                       withId:(id)defaultValue
+                             withComGoogleProtobufMessageLite:
+                                 (id<ComGoogleProtobufMessageLite>)messageDefaultInstance
+withComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor:
+    (ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)descriptor
+                                                 withIOSClass:(IOSClass *)singularType {
+  if (!containingTypeDefaultInstance) {
+    @throw create_JavaLangIllegalArgumentException_initWithNSString_(
+        @"Null containingTypeDefaultInstance");
+  }
+  JreStrongAssign(&self->containingTypeDefaultInstance_, containingTypeDefaultInstance);
+  JreStrongAssign(&self->defaultValue_, defaultValue);
+  JreStrongAssign(&self->messageDefaultInstance_, messageDefaultInstance);
+  JreStrongAssign(&self->descriptor_, descriptor);
+  return self;
+}
+
+- (id<ComGoogleProtobufMessageLite>)getContainingTypeDefaultInstance {
+  return containingTypeDefaultInstance_;
+}
+
+- (jint)getNumber {
+  return [(
+      (ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)nil_chk(descriptor_)) getNumber];
+}
+
+- (id<ComGoogleProtobufMessageLite>)getMessageDefaultInstance {
+  return messageDefaultInstance_;
+}
+
+- (ComGoogleProtobufWireFormat_FieldType *)getLiteType {
+  return [((ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)nil_chk(
+      descriptor_)) getLiteType];
+}
+
+- (id)getDefaultValue {
+  return defaultValue_;
+}
+
+- (jboolean)isRepeated {
+  return ((ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor *)nil_chk(descriptor_))
+      ->isRepeated_;
+}
+
+- (void)dealloc {
+  RELEASE_(containingTypeDefaultInstance_);
+  RELEASE_(defaultValue_);
+  RELEASE_(messageDefaultInstance_);
+  RELEASE_(descriptor_);
+  [super dealloc];
+}
+
+@end
+
+J2OBJC_CLASS_TYPE_LITERAL_SOURCE(ComGoogleProtobufGeneratedMessageLite_GeneratedExtension)
+
+@implementation ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor
+
+- (instancetype)initWithComGoogleProtobufInternal_EnumLiteMap:
+                    (id<ComGoogleProtobufInternal_EnumLiteMap>)enumTypeMap
+                                                      withInt:(jint)number
+                    withComGoogleProtobufWireFormat_FieldType:
+                        (ComGoogleProtobufWireFormat_FieldType *)type
+                                                  withBoolean:(jboolean)isRepeated
+                                                  withBoolean:(jboolean)isPacked {
+  NSObject_init(self);
+  self->number_ = number;
+  JreStrongAssign(&self->type_, type);
+  self->isRepeated_ = isRepeated;
+  self->isPacked_ = isPacked;
+  return self;
+}
+
+- (jint)getNumber {
+  return number_;
+}
+
+- (ComGoogleProtobufWireFormat_FieldType *)getLiteType {
+  return type_;
+}
+
+- (jboolean)isRepeated {
+  return isRepeated_;
+}
+
+- (jboolean)isPacked {
+  return isPacked_;
+}
+
+- (void)dealloc {
+  RELEASE_(type_);
+  [super dealloc];
+}
+
+@end
+
+J2OBJC_CLASS_TYPE_LITERAL_SOURCE(ComGoogleProtobufGeneratedMessageLite_ExtensionDescriptor)