This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Twyman
committed
Apr 22, 2016
1 parent
0466241
commit fe2fd05
Showing
16 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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 |
39 changes: 39 additions & 0 deletions
39
test-suite/generated-src/java/com/dropbox/djinni/test/Conflict.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// 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(); | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
test-suite/generated-src/java/com/dropbox/djinni/test/ConflictUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// 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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 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 |
Oops, something went wrong.