From 0c2992ea79aeb514a72a01771b71e6edc79bb02a Mon Sep 17 00:00:00 2001 From: Rylie Pavlik Date: Mon, 4 Nov 2024 11:31:01 -0800 Subject: [PATCH] Update jnipp from upstream v1.0.0-13-gcdd6293 JNIPP_REV_ID: cdd6293fca985993129f5ef5441709fc49ee507f Part-of: --- src/external/jnipp/.editorconfig | 5 - src/external/jnipp/.gitignore | 258 ------------------ src/external/jnipp/CHANGELOG.md | 8 + src/external/jnipp/build.gradle | 2 +- src/external/jnipp/changes/additions/.gitkeep | 0 src/external/jnipp/changes/changes/.gitkeep | 0 src/external/jnipp/changes/changes/pr.40.md | 1 + src/external/jnipp/changes/fixes/.gitkeep | 0 src/external/jnipp/changes/fixes/pr.49.md | 1 + src/external/jnipp/dotest.sh | 10 - src/external/jnipp/jnipp.cpp | 75 +++-- src/external/jnipp/jnipp.h | 18 ++ src/external/jnipp/jnipp.sln | 45 --- src/external/jnipp/proclamation.json | 20 ++ src/external/jnipp/tests/main.cpp | 24 ++ 15 files changed, 118 insertions(+), 349 deletions(-) delete mode 100644 src/external/jnipp/.editorconfig delete mode 100644 src/external/jnipp/.gitignore create mode 100644 src/external/jnipp/CHANGELOG.md create mode 100644 src/external/jnipp/changes/additions/.gitkeep create mode 100644 src/external/jnipp/changes/changes/.gitkeep create mode 100644 src/external/jnipp/changes/changes/pr.40.md create mode 100644 src/external/jnipp/changes/fixes/.gitkeep create mode 100644 src/external/jnipp/changes/fixes/pr.49.md delete mode 100755 src/external/jnipp/dotest.sh delete mode 100644 src/external/jnipp/jnipp.sln create mode 100644 src/external/jnipp/proclamation.json diff --git a/src/external/jnipp/.editorconfig b/src/external/jnipp/.editorconfig deleted file mode 100644 index b532cc51a..000000000 --- a/src/external/jnipp/.editorconfig +++ /dev/null @@ -1,5 +0,0 @@ - -[.h,.cpp] -indent_size = 4 -indent_style = space -trim_trailing_whitespace = true diff --git a/src/external/jnipp/.gitignore b/src/external/jnipp/.gitignore deleted file mode 100644 index f6233e2c5..000000000 --- a/src/external/jnipp/.gitignore +++ /dev/null @@ -1,258 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml -*.out -*.o -/test - -# Gradle -.gradle/ diff --git a/src/external/jnipp/CHANGELOG.md b/src/external/jnipp/CHANGELOG.md new file mode 100644 index 000000000..18851fcb1 --- /dev/null +++ b/src/external/jnipp/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog for jnipp + +## jnipp 1.0.0 (25-October-2023) + +This release is somewhat of a formality, as jnipp has been used in production +environments for some time. It was prompted by the need for an API breaking +change to ensure continued compatibility with libc++ as they move to more +strictly follow the C++ standard. diff --git a/src/external/jnipp/build.gradle b/src/external/jnipp/build.gradle index c40dd49a8..a17e95a70 100644 --- a/src/external/jnipp/build.gradle +++ b/src/external/jnipp/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { - compileSdk 26 + compileSdkVersion 26 buildToolsVersion '28.0.3' defaultConfig { diff --git a/src/external/jnipp/changes/additions/.gitkeep b/src/external/jnipp/changes/additions/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/external/jnipp/changes/changes/.gitkeep b/src/external/jnipp/changes/changes/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/external/jnipp/changes/changes/pr.40.md b/src/external/jnipp/changes/changes/pr.40.md new file mode 100644 index 000000000..e5abd8242 --- /dev/null +++ b/src/external/jnipp/changes/changes/pr.40.md @@ -0,0 +1 @@ +Stop using `std::basic_string` internally, because it is `std::basic_string` 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`. diff --git a/src/external/jnipp/changes/fixes/.gitkeep b/src/external/jnipp/changes/fixes/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/external/jnipp/changes/fixes/pr.49.md b/src/external/jnipp/changes/fixes/pr.49.md new file mode 100644 index 000000000..c77aba77a --- /dev/null +++ b/src/external/jnipp/changes/fixes/pr.49.md @@ -0,0 +1 @@ +Do not allow exceptions to escape destructors. diff --git a/src/external/jnipp/dotest.sh b/src/external/jnipp/dotest.sh deleted file mode 100755 index 505663be4..000000000 --- a/src/external/jnipp/dotest.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e -( - cd $(dirname $0) - export JAVA_HOME=/home/ryan/apps/android-studio/jre/ - make "$@" - if [ -x ./test ]; then - ./test - fi -) diff --git a/src/external/jnipp/jnipp.cpp b/src/external/jnipp/jnipp.cpp index 15838a68b..a6c656a6e 100644 --- a/src/external/jnipp/jnipp.cpp +++ b/src/external/jnipp/jnipp.cpp @@ -8,6 +8,7 @@ # include # include # include +# include #endif // External Dependencies @@ -16,6 +17,7 @@ // Standard Dependencies #include #include +#include // Local Dependencies #include "jnipp.h" @@ -43,6 +45,7 @@ namespace jni ScopedEnv() noexcept : _vm(nullptr), _env(nullptr), _attached(false) {} ~ScopedEnv(); + // Caution - throws if VM is nullptr! void init(JavaVM* vm); JNIEnv* get() const noexcept { return _env; } @@ -129,9 +132,9 @@ namespace jni /** Convert from a UTF-32 string to a UTF-16 Java string. */ - std::basic_string toJString(const wchar_t* str, size_t length) + std::vector toJString(const wchar_t* str, size_t length) { - std::basic_string result; + std::vector result; result.reserve(length * 2); // Worst case scenario. @@ -144,11 +147,11 @@ namespace jni ch -= uint32_t(0x10000); // Add the first of the two-segment character. - result += jchar(0xD800 + (ch >> 10)); + result.push_back(jchar(0xD800 + (ch >> 10))); ch = wchar_t(0xDC00) + (ch & 0x03FF); } - result += jchar(ch); + result.push_back(jchar(ch)); } return result; @@ -156,29 +159,24 @@ namespace jni #endif // _WIN32 - static bool isEnvChanged(JavaVM* vm, ScopedEnv& threadLocalEnv) { - if (vm == nullptr) - { - return false; - } - JNIEnv *curEnv = nullptr; - getEnv(vm, &curEnv); - return curEnv != threadLocalEnv.get(); - } - - - JNIEnv* env() + static ScopedEnv &scopedEnvInstance() noexcept { static thread_local ScopedEnv env; + return env; + } - if (env.get() != nullptr && (!isAttached(javaVm) || isEnvChanged(javaVm, env))) + // may return nullptr, beware! + JNIEnv *env_noexcept() noexcept + { + ScopedEnv& env = scopedEnvInstance(); + if (env.get() != nullptr && !isAttached(javaVm)) { // we got detached, so clear it. // will be re-populated from static javaVm below. env = ScopedEnv{}; } - if (env.get() == nullptr) + if (env.get() == nullptr && javaVm != nullptr) { env.init(javaVm); } @@ -186,6 +184,17 @@ namespace jni return env.get(); } + JNIEnv* env() + { + JNIEnv *ret = env_noexcept(); + if (ret == nullptr) + { + throw InitializationException("JNI not initialized"); + } + + return ret; + } + static jclass findClass(const char* name) { jclass ref = env()->FindClass(name); @@ -317,10 +326,9 @@ namespace jni Object::~Object() noexcept { - JNIEnv* env; - try { - env = jni::env(); - } catch (const jni::InitializationException &) { + JNIEnv* env = jni::env_noexcept(); + if (env == nullptr) + { // Better be empty. Cannot do anything useful. return; } @@ -482,6 +490,13 @@ namespace jni return Object(result, DeleteLocalInput); } + jarray Object::callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper const&) const + { + auto result = env()->CallObjectMethodA(_handle, method, (jvalue*) args); + handleJavaExceptions(); + return (jarray)result; + } + byte_t Object::getFieldValue(field_t field, internal::ReturnTypeWrapper const&) const { return env()->GetByteField(_handle, field); @@ -584,7 +599,7 @@ namespace jni jobject handle = env->NewString((const jchar*) value.c_str(), jsize(value.length())); #else auto jstr = toJString(value.c_str(), value.length()); - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); #endif env->SetObjectField(_handle, field, handle); env->DeleteLocalRef(handle); @@ -597,7 +612,7 @@ namespace jni jobject handle = env->NewString((const jchar*) value, jsize(std::wcslen(value))); #else auto jstr = toJString(value, std::wcslen(value)); - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); #endif env->SetObjectField(_handle, field, handle); env->DeleteLocalRef(handle); @@ -651,7 +666,7 @@ namespace jni return Class(getClass(), Temporary).getField(name, signature); } - jobject Object::makeLocalReference() const + jobject Object::makeLocalReference() const { if (isNull()) return nullptr; @@ -881,7 +896,7 @@ namespace jni jobject handle = env->NewString((const jchar*) value.c_str(), jsize(value.length())); #else auto jstr = toJString(value.c_str(), value.length()); - jobject handle = env->NewString(jstr.c_str(), jsize(jstr.length())); + jobject handle = env->NewString(jstr.data(), jsize(jstr.size())); #endif env->SetStaticObjectField(getHandle(), field, handle); env->DeleteLocalRef(handle); @@ -1287,7 +1302,7 @@ namespace jni jobject jvalue = env->NewString((const jchar*) value.c_str(), jsize(value.length())); #else auto jstr = toJString(value.c_str(), value.length()); - jobject jvalue = env->NewString(jstr.c_str(), jsize(jstr.length())); + jobject jvalue = env->NewString(jstr.data(), jsize(jstr.size())); #endif env->SetObjectArrayElement(jobjectArray(getHandle()), index, jvalue); env->DeleteLocalRef(jvalue); @@ -1532,7 +1547,7 @@ namespace jni JNIEnv* env(); #ifndef _WIN32 - extern std::basic_string toJString(const wchar_t* str, size_t length); + extern std::vector toJString(const wchar_t* str, size_t length); #endif namespace internal @@ -1613,13 +1628,13 @@ namespace jni void valueArg(value_t* v, const std::wstring& a) { auto jstr = toJString(a.c_str(), a.length()); - ((jvalue*) v)->l = env()->NewString(jstr.c_str(), jsize(jstr.length())); + ((jvalue*) v)->l = env()->NewString(jstr.data(), jsize(jstr.size())); } void valueArg(value_t* v, const wchar_t* a) { auto jstr = toJString(a, std::wcslen(a)); - ((jvalue*) v)->l = env()->NewString(jstr.c_str(), jsize(jstr.length())); + ((jvalue*) v)->l = env()->NewString(jstr.data(), jsize(jstr.size())); } #endif diff --git a/src/external/jnipp/jnipp.h b/src/external/jnipp/jnipp.h index 017bdd923..0cda2dd43 100644 --- a/src/external/jnipp/jnipp.h +++ b/src/external/jnipp/jnipp.h @@ -73,6 +73,7 @@ namespace jni // Foward Declarations class Object; + template class Array; /** This namespace is for messy implementation details only. It is not a part @@ -103,6 +104,9 @@ namespace jni std::string valueSig(const Object* obj); inline std::string valueSig(const Object* const* obj) { return valueSig(obj ? *obj : nullptr); } + template + inline std::string valueSig(const Array*) { return "[" + valueSig((TArg*) nullptr); } + template inline std::string valueSig(const TArg(*arg)[n]) { return valueSig((const TArg* const*)arg); } @@ -452,7 +456,10 @@ namespace jni std::string callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper const&) const; std::wstring callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper const&) const; jni::Object callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper const&) const; + jarray callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper const&) const; + template + jni::Array callMethod(method_t method, internal::value_t* args, internal::ReturnTypeWrapper> const&) const; void getFieldValue(field_t field, internal::ReturnTypeWrapper const&) const; bool getFieldValue(field_t field, internal::ReturnTypeWrapper const&) const; @@ -1025,6 +1032,17 @@ namespace jni InitializationException(const char* msg) : Exception(msg) {} }; + /* + Call method returning array: implementation + */ + template + inline jni::Array Object::callMethod(method_t method, internal::value_t* args, + internal::ReturnTypeWrapper> const&) const + { + jarray result = callMethod(method, args, internal::ReturnTypeWrapper{}); + return jni::Array(result, DeleteLocalInput); + } + /* Array Implementation */ diff --git a/src/external/jnipp/jnipp.sln b/src/external/jnipp/jnipp.sln deleted file mode 100644 index 7747be98c..000000000 --- a/src/external/jnipp/jnipp.sln +++ /dev/null @@ -1,45 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jnipp", "jnipp.vcxproj", "{A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{5A4C5782-6F86-4413-9E19-3F6539DCD835}" - ProjectSection(SolutionItems) = preProject - LICENSE = LICENSE - makefile = makefile - README.md = README.md - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\tests.vcxproj", "{911DB449-3D76-4261-8FFD-9BA508ED1D5B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x64.ActiveCfg = Debug|x64 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x64.Build.0 = Debug|x64 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x86.ActiveCfg = Debug|Win32 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Debug|x86.Build.0 = Debug|Win32 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x64.ActiveCfg = Release|x64 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x64.Build.0 = Release|x64 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x86.ActiveCfg = Release|Win32 - {A32D4B7D-7009-4C87-9DE8-D7DB659F5B58}.Release|x86.Build.0 = Release|Win32 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x64.ActiveCfg = Debug|x64 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x64.Build.0 = Debug|x64 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x86.ActiveCfg = Debug|Win32 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Debug|x86.Build.0 = Debug|Win32 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x64.ActiveCfg = Release|x64 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x64.Build.0 = Release|x64 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x86.ActiveCfg = Release|Win32 - {911DB449-3D76-4261-8FFD-9BA508ED1D5B}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/external/jnipp/proclamation.json b/src/external/jnipp/proclamation.json new file mode 100644 index 000000000..f2fed6276 --- /dev/null +++ b/src/external/jnipp/proclamation.json @@ -0,0 +1,20 @@ +{ + "#": "This is a config file for Proclamation, the changelog combiner: https://gitlab.com/proclamation/proclamation", + "SPDX-License-Identifier: CC0-1.0": "", + "SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the Proclamation contributors": "", + "$schema": "https://proclamation.gitlab.io/proclamation/proclamation.schema.json", + "project_name": "jnipp", + "base_url": "https://github.com/mitchdowd/jnipp", + "news_filename": "CHANGELOG.md", + "sections": { + "Changes": { + "directory": "changes/templates" + }, + "Fixes": { + "directory": "changes/misc" + }, + "Additions": { + "directory": "changes/script" + } + } +} diff --git a/src/external/jnipp/tests/main.cpp b/src/external/jnipp/tests/main.cpp index 7c1adfcb1..d92e0bd09 100644 --- a/src/external/jnipp/tests/main.cpp +++ b/src/external/jnipp/tests/main.cpp @@ -203,6 +203,11 @@ TEST(Class_call_staticMethod_byName) jni::Object Tests */ +// Must run before loading JVM +TEST(Object_noDestructorException) +{ + jni::Object o; +} TEST(Object_defaultConstructor_isNull) { @@ -304,6 +309,21 @@ TEST(Object_call_byNameWithArgs) ASSERT(str2.call("charAt", 1) == L'e'); } +TEST(Object_call_returningArray) { + jni::Object str = jni::Class("java/lang/String").newInstance("Testing"); + + { + auto getBytes = + jni::Class("java/lang/String").getMethod("getBytes", "()[B"); + auto bytes = str.call>(getBytes); + ASSERT(bytes.getLength() == 7); + } + { + auto bytes = str.call>("getBytes"); + ASSERT(bytes.getLength() == 7); + } +} + TEST(Object_makeLocalReference) { jni::Object str = jni::Class("java/lang/String").newInstance("Testing"); @@ -559,6 +579,9 @@ TEST(Arg_ObjectPtr) int main() { + // Tests that depend on having no JVM + RUN_TEST(Object_noDestructorException); + // jni::Vm Tests RUN_TEST(Vm_detectsJreInstall); RUN_TEST(Vm_notAllowedMultipleVms); @@ -593,6 +616,7 @@ int main() RUN_TEST(Object_call_byName); RUN_TEST(Object_call_withArgs); RUN_TEST(Object_call_byNameWithArgs); + RUN_TEST(Object_call_returningArray); RUN_TEST(Object_makeLocalReference); // jni::Enum Tests -- 2.51.2