Skip to content

Objective-C++ deprecation issues #166

Description

@sirnacnud

I am running in to an issue with the new deprecation support. I have an interface that is marked as deprecated, and I am generating Objective-C++ files, but looks like that generator wasn't changed in the deprecation support. When I try to compile the Objective-C++ files, it triggers a deprecation warning (or compile error if warnings are errors), as it is using the deprecated C++ type.

The problem is the ::MyInterface C++ type used in the class is deprecated. Does anyone have thoughts on how to resolve this?

idl:

# interface comment
#
# @deprecated Use someother interface
my_interface = interface +o {
  # @deprecated Use someother method
  method_a(value:i32);
}

my_interface.hpp:

// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from test.djinni

#pragma once

#include <cstdint>

/**
 * interface comment
 *
 * @deprecated Use someother interface
 */
class [[deprecated("Use someother interface")]] MyInterface {
public:
    virtual ~MyInterface() {}

    /** @deprecated Use someother method */
    [[deprecated("Use someother method")]]
    virtual void method_a(int32_t value) = 0;
};

MyInterface+Private.h:

// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from test.djinni

#include "my_interface.hpp"
#include <memory>

static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");

@protocol MyInterface;

namespace djinni_generated {

class MyInterface
{
public:
    using CppType = std::shared_ptr<::MyInterface>;
    using CppOptType = std::shared_ptr<::MyInterface>;
    using ObjcType = id<MyInterface>;

    using Boxed = MyInterface;

    static CppType toCpp(ObjcType objc);
    static ObjcType fromCppOpt(const CppOptType& cpp);
    static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }

private:
    class ObjcProxy;
};

}  // namespace djinni_generated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions