Home Features Docs Blog Support GitHub

Name clash error happens


#1

I need your support.
I want to use QR code scan function. but I cannot use captureOutputDidOutputMetadataObjectsFromConnection Method from java code.
Source code and Error message are as follows.

[Code]
public class MyController extends UIViewController implements AVCaptureMetadataOutputObjectsDelegate{

static {
    NatJ.register();
}

protected MyController (Pointer peer) {
    super(peer);
}

@Generated("NatJ")
@Owned
@Selector("alloc")
public static native MyController alloc();

@Generated("NatJ")
@Owned
@Selector("init")
public native MyController init();

@Override
public void captureOutputDidOutputMetadataObjectsFromConnection(AVCaptureOutput captureOutput, NSArray<?> metadataObjects, AVCaptureConnection connection) {
    //Logic;
}

}

[Error message]
Name clash: The method captureOutputDidOutputMetadataObjectsFromConnection(AVCaptureOutput captureOutput, NSArray<?> metadataObjects, AVCaptureConnection connection) of type MyController has the same erasure as captureOutputDidOutputMetadataObjectsFromConnection(AVCaptureOutput captureOutput, NSArray<? extends AVMetadataobject> metadataObjects, AVCaptureConnection connection) of type AVCaptureMetadataOutputObjectsDelegate but does not override it


(Gergely Kis - Migeran) #2

Hi,

You will need to update your code to be compatible with MOE 1.4, that is add the ? extends AVMetaDataobject to the signature.

The reason for this is that Apple added additional type descriptions to the iOS 11 ObjC API to allow better binding generation for Swift. Nat/JGen is using the same type information so it also picked up these new specifications and added them to the generated bindings. As a side effect some type parameters have changed in the MOE 1.4 iOS bindings and result in the build error that you see.

Best Regards,
Gergely


#3

Hi Gergely,

Thank you for your swift replay.
I can resolve my problem based on your advice.

Thank you and best regards,