@ -215,10 +215,10 @@ final class ArrayDecoders {
}
}
/** Decodes a message value. */
/** Decodes a message value. */
@SuppressWarnings ( { "unchecked" , "rawtypes" } )
static < T > int decodeMessageField (
sta tic int decodeMessageField (
Schema < T > schema , byte [ ] data , int posi tion , int limit , Registers registers )
Schema schema , byte [ ] data , int position , int limit , Registers registers ) throws IOException {
throws IOException {
Object msg = schema . newInstance ( ) ;
T msg = schema . newInstance ( ) ;
int offset = mergeMessageField ( msg , schema , data , position , limit , registers ) ;
int offset = mergeMessageField ( msg , schema , data , position , limit , registers ) ;
schema . makeImmutable ( msg ) ;
schema . makeImmutable ( msg ) ;
registers . object1 = msg ;
registers . object1 = msg ;
@ -226,20 +226,19 @@ final class ArrayDecoders {
}
}
/** Decodes a group value. */
/** Decodes a group value. */
@SuppressWarnings ( { "unchecked" , "rawtypes" } )
static < T > int decodeGroupField (
static int decodeGroupField (
Schema < T > schema , byte [ ] data , int position , int limit , int endGroup , Registers registers )
Schema schema , byte [ ] data , int position , int limit , int endGroup , Registers registers )
throws IOException {
throws IOException {
Object msg = schema . newInstance ( ) ;
T msg = schema . newInstance ( ) ;
int offset = mergeGroupField ( msg , schema , data , position , limit , endGroup , registers ) ;
int offset = mergeGroupField ( msg , schema , data , position , limit , endGroup , registers ) ;
schema . makeImmutable ( msg ) ;
schema . makeImmutable ( msg ) ;
registers . object1 = msg ;
registers . object1 = msg ;
return offset ;
return offset ;
}
}
@SuppressWarnings ( { "unchecked" , "rawtypes" } )
@SuppressWarnings ( "unchecked" )
static int mergeMessageField (
static < T > int mergeMessageField (
Object msg , Schema schema , byte [ ] data , int position , int limit , Registers registers )
Object msg , Schema < T > schema , byte [ ] data , int position , int limit , Registers registers )
throws IOException {
throws IOException {
int length = data [ position + + ] ;
int length = data [ position + + ] ;
if ( length < 0 ) {
if ( length < 0 ) {
@ -251,16 +250,16 @@ final class ArrayDecoders {
}
}
registers . recursionDepth + + ;
registers . recursionDepth + + ;
checkRecursionLimit ( registers . recursionDepth ) ;
checkRecursionLimit ( registers . recursionDepth ) ;
schema . mergeFrom ( msg , data , position , position + length , registers ) ;
schema . mergeFrom ( ( T ) msg , data , position , position + length , registers ) ;
registers . recursionDepth - - ;
registers . recursionDepth - - ;
registers . object1 = msg ;
registers . object1 = msg ;
return position + length ;
return position + length ;
}
}
@SuppressWarnings ( { "unchecked" , "rawtypes" } )
@SuppressWarnings ( "unchecked" )
static int mergeGroupField (
static < T > int mergeGroupField (
Object msg ,
Object msg ,
Schema schema ,
Schema < T > schema ,
byte [ ] data ,
byte [ ] data ,
int position ,
int position ,
int limit ,
int limit ,
@ -269,11 +268,11 @@ final class ArrayDecoders {
throws IOException {
throws IOException {
// A group field must has a MessageSchema (the only other subclass of Schema is MessageSetSchema
// A group field must has a MessageSchema (the only other subclass of Schema is MessageSetSchema
// and it can't be used in group fields).
// and it can't be used in group fields).
final MessageSchema messageSchema = ( MessageSchema ) schema ;
final MessageSchema < T > messageSchema = ( MessageSchema < T > ) schema ;
registers . recursionDepth + + ;
registers . recursionDepth + + ;
checkRecursionLimit ( registers . recursionDepth ) ;
checkRecursionLimit ( registers . recursionDepth ) ;
final int endPosition =
final int endPosition =
messageSchema . parseMessage ( msg , data , position , limit , endGroup , registers ) ;
messageSchema . parseMessage ( ( T ) msg , data , position , limit , endGroup , registers ) ;
registers . recursionDepth - - ;
registers . recursionDepth - - ;
registers . object1 = msg ;
registers . object1 = msg ;
return endPosition ;
return endPosition ;
@ -758,17 +757,15 @@ final class ArrayDecoders {
*
*
* @return The position of after read all groups
* @return The position of after read all groups
* /
* /
@SuppressWarnings ( { "unchecked" , "rawtypes" } )
static int decodeGroupList (
static int decodeGroupList (
Schema schema ,
Schema < ? > schema ,
int tag ,
int tag ,
byte [ ] data ,
byte [ ] data ,
int position ,
int position ,
int limit ,
int limit ,
ProtobufList < ? > lis t,
ProtobufList < Object > outpu t,
Registers registers )
Registers registers )
throws IOException {
throws IOException {
final ProtobufList < Object > output = ( ProtobufList < Object > ) list ;
final int endgroup = ( tag & ~ 0x7 ) | WireFormat . WIRETYPE_END_GROUP ;
final int endgroup = ( tag & ~ 0x7 ) | WireFormat . WIRETYPE_END_GROUP ;
position = decodeGroupField ( schema , data , position , limit , endgroup , registers ) ;
position = decodeGroupField ( schema , data , position , limit , endgroup , registers ) ;
output . add ( registers . object1 ) ;
output . add ( registers . object1 ) ;
@ -791,7 +788,7 @@ final class ArrayDecoders {
Registers registers )
Registers registers )
throws IOException {
throws IOException {
final int number = tag > > > 3 ;
final int number = tag > > > 3 ;
GeneratedMessageLite . GeneratedExtension extension =
GeneratedMessageLite . GeneratedExtension < ? , ? > extension =
registers . extensionRegistry . findLiteExtensionByNumber ( defaultInstance , number ) ;
registers . extensionRegistry . findLiteExtensionByNumber ( defaultInstance , number ) ;
if ( extension = = null ) {
if ( extension = = null ) {
return decodeUnknownField (
return decodeUnknownField (
@ -972,7 +969,7 @@ final class ArrayDecoders {
case GROUP :
case GROUP :
{
{
final int endTag = ( fieldNumber < < 3 ) | WireFormat . WIRETYPE_END_GROUP ;
final int endTag = ( fieldNumber < < 3 ) | WireFormat . WIRETYPE_END_GROUP ;
final Schema fieldSchema =
final Schema < ? > fieldSchema =
Protobuf . getInstance ( )
Protobuf . getInstance ( )
. schemaFor ( extension . getMessageDefaultInstance ( ) . getClass ( ) ) ;
. schemaFor ( extension . getMessageDefaultInstance ( ) . getClass ( ) ) ;
if ( extension . isRepeated ( ) ) {
if ( extension . isRepeated ( ) ) {
@ -992,7 +989,7 @@ final class ArrayDecoders {
}
}
case MESSAGE :
case MESSAGE :
{
{
final Schema fieldSchema =
final Schema < ? > fieldSchema =
Protobuf . getInstance ( )
Protobuf . getInstance ( )
. schemaFor ( extension . getMessageDefaultInstance ( ) . getClass ( ) ) ;
. schemaFor ( extension . getMessageDefaultInstance ( ) . getClass ( ) ) ;
if ( extension . isRepeated ( ) ) {
if ( extension . isRepeated ( ) ) {