-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add poison pill to makeExtensionsImmutable method (#20084)
- Loading branch information
1 parent
156b87b
commit 3f1df78
Showing
5 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
java/core/src/test/java/com/google/protobuf/GeneratedMessagePre22WarningDisabledTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.google.protobuf; | ||
|
||
import protobuf_unittest.UnittestProto.TestAllExtensions; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
@RunWith(JUnit4.class) | ||
public class GeneratedMessagePre22WarningDisabledTest { | ||
@Test | ||
public void generatedMessage_makeExtensionsImmutableShouldNotThrow() { | ||
GeneratedMessageV3 msg = | ||
new GeneratedMessageV3() { | ||
@Override | ||
protected FieldAccessorTable internalGetFieldAccessorTable() { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected Message.Builder newBuilderForType(BuilderParent parent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Message.Builder newBuilderForType() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Message.Builder toBuilder() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Message getDefaultInstanceForType() { | ||
return null; | ||
} | ||
}; | ||
msg.makeExtensionsImmutable(); | ||
} | ||
|
||
@Test | ||
public void extendableMessage_makeExtensionsImmutableShouldNotThrow() { | ||
GeneratedMessageV3.ExtendableMessage<TestAllExtensions> msg = | ||
TestAllExtensions.newBuilder().build(); | ||
msg.makeExtensionsImmutable(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters