Skip to content

Commit 68117a1

Browse files
committed
Remove implicit pointer conversions
1 parent 5462072 commit 68117a1

File tree

9 files changed

+8
-13
lines changed

9 files changed

+8
-13
lines changed

examples/hello.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void RegisterHighLevel(JavaVM* vm)
5757
u"Hello, " + jni::Make<std::u16string>(env, args.Get(env, 0)) + u" (Native High-Level)"));
5858
};
5959

60-
jni::RegisterNatives(env, jni::Class<Greeter>::Find(env),
60+
jni::RegisterNatives(env, *jni::Class<Greeter>::Find(env),
6161
jni::MakeNativeMethod("greet", greet));
6262
}
6363

include/jni/array.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ namespace jni
4040
public:
4141
explicit operator bool() const { return array; }
4242

43-
operator UntaggedType*() const { return array; }
4443
UntaggedType& operator*() const { return *array; }
4544
UntaggedType* Get() const { return array; }
4645

@@ -131,7 +130,6 @@ namespace jni
131130
public:
132131
explicit operator bool() const { return array; }
133132

134-
operator UntaggedType*() const { return array; }
135133
UntaggedType& operator*() const { return *array; }
136134
UntaggedType* Get() const { return array; }
137135

include/jni/class.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ namespace jni
4343
public:
4444
explicit operator bool() const { return clazz; }
4545

46-
operator jclass&() const { return *clazz; }
4746
jclass& operator*() const { return *clazz; }
4847
jclass* Get() const { return clazz; }
4948

include/jni/field.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace jni
1919
using FieldType = T;
2020

2121
Field(JNIEnv& env, const Class<TagType>& clazz, const char* name)
22-
: field(GetFieldID(env, clazz, name, TypeSignature<T>()()))
22+
: field(GetFieldID(env, *clazz, name, TypeSignature<T>()()))
2323
{}
2424

2525
operator jfieldID&() const { return field; }

include/jni/method.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace jni
2323
using ReturnType = R;
2424

2525
Method(JNIEnv& env, const Class<TagType>& clazz, const char* name)
26-
: method(GetMethodID(env, clazz, name, TypeSignature<R (Args...)>()()))
26+
: method(GetMethodID(env, *clazz, name, TypeSignature<R (Args...)>()()))
2727
{}
2828

2929
operator jmethodID&() const { return method; }

include/jni/native_method.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ namespace jni
313313
void RegisterNativePeer(JNIEnv& env, const Class<TagType>& clazz, const char* fieldName, Methods&&... methods)
314314
{
315315
static Field<TagType, jni::jlong> field { env, clazz, fieldName };
316-
RegisterNatives(env, clazz, methods.template operator()<Peer>(field)...);
316+
RegisterNatives(env, *clazz, methods.template operator()<Peer>(field)...);
317317
}
318318

319319
template < class Peer, class TagType, class >
@@ -363,7 +363,7 @@ namespace jni
363363
using InitializerMethodType = typename NativeMethodTraits<Initializer>::Type;
364364
NativePeerHelper<Peer, TagType, InitializerMethodType> helper;
365365

366-
RegisterNatives(env, clazz,
366+
RegisterNatives(env, *clazz,
367367
helper.MakeInitializer(field, initializeMethodName, initialize),
368368
helper.MakeFinalizer(field, finalizeMethodName),
369369
methods.template operator()<Peer>(field)...);

include/jni/object.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace jni
4747
template < class OtherTag >
4848
bool IsInstanceOf(JNIEnv& env, const Class<OtherTag>& clazz) const
4949
{
50-
return jni::IsInstanceOf(env, ptr, clazz);
50+
return jni::IsInstanceOf(env, ptr, *clazz);
5151
}
5252
};
5353

@@ -98,8 +98,6 @@ namespace jni
9898

9999
public:
100100
UntaggedType* Get() const { return reinterpret_cast<UntaggedType*>(this->ptr); }
101-
102-
operator UntaggedType*() const { return Get(); }
103101
UntaggedType& operator*() const { return *Get(); }
104102

105103
template < class T >

include/jni/static_field.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace jni
1919
using FieldType = T;
2020

2121
StaticField(JNIEnv& env, const Class<TagType>& clazz, const char* name)
22-
: field(GetStaticFieldID(env, clazz, name, TypeSignature<T>()()))
22+
: field(GetStaticFieldID(env, *clazz, name, TypeSignature<T>()()))
2323
{}
2424

2525
operator jfieldID&() const { return field; }

include/jni/static_method.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace jni
2323
using ReturnType = R;
2424

2525
StaticMethod(JNIEnv& env, const Class<TagType>& clazz, const char* name)
26-
: method(GetStaticMethodID(env, clazz, name, TypeSignature<R (Args...)>()()))
26+
: method(GetStaticMethodID(env, *clazz, name, TypeSignature<R (Args...)>()()))
2727
{}
2828

2929
operator jmethodID&() const { return method; }

0 commit comments

Comments
 (0)