File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ namespace jni
73
73
74
74
// Foward Declarations
75
75
class Object ;
76
+ template <class TElement > class Array ;
76
77
77
78
/* *
78
79
This namespace is for messy implementation details only. It is not a part
@@ -103,6 +104,9 @@ namespace jni
103
104
std::string valueSig (const Object* obj);
104
105
inline std::string valueSig (const Object* const * obj) { return valueSig (obj ? *obj : nullptr ); }
105
106
107
+ template <class TArg >
108
+ inline std::string valueSig (const Array<TArg>*) { return " [" + valueSig ((TArg*) nullptr ); }
109
+
106
110
template <int n, class TArg >
107
111
inline std::string valueSig (const TArg (*arg)[n]) { return valueSig ((const TArg* const *)arg); }
108
112
@@ -223,10 +227,6 @@ namespace jni
223
227
*/
224
228
JNIEnv* env ();
225
229
226
- // Forward declaration
227
- template <class TElement >
228
- class Array ;
229
-
230
230
/* *
231
231
Object corresponds with a `java.lang.Object` instance. With an Object,
232
232
you can then call Java methods, and access fields on the Object. To
Original file line number Diff line number Diff line change @@ -307,11 +307,16 @@ TEST(Object_call_byNameWithArgs)
307
307
TEST (Object_call_returningArray) {
308
308
jni::Object str = jni::Class (" java/lang/String" ).newInstance (" Testing" );
309
309
310
- // TODO cannot deduce the right signature for an array
311
- auto getBytes =
312
- jni::Class (" java/lang/String" ).getMethod (" getBytes" , " ()[B" );
313
- auto bytes = str.call <jni::Array<jni::byte_t >>(getBytes);
314
- ASSERT (bytes.getLength () == 7 );
310
+ {
311
+ auto getBytes =
312
+ jni::Class (" java/lang/String" ).getMethod (" getBytes" , " ()[B" );
313
+ auto bytes = str.call <jni::Array<jni::byte_t >>(getBytes);
314
+ ASSERT (bytes.getLength () == 7 );
315
+ }
316
+ {
317
+ auto bytes = str.call <jni::Array<jni::byte_t >>(" getBytes" );
318
+ ASSERT (bytes.getLength () == 7 );
319
+ }
315
320
}
316
321
317
322
TEST (Object_makeLocalReference)
You can’t perform that action at this time.
0 commit comments