code: public static <ContainingType extends Message, Type>
        GeneratedExtension<ContainingType, Type>
        newMessageScopedGeneratedExtension(final Message scope,
                                           final int descriptorIndex,
                                           final Class singularType,
                                           final Message defaultInstance) {
      // For extensions scoped within a Message, we use the Message to resolve
      // the outer class's descriptor, from which the extension descriptor is
      // obtained.
      return new GeneratedExtension<ContainingType, Type>(
          new ExtensionDescriptorRetriever() {
            //@Override (Java 1.6 override semantics, but we must support 1.5)
            public FieldDescriptor getDescriptor() {
              return scope.getDescriptorForType().getExtensions()
                  .get(descriptorIndex);
            }
          },
          singularType,
          defaultInstance);
    }
docs: For use by generated code only.