From 49c32bcad806133a7214b2888031cde964556caa Mon Sep 17 00:00:00 2001 From: Karl Nelson Date: Sat, 19 Oct 2024 10:58:37 -0700 Subject: [PATCH] Another attempt --- jpype/_core.py | 5 +++-- native/java/manifest.txt | 2 +- native/java/org/jpype/proxy/JPypeProxy.java | 6 +++++- project/jpype_java/nbproject/project.properties | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/jpype/_core.py b/jpype/_core.py index 886f6198b..0512a1a2d 100644 --- a/jpype/_core.py +++ b/jpype/_core.py @@ -153,7 +153,7 @@ def _handleClassPath( else: out.append(pth) if ascii: - return _classpath._SEP.join([i for i in out if i.isascii()]) + return [i for i in out if i.isascii()] return [i for i in out if not i.isascii()] @@ -243,7 +243,8 @@ def startJVM( # Handle strings and list of strings. extra_jvm_args = () if classpath: - extra_jvm_args += (f'-Djava.class.path={_handleClassPath(classpath)}', ) + cp = _classpath._SEP.join(_handleClassPath(classpath)) + extra_jvm_args += ('-Djava.class.path=%s'%cp, ) supportLib = os.path.join(os.path.dirname(os.path.dirname(__file__)), "org.jpype.jar") if not os.path.exists(supportLib): diff --git a/native/java/manifest.txt b/native/java/manifest.txt index 85c360946..7a0699326 100644 --- a/native/java/manifest.txt +++ b/native/java/manifest.txt @@ -1,2 +1,2 @@ Manifest-Version: 1.0 -Premain-Class: org.jpype.agent.JPypeAgent +Premain-Class: org.jpype.agent.JPypeAgent \ No newline at end of file diff --git a/native/java/org/jpype/proxy/JPypeProxy.java b/native/java/org/jpype/proxy/JPypeProxy.java index aae264ec4..cf35ab4cc 100644 --- a/native/java/org/jpype/proxy/JPypeProxy.java +++ b/native/java/org/jpype/proxy/JPypeProxy.java @@ -16,6 +16,7 @@ package org.jpype.proxy; import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -102,7 +103,10 @@ public Object invoke(Object proxy, Method method, Object[] args) if (method.isDefault()) { return MethodHandles.lookup() - .unreflectSpecial(method, method.getDeclaringClass()) + .findSpecial(method.getDeclaringClass(), + method.getName(), + MethodType.methodType(method.getReturnType()), + method.getDeclaringClass()) .bindTo(proxy) .invokeWithArguments(args); } diff --git a/project/jpype_java/nbproject/project.properties b/project/jpype_java/nbproject/project.properties index 45172cca8..3ec6b403a 100755 --- a/project/jpype_java/nbproject/project.properties +++ b/project/jpype_java/nbproject/project.properties @@ -113,4 +113,4 @@ source.encoding=UTF-8 src.java.dir=${file.reference.native-java} test.harness.dir=${file.reference.test-harness} test.src.dir=test -manifest.file=../../native/jara/manifest.txt +manifest.file=../../native/java/manifest.txt