Commit fe2fd053 authored by Andrew Twyman's avatar Andrew Twyman

Test case for naming conflict fix

parent 0466241a
......@@ -49,3 +49,12 @@ test_helpers = interface +c {
empty_record = record {
}
# Test for conflict of method name with an interface name.
# See the comments about scopeSymbols in CppMarshal.scala for more info.
Conflict = interface +c {
}
conflict_user = interface +c {
Conflict(): Conflict;
conflict_arg(cs: set<Conflict>): bool;
}
\ No newline at end of file
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#pragma once
namespace testsuite {
/**
* Test for conflict of method name with an interface name.
* See the comments about scopeSymbols in CppMarshal.scala for more info.
*/
class Conflict {
public:
virtual ~Conflict() {}
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#pragma once
#include <memory>
#include <unordered_set>
namespace testsuite {
class Conflict;
class ConflictUser {
public:
virtual ~ConflictUser() {}
virtual std::shared_ptr<::testsuite::Conflict> Conflict() = 0;
virtual bool conflict_arg(const std::unordered_set<std::shared_ptr<::testsuite::Conflict>> & cs) = 0;
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* Test for conflict of method name with an interface name.
* See the comments about scopeSymbols in CppMarshal.scala for more info.
*/
public abstract class Conflict {
private static final class CppProxy extends Conflict
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
package com.dropbox.djinni.test;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
public abstract class ConflictUser {
@CheckForNull
public abstract Conflict Conflict();
public abstract boolean conflictArg(@Nonnull HashSet<Conflict> cs);
private static final class CppProxy extends ConflictUser
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public Conflict Conflict()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_Conflict(this.nativeRef);
}
private native Conflict native_Conflict(long _nativeRef);
@Override
public boolean conflictArg(HashSet<Conflict> cs)
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_conflictArg(this.nativeRef, cs);
}
private native boolean native_conflictArg(long _nativeRef, HashSet<Conflict> cs);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#include "NativeConflict.hpp" // my header
namespace djinni_generated {
NativeConflict::NativeConflict() : ::djinni::JniInterface<::testsuite::Conflict, NativeConflict>("com/dropbox/djinni/test/Conflict$CppProxy") {}
NativeConflict::~NativeConflict() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Conflict_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<::djinni::CppProxyHandle<::testsuite::Conflict>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#pragma once
#include "Conflict.hpp"
#include "djinni_support.hpp"
namespace djinni_generated {
class NativeConflict final : ::djinni::JniInterface<::testsuite::Conflict, NativeConflict> {
public:
using CppType = std::shared_ptr<::testsuite::Conflict>;
using CppOptType = std::shared_ptr<::testsuite::Conflict>;
using JniType = jobject;
using Boxed = NativeConflict;
~NativeConflict();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeConflict>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeConflict>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeConflict();
friend ::djinni::JniClass<NativeConflict>;
friend ::djinni::JniInterface<::testsuite::Conflict, NativeConflict>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#include "NativeConflictUser.hpp" // my header
#include "Marshal.hpp"
#include "NativeConflict.hpp"
namespace djinni_generated {
NativeConflictUser::NativeConflictUser() : ::djinni::JniInterface<::testsuite::ConflictUser, NativeConflictUser>("com/dropbox/djinni/test/ConflictUser$CppProxy") {}
NativeConflictUser::~NativeConflictUser() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ConflictUser_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<::djinni::CppProxyHandle<::testsuite::ConflictUser>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ConflictUser_00024CppProxy_native_1Conflict(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ConflictUser>(nativeRef);
auto r = ref->Conflict();
return ::djinni::release(::djinni_generated::NativeConflict::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_ConflictUser_00024CppProxy_native_1conflictArg(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_cs)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ConflictUser>(nativeRef);
auto r = ref->conflict_arg(::djinni::Set<::djinni_generated::NativeConflict>::toCpp(jniEnv, j_cs));
return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#pragma once
#include "conflict_user.hpp"
#include "djinni_support.hpp"
namespace djinni_generated {
class NativeConflictUser final : ::djinni::JniInterface<::testsuite::ConflictUser, NativeConflictUser> {
public:
using CppType = std::shared_ptr<::testsuite::ConflictUser>;
using CppOptType = std::shared_ptr<::testsuite::ConflictUser>;
using JniType = jobject;
using Boxed = NativeConflictUser;
~NativeConflictUser();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeConflictUser>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeConflictUser>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeConflictUser();
friend ::djinni::JniClass<NativeConflictUser>;
friend ::djinni::JniInterface<::testsuite::ConflictUser, NativeConflictUser>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#include "Conflict.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBConflict;
namespace djinni_generated {
class Conflict
{
public:
using CppType = std::shared_ptr<::testsuite::Conflict>;
using CppOptType = std::shared_ptr<::testsuite::Conflict>;
using ObjcType = DBConflict*;
using Boxed = Conflict;
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
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#import "DBConflict+Private.h"
#import "DBConflict.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBConflict ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::Conflict>&)cppRef;
@end
@implementation DBConflict {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::Conflict>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::Conflict>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
namespace djinni_generated {
auto Conflict::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto Conflict::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBConflict>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#import <Foundation/Foundation.h>
/**
* Test for conflict of method name with an interface name.
* See the comments about scopeSymbols in CppMarshal.scala for more info.
*/
@interface DBConflict : NSObject
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#include "conflict_user.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBConflictUser;
namespace djinni_generated {
class ConflictUser
{
public:
using CppType = std::shared_ptr<::testsuite::ConflictUser>;
using CppOptType = std::shared_ptr<::testsuite::ConflictUser>;
using ObjcType = DBConflictUser*;
using Boxed = ConflictUser;
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
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#import "DBConflictUser+Private.h"
#import "DBConflictUser.h"
#import "DBConflict+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBConflictUser ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConflictUser>&)cppRef;
@end
@implementation DBConflictUser {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::ConflictUser>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConflictUser>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
- (nullable DBConflict *)Conflict {
try {
auto r = _cppRefHandle.get()->Conflict();
return ::djinni_generated::Conflict::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
- (BOOL)conflictArg:(nonnull NSSet<DBConflict *> *)cs {
try {
auto r = _cppRefHandle.get()->conflict_arg(::djinni::Set<::djinni_generated::Conflict>::toCpp(cs));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
namespace djinni_generated {
auto ConflictUser::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto ConflictUser::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBConflictUser>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#import <Foundation/Foundation.h>
@class DBConflict;
@interface DBConflictUser : NSObject
- (nullable DBConflict *)Conflict;
- (BOOL)conflictArg:(nonnull NSSet<DBConflict *> *)cs;
@end
......@@ -23,6 +23,8 @@ djinni-output-temp/cpp/assorted_primitives.hpp
djinni-output-temp/cpp/assorted_primitives.cpp
djinni-output-temp/cpp/test_helpers.hpp
djinni-output-temp/cpp/empty_record.hpp
djinni-output-temp/cpp/Conflict.hpp
djinni-output-temp/cpp/conflict_user.hpp
djinni-output-temp/cpp/user_token.hpp
djinni-output-temp/cpp/color.hpp
djinni-output-temp/cpp/opt_color_record.hpp
......@@ -58,6 +60,8 @@ djinni-output-temp/java/ConstantsInterface.java
djinni-output-temp/java/AssortedPrimitives.java
djinni-output-temp/java/TestHelpers.java
djinni-output-temp/java/EmptyRecord.java
djinni-output-temp/java/Conflict.java
djinni-output-temp/java/ConflictUser.java
djinni-output-temp/java/UserToken.java
djinni-output-temp/java/Color.java
djinni-output-temp/java/OptColorRecord.java
......@@ -110,6 +114,10 @@ djinni-output-temp/jni/NativeTestHelpers.hpp
djinni-output-temp/jni/NativeTestHelpers.cpp
djinni-output-temp/jni/NativeEmptyRecord.hpp
djinni-output-temp/jni/NativeEmptyRecord.cpp
djinni-output-temp/jni/NativeConflict.hpp
djinni-output-temp/jni/NativeConflict.cpp
djinni-output-temp/jni/NativeConflictUser.hpp
djinni-output-temp/jni/NativeConflictUser.cpp
djinni-output-temp/jni/NativeUserToken.hpp
djinni-output-temp/jni/NativeUserToken.cpp
djinni-output-temp/jni/NativeColor.hpp
......@@ -165,6 +173,8 @@ djinni-output-temp/objc/DBAssortedPrimitives.mm
djinni-output-temp/objc/DBTestHelpers.h
djinni-output-temp/objc/DBEmptyRecord.h
djinni-output-temp/objc/DBEmptyRecord.mm
djinni-output-temp/objc/DBConflict.h
djinni-output-temp/objc/DBConflictUser.h
djinni-output-temp/objc/DBUserToken.h
djinni-output-temp/objc/DBColor.h
djinni-output-temp/objc/DBOptColorRecord.h
......@@ -226,6 +236,10 @@ djinni-output-temp/objc/DBTestHelpers+Private.h
djinni-output-temp/objc/DBTestHelpers+Private.mm
djinni-output-temp/objc/DBEmptyRecord+Private.h
djinni-output-temp/objc/DBEmptyRecord+Private.mm
djinni-output-temp/objc/DBConflict+Private.h
djinni-output-temp/objc/DBConflict+Private.mm
djinni-output-temp/objc/DBConflictUser+Private.h
djinni-output-temp/objc/DBConflictUser+Private.mm
djinni-output-temp/objc/DBUserToken+Private.h
djinni-output-temp/objc/DBUserToken+Private.mm
djinni-output-temp/objc/DBOptColorRecord+Private.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment