java.interop icon indicating copy to clipboard operation
java.interop copied to clipboard

`generator` needs to sanely fixup method override visibility

Open jonpryor opened this issue 7 years ago • 2 comments
trafficstars

From: https://developercommunity.visualstudio.com/content/problem/323704/android-binding-project-does-not-convert-to-c-visi.html

jonpryor avatar Sep 06 '18 19:09 jonpryor

Given this which C# doesn't support:

public class MyBaseClass
{
    protected void DoSomething () { ... }
}

public class MyChildClass extends MyClass {
    @Override
    public void DoSomething() { ... }
}

There are 2 options:

  1. Change MyChildClass.DoSomething () to protected to match the base class
  2. Use method hiding by declaring a new virtual method instead of override

Today we do number 2, which results in this warning: warning CS0114: 'MyChildClass.DoSomething()' hides inherited member 'MyBaseClass.DoSomething()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

What is the goal of this issue?

  1. Do option 1
  2. Add the new keyword to our current method to remove the warning

jpobst avatar Jul 08 '19 15:07 jpobst

We should do (2) and emit new to remove the CS0114 warning.

jonpryor avatar Jul 22 '19 19:07 jonpryor