The open source OpenXR runtime

Update jnipp from upstream v1.0.0-13-gcdd6293

JNIPP_REV_ID: cdd6293fca985993129f5ef5441709fc49ee507f
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2437>

authored by

Rylie Pavlik and committed by
Marge Bot
0c2992ea ac248ea0

+118 -349
-5
src/external/jnipp/.editorconfig
··· 1 - 2 - [.h,.cpp] 3 - indent_size = 4 4 - indent_style = space 5 - trim_trailing_whitespace = true
-258
src/external/jnipp/.gitignore
··· 1 - ## Ignore Visual Studio temporary files, build results, and 2 - ## files generated by popular Visual Studio add-ons. 3 - 4 - # User-specific files 5 - *.suo 6 - *.user 7 - *.userosscache 8 - *.sln.docstates 9 - 10 - # User-specific files (MonoDevelop/Xamarin Studio) 11 - *.userprefs 12 - 13 - # Build results 14 - [Dd]ebug/ 15 - [Dd]ebugPublic/ 16 - [Rr]elease/ 17 - [Rr]eleases/ 18 - x64/ 19 - x86/ 20 - bld/ 21 - [Bb]in/ 22 - [Oo]bj/ 23 - [Ll]og/ 24 - 25 - # Visual Studio 2015 cache/options directory 26 - .vs/ 27 - # Uncomment if you have tasks that create the project's static files in wwwroot 28 - #wwwroot/ 29 - 30 - # MSTest test Results 31 - [Tt]est[Rr]esult*/ 32 - [Bb]uild[Ll]og.* 33 - 34 - # NUNIT 35 - *.VisualState.xml 36 - TestResult.xml 37 - 38 - # Build Results of an ATL Project 39 - [Dd]ebugPS/ 40 - [Rr]eleasePS/ 41 - dlldata.c 42 - 43 - # DNX 44 - project.lock.json 45 - artifacts/ 46 - 47 - *_i.c 48 - *_p.c 49 - *_i.h 50 - *.ilk 51 - *.meta 52 - *.obj 53 - *.pch 54 - *.pdb 55 - *.pgc 56 - *.pgd 57 - *.rsp 58 - *.sbr 59 - *.tlb 60 - *.tli 61 - *.tlh 62 - *.tmp 63 - *.tmp_proj 64 - *.log 65 - *.vspscc 66 - *.vssscc 67 - .builds 68 - *.pidb 69 - *.svclog 70 - *.scc 71 - 72 - # Chutzpah Test files 73 - _Chutzpah* 74 - 75 - # Visual C++ cache files 76 - ipch/ 77 - *.aps 78 - *.ncb 79 - *.opendb 80 - *.opensdf 81 - *.sdf 82 - *.cachefile 83 - *.VC.db 84 - *.VC.VC.opendb 85 - 86 - # Visual Studio profiler 87 - *.psess 88 - *.vsp 89 - *.vspx 90 - *.sap 91 - 92 - # TFS 2012 Local Workspace 93 - $tf/ 94 - 95 - # Guidance Automation Toolkit 96 - *.gpState 97 - 98 - # ReSharper is a .NET coding add-in 99 - _ReSharper*/ 100 - *.[Rr]e[Ss]harper 101 - *.DotSettings.user 102 - 103 - # JustCode is a .NET coding add-in 104 - .JustCode 105 - 106 - # TeamCity is a build add-in 107 - _TeamCity* 108 - 109 - # DotCover is a Code Coverage Tool 110 - *.dotCover 111 - 112 - # NCrunch 113 - _NCrunch_* 114 - .*crunch*.local.xml 115 - nCrunchTemp_* 116 - 117 - # MightyMoose 118 - *.mm.* 119 - AutoTest.Net/ 120 - 121 - # Web workbench (sass) 122 - .sass-cache/ 123 - 124 - # Installshield output folder 125 - [Ee]xpress/ 126 - 127 - # DocProject is a documentation generator add-in 128 - DocProject/buildhelp/ 129 - DocProject/Help/*.HxT 130 - DocProject/Help/*.HxC 131 - DocProject/Help/*.hhc 132 - DocProject/Help/*.hhk 133 - DocProject/Help/*.hhp 134 - DocProject/Help/Html2 135 - DocProject/Help/html 136 - 137 - # Click-Once directory 138 - publish/ 139 - 140 - # Publish Web Output 141 - *.[Pp]ublish.xml 142 - *.azurePubxml 143 - # TODO: Comment the next line if you want to checkin your web deploy settings 144 - # but database connection strings (with potential passwords) will be unencrypted 145 - *.pubxml 146 - *.publishproj 147 - 148 - # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 - # checkin your Azure Web App publish settings, but sensitive information contained 150 - # in these scripts will be unencrypted 151 - PublishScripts/ 152 - 153 - # NuGet Packages 154 - *.nupkg 155 - # The packages folder can be ignored because of Package Restore 156 - **/packages/* 157 - # except build/, which is used as an MSBuild target. 158 - !**/packages/build/ 159 - # Uncomment if necessary however generally it will be regenerated when needed 160 - #!**/packages/repositories.config 161 - # NuGet v3's project.json files produces more ignoreable files 162 - *.nuget.props 163 - *.nuget.targets 164 - 165 - # Microsoft Azure Build Output 166 - csx/ 167 - *.build.csdef 168 - 169 - # Microsoft Azure Emulator 170 - ecf/ 171 - rcf/ 172 - 173 - # Windows Store app package directories and files 174 - AppPackages/ 175 - BundleArtifacts/ 176 - Package.StoreAssociation.xml 177 - _pkginfo.txt 178 - 179 - # Visual Studio cache files 180 - # files ending in .cache can be ignored 181 - *.[Cc]ache 182 - # but keep track of directories ending in .cache 183 - !*.[Cc]ache/ 184 - 185 - # Others 186 - ClientBin/ 187 - ~$* 188 - *~ 189 - *.dbmdl 190 - *.dbproj.schemaview 191 - *.pfx 192 - *.publishsettings 193 - node_modules/ 194 - orleans.codegen.cs 195 - 196 - # Since there are multiple workflows, uncomment next line to ignore bower_components 197 - # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 - #bower_components/ 199 - 200 - # RIA/Silverlight projects 201 - Generated_Code/ 202 - 203 - # Backup & report files from converting an old project file 204 - # to a newer Visual Studio version. Backup files are not needed, 205 - # because we have git ;-) 206 - _UpgradeReport_Files/ 207 - Backup*/ 208 - UpgradeLog*.XML 209 - UpgradeLog*.htm 210 - 211 - # SQL Server files 212 - *.mdf 213 - *.ldf 214 - 215 - # Business Intelligence projects 216 - *.rdl.data 217 - *.bim.layout 218 - *.bim_*.settings 219 - 220 - # Microsoft Fakes 221 - FakesAssemblies/ 222 - 223 - # GhostDoc plugin setting file 224 - *.GhostDoc.xml 225 - 226 - # Node.js Tools for Visual Studio 227 - .ntvs_analysis.dat 228 - 229 - # Visual Studio 6 build log 230 - *.plg 231 - 232 - # Visual Studio 6 workspace options file 233 - *.opt 234 - 235 - # Visual Studio LightSwitch build output 236 - **/*.HTMLClient/GeneratedArtifacts 237 - **/*.DesktopClient/GeneratedArtifacts 238 - **/*.DesktopClient/ModelManifest.xml 239 - **/*.Server/GeneratedArtifacts 240 - **/*.Server/ModelManifest.xml 241 - _Pvt_Extensions 242 - 243 - # Paket dependency manager 244 - .paket/paket.exe 245 - paket-files/ 246 - 247 - # FAKE - F# Make 248 - .fake/ 249 - 250 - # JetBrains Rider 251 - .idea/ 252 - *.sln.iml 253 - *.out 254 - *.o 255 - /test 256 - 257 - # Gradle 258 - .gradle/
+8
src/external/jnipp/CHANGELOG.md
··· 1 + # Changelog for jnipp 2 + 3 + ## jnipp 1.0.0 (25-October-2023) 4 + 5 + This release is somewhat of a formality, as jnipp has been used in production 6 + environments for some time. It was prompted by the need for an API breaking 7 + change to ensure continued compatibility with libc++ as they move to more 8 + strictly follow the C++ standard.
+1 -1
src/external/jnipp/build.gradle
··· 1 1 apply plugin: 'com.android.library' 2 2 3 3 android { 4 - compileSdk 26 4 + compileSdkVersion 26 5 5 buildToolsVersion '28.0.3' 6 6 7 7 defaultConfig {
src/external/jnipp/changes/additions/.gitkeep

This is a binary file and will not be displayed.

src/external/jnipp/changes/changes/.gitkeep

This is a binary file and will not be displayed.

+1
src/external/jnipp/changes/changes/pr.40.md
··· 1 + Stop using `std::basic_string<jchar>` internally, because it is `std::basic_string<unsigned short>` on some platforms, and this specialization is not technically provided by the standard library. libc++ is removing support for it, so this internal change is required to continue to compile against libc++. In place of it, use `std::vector<jchar>`.
src/external/jnipp/changes/fixes/.gitkeep

This is a binary file and will not be displayed.

+1
src/external/jnipp/changes/fixes/pr.49.md
··· 1 + Do not allow exceptions to escape destructors.
-10
src/external/jnipp/dotest.sh
··· 1 - #!/bin/sh 2 - set -e 3 - ( 4 - cd $(dirname $0) 5 - export JAVA_HOME=/home/ryan/apps/android-studio/jre/ 6 - make "$@" 7 - if [ -x ./test ]; then 8 - ./test 9 - fi 10 - )
+45 -30
src/external/jnipp/jnipp.cpp
··· 8 8 # include <dlfcn.h> 9 9 # include <unistd.h> 10 10 # include <tuple> 11 + # include <stdlib.h> 11 12 #endif 12 13 13 14 // External Dependencies ··· 16 17 // Standard Dependencies 17 18 #include <atomic> 18 19 #include <string> 20 + #include <vector> 19 21 20 22 // Local Dependencies 21 23 #include "jnipp.h" ··· 43 45 ScopedEnv() noexcept : _vm(nullptr), _env(nullptr), _attached(false) {} 44 46 ~ScopedEnv(); 45 47 48 + // Caution - throws if VM is nullptr! 46 49 void init(JavaVM* vm); 47 50 JNIEnv* get() const noexcept { return _env; } 48 51 ··· 129 132 /** 130 133 Convert from a UTF-32 string to a UTF-16 Java string. 131 134 */ 132 - std::basic_string<jchar> toJString(const wchar_t* str, size_t length) 135 + std::vector<jchar> toJString(const wchar_t* str, size_t length) 133 136 { 134 - std::basic_string<jchar> result; 137 + std::vector<jchar> result; 135 138 136 139 result.reserve(length * 2); // Worst case scenario. 137 140 ··· 144 147 ch -= uint32_t(0x10000); 145 148 146 149 // Add the first of the two-segment character. 147 - result += jchar(0xD800 + (ch >> 10)); 150 + result.push_back(jchar(0xD800 + (ch >> 10))); 148 151 ch = wchar_t(0xDC00) + (ch & 0x03FF); 149 152 } 150 153 151 - result += jchar(ch); 154 + result.push_back(jchar(ch)); 152 155 } 153 156 154 157 return result; ··· 156 159 157 160 #endif // _WIN32 158 161 159 - static bool isEnvChanged(JavaVM* vm, ScopedEnv& threadLocalEnv) { 160 - if (vm == nullptr) 161 - { 162 - return false; 163 - } 164 - JNIEnv *curEnv = nullptr; 165 - getEnv(vm, &curEnv); 166 - return curEnv != threadLocalEnv.get(); 162 + static ScopedEnv &scopedEnvInstance() noexcept 163 + { 164 + static thread_local ScopedEnv env; 165 + return env; 167 166 } 168 167 169 - 170 - JNIEnv* env() 168 + // may return nullptr, beware! 169 + JNIEnv *env_noexcept() noexcept 171 170 { 172 - static thread_local ScopedEnv env; 173 - 174 - if (env.get() != nullptr && (!isAttached(javaVm) || isEnvChanged(javaVm, env))) 171 + ScopedEnv& env = scopedEnvInstance(); 172 + if (env.get() != nullptr && !isAttached(javaVm)) 175 173 { 176 174 // we got detached, so clear it. 177 175 // will be re-populated from static javaVm below. 178 176 env = ScopedEnv{}; 179 177 } 180 178 181 - if (env.get() == nullptr) 179 + if (env.get() == nullptr && javaVm != nullptr) 182 180 { 183 181 env.init(javaVm); 184 182 } ··· 186 184 return env.get(); 187 185 } 188 186 187 + JNIEnv* env() 188 + { 189 + JNIEnv *ret = env_noexcept(); 190 + if (ret == nullptr) 191 + { 192 + throw InitializationException("JNI not initialized"); 193 + } 194 + 195 + return ret; 196 + } 197 + 189 198 static jclass findClass(const char* name) 190 199 { 191 200 jclass ref = env()->FindClass(name); ··· 317 326 318 327 Object::~Object() noexcept 319 328 { 320 - JNIEnv* env; 321 - try { 322 - env = jni::env(); 323 - } catch (const jni::InitializationException &) { 329 + JNIEnv* env = jni::env_noexcept(); 330 + if (env == nullptr) 331 + { 324 332 // Better be empty. Cannot do anything useful. 325 333 return; 326 334 } ··· 482 490 return Object(result, DeleteLocalInput); 483 491 } 484 492 493 + jarray Object::callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<jarray> const&) const 494 + { 495 + auto result = env()->CallObjectMethodA(_handle, method, (jvalue*) args); 496 + handleJavaExceptions(); 497 + return (jarray)result; 498 + } 499 + 485 500 byte_t Object::getFieldValue(field_t field, internal::ReturnTypeWrapper<byte_t> const&) const 486 501 { 487 502 return env()->GetByteField(_handle, field); ··· 584 599 jobject handle = env->NewString((const jchar*) value.c_str(), jsize(value.length())); 585 600 #else 586 601 auto jstr = toJString(value.c_str(), value.length()); 587 - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); 602 + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); 588 603 #endif 589 604 env->SetObjectField(_handle, field, handle); 590 605 env->DeleteLocalRef(handle); ··· 597 612 jobject handle = env->NewString((const jchar*) value, jsize(std::wcslen(value))); 598 613 #else 599 614 auto jstr = toJString(value, std::wcslen(value)); 600 - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); 615 + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); 601 616 #endif 602 617 env->SetObjectField(_handle, field, handle); 603 618 env->DeleteLocalRef(handle); ··· 651 666 return Class(getClass(), Temporary).getField(name, signature); 652 667 } 653 668 654 - jobject Object::makeLocalReference() const 669 + jobject Object::makeLocalReference() const 655 670 { 656 671 if (isNull()) 657 672 return nullptr; ··· 881 896 jobject handle = env->NewString((const jchar*) value.c_str(), jsize(value.length())); 882 897 #else 883 898 auto jstr = toJString(value.c_str(), value.length()); 884 - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); 899 + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); 885 900 #endif 886 901 env->SetStaticObjectField(getHandle(), field, handle); 887 902 env->DeleteLocalRef(handle); ··· 1287 1302 jobject jvalue = env->NewString((const jchar*) value.c_str(), jsize(value.length())); 1288 1303 #else 1289 1304 auto jstr = toJString(value.c_str(), value.length()); 1290 - jobject jvalue = env->NewString(jstr.c_str(), jsize(jstr.length())); 1305 + jobject jvalue = env->NewString(jstr.data(), jsize(jstr.size())); 1291 1306 #endif 1292 1307 env->SetObjectArrayElement(jobjectArray(getHandle()), index, jvalue); 1293 1308 env->DeleteLocalRef(jvalue); ··· 1532 1547 JNIEnv* env(); 1533 1548 1534 1549 #ifndef _WIN32 1535 - extern std::basic_string<jchar> toJString(const wchar_t* str, size_t length); 1550 + extern std::vector<jchar> toJString(const wchar_t* str, size_t length); 1536 1551 #endif 1537 1552 1538 1553 namespace internal ··· 1613 1628 void valueArg(value_t* v, const std::wstring& a) 1614 1629 { 1615 1630 auto jstr = toJString(a.c_str(), a.length()); 1616 - ((jvalue*) v)->l = env()->NewString(jstr.c_str(), jsize(jstr.length())); 1631 + ((jvalue*) v)->l = env()->NewString(jstr.data(), jsize(jstr.size())); 1617 1632 } 1618 1633 1619 1634 void valueArg(value_t* v, const wchar_t* a) 1620 1635 { 1621 1636 auto jstr = toJString(a, std::wcslen(a)); 1622 - ((jvalue*) v)->l = env()->NewString(jstr.c_str(), jsize(jstr.length())); 1637 + ((jvalue*) v)->l = env()->NewString(jstr.data(), jsize(jstr.size())); 1623 1638 } 1624 1639 1625 1640 #endif
+18
src/external/jnipp/jnipp.h
··· 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 ··· 102 103 inline std::string valueSig(const wchar_t* const*) { return "Ljava/lang/String;"; } 103 104 std::string valueSig(const Object* obj); 104 105 inline std::string valueSig(const Object* const* obj) { return valueSig(obj ? *obj : nullptr); } 106 + 107 + template <class TArg> 108 + inline std::string valueSig(const Array<TArg>*) { return "[" + valueSig((TArg*) nullptr); } 105 109 106 110 template <int n, class TArg> 107 111 inline std::string valueSig(const TArg(*arg)[n]) { return valueSig((const TArg* const*)arg); } ··· 452 456 std::string callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<std::string> const&) const; 453 457 std::wstring callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<std::wstring> const&) const; 454 458 jni::Object callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<jni::Object> const&) const; 459 + jarray callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<jarray> const&) const; 455 460 461 + template<typename T> 462 + jni::Array<T> callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper<jni::Array<T>> const&) const; 456 463 457 464 void getFieldValue(field_t field, internal::ReturnTypeWrapper<void> const&) const; 458 465 bool getFieldValue(field_t field, internal::ReturnTypeWrapper<bool> const&) const; ··· 1024 1031 */ 1025 1032 InitializationException(const char* msg) : Exception(msg) {} 1026 1033 }; 1034 + 1035 + /* 1036 + Call method returning array: implementation 1037 + */ 1038 + template <typename T> 1039 + inline jni::Array<T> Object::callMethod(method_t method, internal::value_t* args, 1040 + internal::ReturnTypeWrapper<jni::Array<T>> const&) const 1041 + { 1042 + jarray result = callMethod(method, args, internal::ReturnTypeWrapper<jarray>{}); 1043 + return jni::Array<T>(result, DeleteLocalInput); 1044 + } 1027 1045 1028 1046 /* 1029 1047 Array Implementation
-45
src/external/jnipp/jnipp.sln
··· 1 -  2 - Microsoft Visual Studio Solution File, Format Version 12.00 3 - # Visual Studio 14 4 - VisualStudioVersion = 14.0.25420.1 5 - MinimumVisualStudioVersion = 10.0.40219.1 6 - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jnipp", "jnipp.vcxproj", "{A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}" 7 - EndProject 8 - Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{5A4C5782-6F86-4413-9E19-3F6539DCD835}" 9 - ProjectSection(SolutionItems) = preProject 10 - LICENSE = LICENSE 11 - makefile = makefile 12 - README.md = README.md 13 - EndProjectSection 14 - EndProject 15 - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\tests.vcxproj", "{911DB449-3D76-4261-8FFD-9BA508ED1D5B}" 16 - EndProject 17 - Global 18 - GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 - Debug|x64 = Debug|x64 20 - Debug|x86 = Debug|x86 21 - Release|x64 = Release|x64 22 - Release|x86 = Release|x86 23 - EndGlobalSection 24 - GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x64.ActiveCfg = Debug|x64 26 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x64.Build.0 = Debug|x64 27 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x86.ActiveCfg = Debug|Win32 28 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x86.Build.0 = Debug|Win32 29 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x64.ActiveCfg = Release|x64 30 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x64.Build.0 = Release|x64 31 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x86.ActiveCfg = Release|Win32 32 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x86.Build.0 = Release|Win32 33 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x64.ActiveCfg = Debug|x64 34 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x64.Build.0 = Debug|x64 35 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x86.ActiveCfg = Debug|Win32 36 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x86.Build.0 = Debug|Win32 37 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x64.ActiveCfg = Release|x64 38 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x64.Build.0 = Release|x64 39 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x86.ActiveCfg = Release|Win32 40 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x86.Build.0 = Release|Win32 41 - EndGlobalSection 42 - GlobalSection(SolutionProperties) = preSolution 43 - HideSolutionNode = FALSE 44 - EndGlobalSection 45 - EndGlobal
+20
src/external/jnipp/proclamation.json
··· 1 + { 2 + "#": "This is a config file for Proclamation, the changelog combiner: https://gitlab.com/proclamation/proclamation", 3 + "SPDX-License-Identifier: CC0-1.0": "", 4 + "SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the Proclamation contributors": "", 5 + "$schema": "https://proclamation.gitlab.io/proclamation/proclamation.schema.json", 6 + "project_name": "jnipp", 7 + "base_url": "https://github.com/mitchdowd/jnipp", 8 + "news_filename": "CHANGELOG.md", 9 + "sections": { 10 + "Changes": { 11 + "directory": "changes/templates" 12 + }, 13 + "Fixes": { 14 + "directory": "changes/misc" 15 + }, 16 + "Additions": { 17 + "directory": "changes/script" 18 + } 19 + } 20 + }
+24
src/external/jnipp/tests/main.cpp
··· 203 203 jni::Object Tests 204 204 */ 205 205 206 + // Must run before loading JVM 207 + TEST(Object_noDestructorException) 208 + { 209 + jni::Object o; 210 + } 206 211 207 212 TEST(Object_defaultConstructor_isNull) 208 213 { ··· 302 307 303 308 ASSERT(str.call<wchar_t>("charAt", 1) == L'e'); 304 309 ASSERT(str2.call<wchar_t>("charAt", 1) == L'e'); 310 + } 311 + 312 + TEST(Object_call_returningArray) { 313 + jni::Object str = jni::Class("java/lang/String").newInstance("Testing"); 314 + 315 + { 316 + auto getBytes = 317 + jni::Class("java/lang/String").getMethod("getBytes", "()[B"); 318 + auto bytes = str.call<jni::Array<jni::byte_t>>(getBytes); 319 + ASSERT(bytes.getLength() == 7); 320 + } 321 + { 322 + auto bytes = str.call<jni::Array<jni::byte_t>>("getBytes"); 323 + ASSERT(bytes.getLength() == 7); 324 + } 305 325 } 306 326 307 327 TEST(Object_makeLocalReference) ··· 559 579 560 580 int main() 561 581 { 582 + // Tests that depend on having no JVM 583 + RUN_TEST(Object_noDestructorException); 584 + 562 585 // jni::Vm Tests 563 586 RUN_TEST(Vm_detectsJreInstall); 564 587 RUN_TEST(Vm_notAllowedMultipleVms); ··· 593 616 RUN_TEST(Object_call_byName); 594 617 RUN_TEST(Object_call_withArgs); 595 618 RUN_TEST(Object_call_byNameWithArgs); 619 + RUN_TEST(Object_call_returningArray); 596 620 RUN_TEST(Object_makeLocalReference); 597 621 598 622 // jni::Enum Tests