Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Mark protected types nested in sealed classes as private. #672

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Jun 23, 2020

In #569 we marked protected members in sealed classes as private to prevent csc warnings. However we did not cover nested types which also cause this warning.

sealed class Foo
{
  protected interface Bar
  {
  }

  protected class Bar2
  {
  }
}
warning CS0628: 'Foo.Bar': new protected member declared in sealed class
warning CS0628: 'Foo.Bar2': new protected member declared in sealed class

Mono.Android.dll added 28 new protected interfaces in sealed classes CalendarContract and ContactContract which caused new warnings is our builds.

obj\Release\monoandroid10\android-30\mcw\Android.Provider.CalendarContract.cs(614,40): warning CS0628: 'CalendarContract.IAttendeesColumns': new protected member declared in sealed class [C:\A\vs2019xam00000Z-1\_work\1\s\src\Mono.Android\Mono.Android.csproj]

This PR marks nested types as private if the parent class is sealed.

@jpobst jpobst marked this pull request as ready for review June 23, 2020 19:11
@jonpryor jonpryor merged commit fd2c94e into master Jun 23, 2020
@jonpryor jonpryor deleted the sealed-protected-types branch June 23, 2020 20:05
@jpobst jpobst added this to the 10.5 (16.8 / 8.8) milestone Jun 26, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 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