Skip to content

Bindingsgenerator: Package public class inheriting from package class results in error #168

@maksimorlovich

Description

@maksimorlovich

We have two classes, public class MyPublicClass extends MyPackageClass and abstract class MyPackageClass (package private class). This generates code for MyPublicClass which wants to inherit from MyPackageClass, but because parent class is package private, no C# code is generated for it.

package com.xamarin;

abstract class MyPackageClass {
    public abstract void bugOne();
}


package com.xamarin;

public class MyPublicClass extends MyPackageClass {

    @Override
    public void bugOne() {

    }
}

It generates c# code:

public partial class MyPublicClass : global::Com.Xamarin.MyPackageClass {

which results in this error:

obj/Debug/generated/src/Com.Xamarin.MyPublicClass.cs(9,59,9,73): error CS0234: The type or namespace name 'MyPackageClass' does not exist in the namespace 'Com.Xamarin' (are you missing an assembly reference?)

This reproduces with Visual Studio for Mac Community 2017 and also latest generator.exe code compiled from source. Attached is a problematic Jar. Please take a look. Just create an Android binding library project, add the attached jar, and build.
libxamarinbug.jar.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions