func (cdc *Codec) decodeReflectJSONArray(bz []byte, info *TypeInfo, rv reflect.Value, fopts FieldOptions) (err error) {
	if !rv.CanAddr() {
		panic("rv not addressable")
	}
	if printLog {
		fmt.Println("(d) decodeReflectJSONArray")
		defer func() {
			fmt.Printf("(d) -> err: %v\n", err)
		}()
	}
	ert := info.Type.Elem()
	length := info.Type.Len()

	switch ert.Kind() {

	case reflect.Uint8: // Special case: byte array
		var buf []byte
		err = json.Unmarshal(bz, &buf)
		if err != nil {
			return
		}
		if len(buf) != length {
			err = fmt.Errorf("decodeReflectJSONArray: byte-length mismatch, got %v want %v",
				len(buf), length)
		}
		reflect.Copy(rv, reflect.ValueOf(buf))
		return

	default: // General case.
		var einfo *TypeInfo
		einfo, err = cdc.getTypeInfo_wlock(ert)
		if err != nil {
			return
		}

		// Read into rawSlice.
		var rawSlice []json.RawMessage
		if err = json.Unmarshal(bz, &rawSlice); err != nil {
			return
		}
		if len(rawSlice) != length {
			err = fmt.Errorf("decodeReflectJSONArray: length mismatch, got %v want %v", len(rawSlice), length)
			return
		}

		// Decode each item in rawSlice.
		for i := 0; i < length; i++ {
			erv := rv.Index(i)
			ebz := rawSlice[i]
			err = cdc.decodeReflectJSON(ebz, einfo, erv, fopts)
			if err != nil {
				return
			}
		}
		return
	}
}
func (cdc *Codec) decodeReflectJSONArray(bz []byte, info *TypeInfo, rv reflect.Value, fopts FieldOptions) (err error) {
	if !rv.CanAddr() {
		panic("rv not addressable")
	}
	if printLog {
		fmt.Println("(d) decodeReflectJSONArray")
		defer func() {
			fmt.Printf("(d) -> err: %v\n", err)
		}()
	}
	ert := info.Type.Elem()
	length := info.Type.Len()

	switch ert.Kind() {

	case reflect.Uint8: 
		var buf []byte
		err = json.Unmarshal(bz, &buf)
		if err != nil {
			return
		}
		if len(buf) != length {
			err = fmt.Errorf("decodeReflectJSONArray: byte-length mismatch, got %v want %v",
				len(buf), length)
		}
		reflect.Copy(rv, reflect.ValueOf(buf))
		return

	default: 
		var einfo *TypeInfo
		einfo, err = cdc.getTypeInfo_wlock(ert)
		if err != nil {
			return
		}

		
		var rawSlice []json.RawMessage
		if err = json.Unmarshal(bz, &rawSlice); err != nil {
			return
		}
		if len(rawSlice) != length {
			err = fmt.Errorf("decodeReflectJSONArray: length mismatch, got %v want %v", len(rawSlice), length)
			return
		}

		
		for i := 0; i < length; i++ {
			erv := rv.Index(i)
			ebz := rawSlice[i]
			err = cdc.decodeReflectJSON(ebz, einfo, erv, fopts)
			if err != nil {
				return
			}
		}
		return
	}
}
func ( cdc * Codec ) decodeReflectJSONArray ( bz [ ] byte , info * TypeInfo , rv reflect . Value , fopts FieldOptions ) ( err error ) { if ! rv . CanAddr ( ) { panic ( " " ) } if printLog { fmt . Println ( " " ) defer func ( ) { fmt . Printf ( " \n " , err ) } ( ) } ert := info . Type . Elem ( ) length := info . Type . Len ( ) switch ert . Kind ( ) { case reflect . Uint8 : // Special case: byte array var buf [ ] byte err = json . Unmarshal ( bz , & buf ) if err != nil { return } if len ( buf ) != length { err = fmt . Errorf ( " " , len ( buf ) , length ) } reflect . Copy ( rv , reflect . ValueOf ( buf ) ) return default : // General case. var einfo * TypeInfo einfo , err = cdc . getTypeInfo_wlock ( ert ) if err != nil { return } // Read into rawSlice. var rawSlice [ ] json . RawMessage if err = json . Unmarshal ( bz , & rawSlice ) ; err != nil { return } if len ( rawSlice ) != length { err = fmt . Errorf ( " " , len ( rawSlice ) , length ) return } // Decode each item in rawSlice. for i := 0 ; i < length ; i ++ { erv := rv . Index ( i ) ebz := rawSlice [ i ] err = cdc . decodeReflectJSON ( ebz , einfo , erv , fopts ) if err != nil { return } } return } }
// CONTRACT: rv.CanAddr() is true.
CONTRACT : rv . CanAddr () is true .