AVRO-3603: .NET Reflect Reader and Writer - add interfaces#1940
AVRO-3603: .NET Reflect Reader and Writer - add interfaces#1940KhrystynaPopadyuk wants to merge 3 commits intoapache:mainfrom
Conversation
Merge with apache/avro master
| case Schema.Type.Error: | ||
| case Schema.Type.Record: | ||
| return _classCache.GetClass(sc as RecordSchema).GetClassType() == obj.GetType(); | ||
| return _cacheService.GetClass(sc as RecordSchema).GetClassType() == obj.GetType(); |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
There was a problem hiding this comment.
This is existing code. Should I change logic if I want rename variable?
9b6813a to
b3bae62
Compare
b3bae62 to
f151732
Compare
|
Hi @martin-g , @KyleSchoonover , @RyanSkraba , Please review it. |
Changing the method's return type (from a class to an interface) is binary incompatible change. |
|
Hi @martin-g , Thank you for review. |
f2e4cb6 to
7856e4a
Compare
martin-g
left a comment
There was a problem hiding this comment.
LGTM!
It would be good if an experienced .NET developer reviews this PR too!
|
Hi @KalleOlaviNiemitalo, please review this PR. It will help inject custom logic and fixes. |
|
It's morning here, I won't be able to review before evening. |
|
Hi @KalleOlaviNiemitalo, That's OK. Thanks |
|
(Setting up a new computer took more time than expected.) This pull request makes existing classes implement new interfaces, and then uses those interfaces instead of the classes:
I worry that these changes will make it more difficult to avoid breaking changes in the future if members are added. Currently, it is possible to add new virtual methods to ClassCache and DotnetClass and provide default implementations. Doing the same in the interfaces would require either using default interface methods, which .NET Framework does not support, or adding more interfaces (e.g. ICacheService2) and checking at run time whether the object implements those. Does IDotnetProperty need to be public? It is not implemented by any public type, nor used as a parameter or return value of any public method. |
|
Hi @KalleOlaviNiemitalo , Thank you for review. The main goal of this PR is add interfaces to be able inject custom implementation (including breaking changes) and fix bugs quickly.
I understand you concern to avoid breaking changes. But what suppose to do users, as me, who need breaking changes? |
|
Hi @KalleOlaviNiemitalo and @martin-g , There is my next attempt to add opportunity to override default behaviors - #2009 |
|
Can you please merge and release this PR? |
|
Hi @vivere-dally , I prefer this one. |
AVRO-3603
This pull request add interfaces for reflect reader and writer that will help end users override default behavior due to their needs.
This change is refactoring only. Mostly covered by existing tests but require small updates to them.
WriteAndReadObjectsWithLogicalSchemaFields_WithNullValues
WriteAndReadObjectsWithLogicalSchemaFields_WithoutNullValues.