From 1546078fc1b8ad53458bb84b41b40be4388cc1ee Mon Sep 17 00:00:00 2001 From: Joe Ferner Date: Thu, 16 Oct 2025 18:58:27 -0400 Subject: [PATCH] support node 24 --- .devcontainer/Dockerfile | 2 +- .github/workflows/master.yml | 2 +- .github/workflows/pull-requests.yml | 2 +- .gitignore | 1 + README.md | 2 +- package-lock.json | 7 +++++++ src-cpp/javaObject.cpp | 3 ++- src-cpp/utils.h | 8 ++++++++ 8 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 789d8e2..5645602 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/javascript-node:22 +FROM mcr.microsoft.com/devcontainers/javascript-node:24 # need to run update and install at the same time to prevent stale update layer RUN apt-get update && apt-get install -y gdb clang-format openjdk-21-jdk maven diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 8760a14..fbfa09d 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - nodeVersion: [ 20, 22 ] + nodeVersion: [ 20, 22, 24 ] jdkVersion: [ openjdk9, openjdk10, openjdk11, openjdk21 ] steps: - name: Checkout source code diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index ca1c419..2d20d7f 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - nodeVersion: [ 20, 22 ] + nodeVersion: [ 20, 22, 24 ] jdkVersion: [ openjdk9, openjdk10, openjdk11, openjdk21 ] steps: - name: Checkout source code diff --git a/.gitignore b/.gitignore index 219e043..633ce19 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ node-java.cbp */.kdev_include_paths CMakeLists.txt cmake-build-debug/ +hs_err* \ No newline at end of file diff --git a/README.md b/README.md index c60a715..c10cc36 100644 --- a/README.md +++ b/README.md @@ -884,7 +884,7 @@ Either `./scripts/postInstall.js` didn't run or there was a problem detecting ja ## Debugging npm install - node-gyp build --debug + npx node-gyp build --debug gdb --args "$(which node)" ./node_modules/.bin/vitest test ## License diff --git a/package-lock.json b/package-lock.json index 01cefaa..2596296 100644 --- a/package-lock.json +++ b/package-lock.json @@ -469,6 +469,7 @@ "integrity": "sha512-5x08bUtU8hfboMTrJ7mEO4CpepS9yBwAqcL52y86SWNmbPX8LVbNs3EP4cNrIZgdjk2NAlP2ahNihozpoZIxSg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~7.14.0" } @@ -519,6 +520,7 @@ "integrity": "sha512-6JSSaBZmsKvEkbRUkf7Zj7dru/8ZCrJxAqArcLaVMee5907JdtEbKGsZ7zNiIm/UAkpGUkaSMZEXShnN2D1HZA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.46.1", "@typescript-eslint/types": "8.46.1", @@ -861,6 +863,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1339,6 +1342,7 @@ "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2576,6 +2580,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -3181,6 +3186,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3260,6 +3266,7 @@ "integrity": "sha512-CmuvUBzVJ/e3HGxhg6cYk88NGgTnBoOo7ogtfJJ0fefUWAxN/WDSUa50o+oVBxuIhO8FoEZW0j2eW7sfjs5EtA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", diff --git a/src-cpp/javaObject.cpp b/src-cpp/javaObject.cpp index 8c8d33b..0dd2392 100644 --- a/src-cpp/javaObject.cpp +++ b/src-cpp/javaObject.cpp @@ -325,7 +325,7 @@ NAN_INDEX_GETTER(JavaObject::indexGetter) { assertNoException(env); if ((jint)index >= arrayLength) { info.GetReturnValue().SetUndefined(); - return; + RETURN_INTERCEPTED_YES; } jmethodID array_get = env->GetStaticMethodID(arrayClass, "get", "(Ljava/lang/Object;I)Ljava/lang/Object;"); @@ -333,6 +333,7 @@ NAN_INDEX_GETTER(JavaObject::indexGetter) { assertNoException(env); v8::Local result = javaToV8(self->m_java, env, item); info.GetReturnValue().Set(result); + RETURN_INTERCEPTED_YES; } /*static*/ Nan::Persistent JavaProxyObject::s_proxyCt; diff --git a/src-cpp/utils.h b/src-cpp/utils.h index b3ad608..bc7cc17 100644 --- a/src-cpp/utils.h +++ b/src-cpp/utils.h @@ -16,6 +16,14 @@ class Java; #define V8_HIDDEN_MARKER_JAVA_LONG "__isJavaLong" #define V8_HIDDEN_MARKER_JAVA_OBJECT "__isJavaObject" +#if NODE_MAJOR_VERSION >= 23 + #define RETURN_INTERCEPTED_YES return v8::Intercepted::kYes + #define RETURN_INTERCEPTED_NO return v8::Intercepted::kNo +#else + #define RETURN_INTERCEPTED_YES return + #define RETURN_INTERCEPTED_NO return +#endif + typedef enum _jvalueType { TYPE_VOID = 1, TYPE_INT = 2,