Bug 32065 - Change of non-integer parameters to enums in interfaces is not possible
Summary: Change of non-integer parameters to enums in interfaces is not possible
Status: RESOLVED FEATURE
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 5.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2015-07-17 06:14 UTC by Antao Almada
Modified: 2015-07-17 08:01 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Antao Almada 2015-07-17 06:14:15 UTC
I have a class that implements a Java interface defined in a .jar and converted to C# using a binding project. The compilation is successful until I do the following changes:

- The interface has a method with a parameter of type 'long' and the class contains some constants to be used. I want to change this into an enum. 

- I create the enum in EnumFields.xml:

<mapping clr-enum-type="MyEnum" jni-class="com/company/myClass">
 <field clr-name="First" jni-name="FIRST_VALUE" value="0" />
 <field clr-name="Second" jni-name="SECOND_VALUE" value="1" />
</mapping>

- I change the parameter type of the interface method in EnumMethods.xml:

<mapping jni-interface="com/company/iInterface">
 <method jni-name="methodName" parameter="type" clr-enum-type="MyEnum"  />
</mapping>

- I now get the following error:

Error: MyCSharpClass is not abstract and does not override abstract method methodName(long) in iInterface

- Double-clicking on the error shows that Java version of my C# class (in the obj folder) contains the method but its parameter type is int:

public MyCSharpClass 
 extends java.lang.Object
 implements
  com.company.iInterface
{
...
 public void methodName(int p0)
 {
   n_methodName(p0);
 }
...
}
 
This is related to bug #27307 I reported before.
Comment 1 Atsushi Eno 2015-07-17 08:01:46 UTC
Unfortunately it is not possible for non-integer parameters and return values. You need to write non-enum-specific metadata xml changes.