Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: a65d6fb
Context: 22d5687
Context: fadbb82

Commit a65d6fb added warning CS0108 to $(NoWarn), as there
was no way to fix this warning on IAnnotatedArrayType.

With commits 22d5687 and fadbb82, it is now possible to fix the
CS0108 warning on IAnnotatedArrayType, among others.

Remove CS0108 from $(NoWarn), and use Metadata.xml to fix/avoid
the constructs which caused the CS0108 warnings.

One CS0108 which isn't fixed by reabstraction of
Interface Default Members is for the
java.io.ByteArrayInputStream.mark field, which has the same
name -- and thus hides -- the InputStream.mark() method.
This isn't a problem for Java -- context disambiguates between field
access and a method invocation -- but in C# the easier solution is to
use Metadata to rename ByteArrayInputStream.mark to
ByteArrayInputStream.MarkedPosition, which fixes the CS0108.

Context: a65d6fb
Context: 22d5687
Context: fadbb82

Commit a65d6fb added [warning CS0108][0] to `$(NoWarn)`, as there
was no way to fix this warning on `IAnnotatedArrayType`.

With commits 22d5687 and fadbb82, it is now possible to fix the
CS0108 warning on `IAnnotatedArrayType`, among others.

Remove CS0108 from `$(NoWarn)`, and use `Metadata.xml` to fix/avoid
the constructs which caused the CS0108 warnings.

One CS0108 which *isn't* fixed by [reabstraction][1] of
Interface Default Members is for the
[`java.io.ByteArrayInputStream.mark`][2] field, which has the same
name -- and thus hides -- the [`InputStream.mark()` method][3].
This isn't a problem for Java -- context disambiguates between field
access and a method invocation -- but in C# the easier solution is to
use Metadata to rename `ByteArrayInputStream.mark` to
`ByteArrayInputStream.MarkedPosition`, which fixes the CS0108.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0108
[1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#reabstraction
[2]: https://developer.android.com/reference/java/io/ByteArrayInputStream#mark
[3]: https://developer.android.com/reference/java/io/InputStream#mark(int)
@jonpryor jonpryor requested a review from jpobst July 10, 2022 16:20
@jonpryor jonpryor merged commit 3ff6f8f into dotnet:main Jul 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants