Skip to content
Permalink
Browse files

Fix for caller sensitive methods required for Java 12

  • Loading branch information...
Thrameos committed Aug 1, 2019
1 parent 9548fd7 commit 2440b0a88fd1bc5ddd4811de370402d22fc1b593
Showing with 742 additions and 154 deletions.
  1. +0 −3 .travis.yml
  2. +5 −5 appveyor.yml
  3. +8 −12 appveyor/install.sh
  4. +12 −2 doc/CHANGELOG.rst
  5. +96 −0 doc/caller_sensitive.rst
  6. +130 −31 doc/develguide.rst
  7. +0 −3 doc/install.rst
  8. +0 −20 doc/userguide.rst
  9. +9 −5 jpype/_core.py
  10. +3 −15 jpype/_jclass.py
  11. +1 −1 jpype/imports.py
  12. +1 −1 native/common/include/jp_baseclasses.h
  13. +1 −1 native/common/include/jp_boxedclasses.h
  14. +3 −2 native/common/include/jp_class.h
  15. +1 −1 native/common/include/jp_field.h
  16. +1 −1 native/common/include/jp_javaframe.h
  17. +2 −1 native/common/include/jp_methodoverload.h
  18. +4 −3 native/common/include/jp_primitivetype.h
  19. +4 −0 native/common/include/jp_typemanager.h
  20. +1 −1 native/common/jp_array.cpp
  21. +2 −2 native/common/jp_baseclasses.cpp
  22. +2 −0 native/common/jp_booleantype.cpp
  23. +2 −0 native/common/jp_bytetype.cpp
  24. +12 −3 native/common/jp_class.cpp
  25. +2 −0 native/common/jp_classloader.cpp
  26. +2 −0 native/common/jp_doubletype.cpp
  27. +2 −0 native/common/jp_floattype.cpp
  28. +2 −0 native/common/jp_inttype.cpp
  29. +2 −0 native/common/jp_longtype.cpp
  30. +54 −5 native/common/jp_methodoverload.cpp
  31. +4 −11 native/common/jp_primitivetype.cpp
  32. +1 −1 native/common/jp_proxy.cpp
  33. +2 −0 native/common/jp_shorttype.cpp
  34. +1 −1 native/common/jp_stringclass.cpp
  35. +39 −4 native/common/jp_typemanager.cpp
  36. +1 −1 native/common/jp_value.cpp
  37. +2 −0 native/common/jp_voidtype.cpp
  38. +89 −2 native/java/org/jpype/Utility.java
  39. +1 −1 native/python/include/jpype_memory_view.h
  40. +3 −3 native/python/jp_pythontypes.cpp
  41. +1 −1 native/python/pyjp_class.cpp
  42. +1 −1 native/python/pyjp_module.cpp
  43. +1 −1 native/python/pyjp_monitor.cpp
  44. +6 −6 native/python/pyjp_value.cpp
  45. +4 −1 project/jpype_cpython/nbproject/project.xml
  46. +12 −0 project/jpype_java/nbproject/project.properties
  47. +23 −2 test/build.xml
  48. +77 −0 test/harness/java9/jpype/method/Caller.java
  49. +108 −0 test/jpypetest/test_caller_sensitive.py
  50. +2 −0 test/jpypetest/test_reflect.py
@@ -32,7 +32,6 @@ matrix:
- python: nightly
- python: pypy
- python: pypy3
- os: osx

include:
- name: "Python 2.7 on Xenial Linux (w/o NUMPY)"
@@ -82,8 +81,6 @@ matrix:
- PIP=pip3
- JPYPE_STR_CONVERSION=False

## This pattern is good, but something is broken in openJDK 12
## Deal with in another pull
- name: "Python 2.7 on macOS"
os: osx
osx_image: xcode10.2
@@ -42,6 +42,11 @@ environment:
# ARCH: x86_64
# CYGSH: C:\Cygwin64\bin\bash -c

- PYTHON: "python3.7"
CYGWIN: "C:\\cygwin64"
ARCH: x86_64
CYGSH: C:\Cygwin64\bin\bash -c

- PYTHON: "C:\\Miniconda"
ARCH: x86
CONDA_PY: "2-latest"
@@ -50,11 +55,6 @@ environment:
ARCH: x86_64
CONDA_PY: "2-latest"

- PYTHON: "python3"
CYGWIN: "C:\\cygwin64"
ARCH: x86_64
CYGSH: C:\Cygwin64\bin\bash -c

- PYTHON: "C:\\Miniconda3"
ARCH: x86
CONDA_PY: "3-latest"
@@ -14,35 +14,31 @@ if [ ! -d "$JAVA_HOME" ]; then
exit -1
fi


# Make sure the jvm.dll is where it should be
find "$JAVA_HOME" -name "jvm.dll"

# Define programs
SETUP=/setup-$ARCH
if [ $PYTHON = "python3" ]; then
PIP=pip3
EASYINSTALL=easy_install-3.6
else
PIP=pip
EASYINSTALL=easy_install-2.7
fi

# Install prereqs
echo "==== update gcc"
$SETUP -q -P gcc-core,gcc-g++,libcrypt-devel
echo "==== update python"
$SETUP -q -P $PYTHON,$PYTHON-numpy,$PYTHON-devel,$PYTHON,$PYTHON-setuptools
if [ $PYTHON = "python3.7" ]; then
$SETUP -q -P python37,python37-numpy,python37-devel
fi
echo "==== get modules"
$EASYINSTALL pip
$EASYINSTALL mock
#$PIP install mock
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$PYTHON get-pip.py
$PYTHON -m pip install setuptools
$PYTHON -m pip install mock
git clone --depth=1 https://github.com/pypa/setuptools.git
cd setuptools
$PYTHON ./bootstrap.py
$PYTHON -m pip install ./
cd ..
rm -r ./setuptools

git clone --depth=1 https://github.com/pypa/wheel.git
git clone --depth=1 https://github.com/pypa/pip.git
git clone --depth=1 https://github.com/pypa/setuptools_scm.git
@@ -4,12 +4,22 @@ Changelog
This changelog *only* contains changes from the *first* pypi release (0.5.4.3) onwards.

- **Next version - unreleased**

- Updated getJVMVersion to work with JDK 9+.

- Added support for pickling of Java objects using optional module
``jpype.pickle``

- Fixed incorrect string conversion on exceptions.
- Fixed incorrect string conversion on exceptions. `str()` was
incorrectly returning `getMessage` rather than `toString`.

- Fixed an issue with JDK 12 regarding calling methods with reflection.

- Corrected segfault when converting null elements while accessing a slice
- Removed limitations having to do with CallerSensitive methods. Methods
affected are listed in :doc:`caller-sensitive`. Caller sensitive
methods now receive an internal JPype class as the desut

- Fixed segfault when converting null elements while accessing a slice
from a Java object array.

- PyJPMethod now supports the FunctionType API.
@@ -0,0 +1,96 @@
The following methods use the caller sensitive (as of JDK 12):

- ``java.io.ObjectStreamClass.forClass``
- ``java.io.ObjectStreamField.getType``
- ``java.lang.Class.forName``
- ``java.lang.Class.newInstance``
- ``java.lang.Class.getClassLoader``
- ``java.lang.Class.getEnclosingMethod``
- ``java.lang.Class.getEnclosingConstructor``
- ``java.lang.Class.getDeclaringClass``
- ``java.lang.Class.getEnclosingClass``
- ``java.lang.Class.getClasses``
- ``java.lang.Class.getFields``
- ``java.lang.Class.getMethods``
- ``java.lang.Class.getConstructor``
- ``java.lang.Class.getConstructors``
- ``java.lang.Class.getField``
- ``java.lang.Class.getMethod``
- ``java.lang.Class.getDeclaredClasses``
- ``java.lang.Class.getDeclaredField``
- ``java.lang.Class.getDeclaredFields``
- ``java.lang.Class.getDeclaredMethod``
- ``java.lang.Class.getDeclaredMethods``
- ``java.lang.Class.getDeclaredConstructor``
- ``java.lang.Class.getDeclaredConstructors``
- ``java.lang.Class.getResource``
- ``java.lang.Class.getResourceAsStream``
- ``java.lang.Class.getNestHost``
- ``java.lang.Class.getNestMembers``
- ``java.lang.ClassLoader.getParent``
- ``java.lang.ClassLoader.getPlatformClassLoader``
- ``java.lang.invoke,MethodHandleProxies.asInterfaceInstance``
- ``java.lang.invoke.MethodHandles.lookup``
- ``java.lang.Module.addReads``
- ``java.lang.Module.addExports``
- ``java.lang.Module.addOpens``
- ``java.lang.Module.addUses``
- ``java.lang.Module.getResourceAsStream``
- ``java.lang.Package.getPackage``
- ``java.lang.Package.getPackages``
- ``java.lang.reflect.AccessibleObject.setAccessible``
- ``java.lang.reflect.AccessibleObject.setAccessible``
- ``java.lang.reflect.AccessibleObject.trySetAccessible``
- ``java.lang.reflect.AccessibleObject.canAccess``
- ``java.lang.reflect.Constructor.setAccessible``
- ``java.lang.reflect.Constructor.newInstance``
- ``java.lang.reflect.Field.setAccessible``
- ``java.lang.reflect.Field.get``
- ``java.lang.reflect.Field.getBoolean``
- ``java.lang.reflect.Field.getByte``
- ``java.lang.reflect.Field.getChar``
- ``java.lang.reflect.Field.getShort``
- ``java.lang.reflect.Field.getInt``
- ``java.lang.reflect.Field.getLong``
- ``java.lang.reflect.Field.getFloat``
- ``java.lang.reflect.Field.getDouble``
- ``java.lang.reflect.Field.set``
- ``java.lang.reflect.Field.setBoolean``
- ``java.lang.reflect.Field.setByte``
- ``java.lang.reflect.Field.setChar``
- ``java.lang.reflect.Field.setShort``
- ``java.lang.reflect.Field.setInt``
- ``java.lang.reflect.Field.setLong``
- ``java.lang.reflect.Field.setFloat``
- ``java.lang.reflect.Field.setDouble``
- ``java.lang.reflect.Method.setAccessible``
- ``java.lang.reflect.Method.invoke``
- ``java.lang.reflect.Proxy.getProxyClass``
- ``java.lang.reflect.Proxy.newProxyInstance``
- ``java.lang.reflect.Proxy.getInvocationHandler``
- ``java.lang.Runtime.load``
- ``java.lang.Runtime.loadLibrary``
- ``java.lang.StackWalker.walk``
- ``java.lang.StackWalker.forEach``
- ``java.lang.StackWalker.getCallerClass``
- ``java.lang.System.getLogger``
- ``java.lang.System.getLogger``
- ``java.lang.System.load``
- ``java.lang.System.loadLibrary``
- ``java.lang.Thread.getContextClassLoader``
- ``java.security.AccessController.doPrivileged``
- ``java.security.AccessController.doPrivilegedWithCombiner``
- ``java.util.concurrent.atomic.AtomicIntegerFieldUpdater.newUpdater``
- ``java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater``
- ``java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater``
- ``java.util.ResourceBundle.getBundle``
- ``java.util.ResourceBundle.clearCache``
- ``java.util.ServiceLoader.load``
- ``java.util.ServiceLoader.loadInstalled``
- ``java.util.logging.Logger.getLogger``
- ``java.util.logging.Logger.getLogger``
- ``java.util.logging.Logger.getAnonymousLogger``
- ``java.sql.DriverManager.getConnection``
- ``java.sql.DriverManager.getDriver``
- ``java.sql.DriverManager.deregisterDriver``
- ``java.sql.DriverManager.getDrivers``

0 comments on commit 2440b0a

Please sign in to comment.
You can’t perform that action at this time.