Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
05712c67
Commit
05712c67
authored
Mar 16, 2019
by
Sydney Acksman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reapply custom option accessors from previous PR along with CustomOptions accessor deprecations
parent
4be03946
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
30 deletions
+16
-30
CustomOptionsTest.cs
.../src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
+2
-0
EnumDescriptor.cs
csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
+2
-5
EnumValueDescriptor.cs
csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
+2
-5
FieldDescriptor.cs
csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
+2
-4
FileDescriptor.cs
csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
+2
-4
MessageDescriptor.cs
csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
+2
-4
MethodDescriptor.cs
csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
+2
-4
ServiceDescriptor.cs
csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
+2
-4
No files found.
csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
View file @
05712c67
...
...
@@ -41,6 +41,8 @@ using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types;
using
static
UnitTest
.
Issues
.
TestProtos
.
DummyMessageContainingEnum
.
Types
;
using
static
Google
.
Protobuf
.
Test
.
Reflection
.
CustomOptionNumber
;
#pragma warning disable CS0618
namespace
Google.Protobuf.Test.Reflection
{
// Internal enum to allow us to use "using static" for convenience.
...
...
csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
View file @
05712c67
...
...
@@ -128,17 +128,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this enum.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
EnumOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -148,6 +147,5 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
}
}
\ No newline at end of file
csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
View file @
05712c67
...
...
@@ -73,17 +73,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this enum value.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
EnumValueOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -93,7 +92,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
}
}
\ No newline at end of file
csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
View file @
05712c67
...
...
@@ -277,17 +277,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this field.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
FieldOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -297,7 +296,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
/// <summary>
/// Look up and cross-link all field types etc.
...
...
csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
View file @
05712c67
...
...
@@ -504,17 +504,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this file.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
FileOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -524,7 +523,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
/// <summary>
/// Performs initialization for the given generic type argument.
...
...
csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
View file @
05712c67
...
...
@@ -243,17 +243,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this message.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
MessageOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -263,7 +262,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
/// <summary>
/// Looks up and cross-links all fields and nested types.
...
...
csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
View file @
05712c67
...
...
@@ -73,17 +73,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this method.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
MethodOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -93,7 +92,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
internal
MethodDescriptor
(
MethodDescriptorProto
proto
,
FileDescriptor
file
,
ServiceDescriptor
parent
,
int
index
)
...
...
csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
View file @
05712c67
...
...
@@ -94,17 +94,16 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// The (possibly empty) set of custom options for this service.
/// </summary>
//
[Obsolete("CustomOptions are obsolete. Use GetOption")]
[
Obsolete
(
"CustomOptions are obsolete. Use GetOption"
)]
public
CustomOptions
CustomOptions
=>
new
CustomOptions
(
Proto
.
Options
.
_extensions
?.
ValuesByNumber
);
/* // uncomment this in the full proto2 support PR
/// <summary>
/// Gets a single value enum option for this descriptor
/// </summary>
public
T
GetOption
<
T
>(
Extension
<
ServiceOptions
,
T
>
extension
)
{
var
value
=
Proto
.
Options
.
GetExtension
(
extension
);
return value is IDeepCloneable<T>
clonable ? clonable
.Clone() : value;
return
value
is
IDeepCloneable
<
T
>
?
(
value
as
IDeepCloneable
<
T
>)
.
Clone
()
:
value
;
}
/// <summary>
...
...
@@ -114,7 +113,6 @@ namespace Google.Protobuf.Reflection
{
return
Proto
.
Options
.
GetExtension
(
extension
).
Clone
();
}
*/
internal
void
CrossLink
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment