@ -190,6 +190,18 @@ public class LiteTest {
}
}
@Test
public void testParsedOneofSubMessageIsImmutable ( ) throws InvalidProtocolBufferException {
TestAllTypesLite message =
TestAllTypesLite . parseFrom (
TestAllTypesLite . newBuilder ( )
. setOneofNestedMessage ( NestedMessage . newBuilder ( ) . addDd ( 1234 ) . build ( ) )
. build ( )
. toByteArray ( ) ) ;
IntArrayList subList = ( IntArrayList ) message . getOneofNestedMessage ( ) . getDdList ( ) ;
assertThat ( subList . isModifiable ( ) ) . isFalse ( ) ;
}
@Test
public void testMemoization ( ) throws Exception {
GeneratedMessageLite < ? , ? > message = TestUtilLite . getAllLiteExtensionsSet ( ) ;
@ -2365,8 +2377,7 @@ public class LiteTest {
Foo fooWithOnlyValue = Foo . newBuilder ( ) . setValue ( 1 ) . build ( ) ;
Foo fooWithValueAndExtension =
fooWithOnlyValue
. toBuilder ( )
fooWithOnlyValue . toBuilder ( )
. setValue ( 1 )
. setExtension ( Bar . fooExt , Bar . newBuilder ( ) . setName ( "name" ) . build ( ) )
. build ( ) ;
@ -2382,8 +2393,7 @@ public class LiteTest {
Foo fooWithOnlyValue = Foo . newBuilder ( ) . setValue ( 1 ) . build ( ) ;
Foo fooWithValueAndExtension =
fooWithOnlyValue
. toBuilder ( )
fooWithOnlyValue . toBuilder ( )
. setValue ( 1 )
. setExtension ( Bar . fooExt , Bar . newBuilder ( ) . setName ( "name" ) . build ( ) )
. build ( ) ;