Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
116d397
Work on extensions
Thrameos Nov 11, 2020
a76bf37
Merge branch 'master' into extension
Thrameos Nov 14, 2020
fe94cf6
Work on Java class extensions
Thrameos Nov 15, 2020
09f1556
Finish up specs.
Thrameos Nov 15, 2020
7fbc10b
Exc flags
Thrameos Nov 15, 2020
472b300
Code generator
Thrameos Nov 16, 2020
3855389
Debugging code generator
Thrameos Nov 16, 2020
c3facdd
Documentation prototype
Thrameos Nov 16, 2020
1d50fc3
Exceptions and classloader.
Thrameos Nov 20, 2020
92c2d89
Work for extensions
Thrameos Nov 21, 2020
bf2ae9b
Checking for testing with master
Thrameos Nov 24, 2020
cbb1708
Merge remote-tracking branch 'upstream/master' into extension
Thrameos Nov 27, 2020
4786ca9
Merge remote-tracking branch 'upstream/master' into extension
Thrameos Nov 27, 2020
9f9682e
header cleanup
astrelsky Sep 15, 2024
edeafa9
try to fix python 3.13 rc version
marscher Sep 16, 2024
3042174
Merge remote-tracking branch 'Thrameos/py3.13'
astrelsky Sep 21, 2024
6884765
Delete native/python/*.c
astrelsky Sep 21, 2024
db7c329
Merge remote-tracking branch 'upstream/patch-1'
astrelsky Sep 21, 2024
5d6865a
Merge remote-tracking branch 'Thrameos/extension'
astrelsky Sep 21, 2024
822944b
Merge remote-tracking branch 'upstream/tuple'
astrelsky Sep 21, 2024
9e0bf27
fix warning
astrelsky Sep 21, 2024
b0d03dc
cleanup
astrelsky Sep 21, 2024
dfbe51d
wip
astrelsky Sep 21, 2024
e2efb5a
fix 100s of java warnings
astrelsky Sep 22, 2024
7a5deca
commit while it still works
astrelsky Sep 22, 2024
839c1c2
remove extra log
astrelsky Sep 22, 2024
f59eb61
started tests
astrelsky Sep 28, 2024
d50318c
prevent 'clobbering'
astrelsky Sep 28, 2024
65e6119
constructors
astrelsky Sep 28, 2024
df98375
fixed super(), need method resolution for access from python
astrelsky Sep 29, 2024
f24bacf
add note for test failure
astrelsky Sep 29, 2024
7c2574d
temporarily add build.gradle and CMakeLists.txt for easy development
astrelsky Oct 5, 2024
f13c519
Merge branch 'master' of https://github.com/jpype-project/jpype into …
astrelsky Oct 5, 2024
2047025
update .gitignore
astrelsky Oct 5, 2024
6c117c6
fixed broken tests except those that aren't my fault
astrelsky Oct 5, 2024
cc894fe
fixed extension class creation
astrelsky Oct 5, 2024
7a96f6d
remove unneeded check
astrelsky Oct 5, 2024
3954ace
protected and private member checked access
astrelsky Oct 5, 2024
24da8cc
java extension field support
astrelsky Oct 5, 2024
38a4f72
static field support, static methods borked
astrelsky Oct 5, 2024
46e35f3
fix building from setup.py
astrelsky Oct 6, 2024
17f5e59
fix processing when using 'from __future__ import annotations'
astrelsky Oct 6, 2024
321c638
fixed static methods
astrelsky Oct 6, 2024
2b1cb7b
allow static method declaration using classmethod
astrelsky Oct 6, 2024
d93d139
fixed tests
astrelsky Oct 6, 2024
f712d98
fixed remaining method resolution problems
astrelsky Oct 6, 2024
9ad8297
removed python2 garbage in test_attr.py
astrelsky Oct 6, 2024
00991ff
mypy cries too much
astrelsky Oct 6, 2024
2ba29ad
CodeQL
astrelsky Oct 6, 2024
98c0d71
removed inclusion of pytypedefs.h
astrelsky Oct 6, 2024
27ad8a0
support access checks for 3.9 and 3.10
astrelsky Oct 6, 2024
bb7a74c
only run codeql on master
astrelsky Oct 6, 2024
4c638cb
final fields and methods
astrelsky Oct 6, 2024
a5f13c6
adding python members doesn't work so great across the bridge
astrelsky Oct 7, 2024
8936734
Merge branch 'free_threaded' of https://github.com/astrelsky/jpype in…
astrelsky Oct 12, 2024
7663f81
free threaded build
astrelsky Oct 12, 2024
b802640
handle keeping extension python object alive just like the proxy
astrelsky Oct 12, 2024
c01c4f9
fix missing Java slot in extension types and test constructing from Java
astrelsky Oct 12, 2024
9ea5549
test JThrows
astrelsky Oct 12, 2024
e35aea7
Merge remote-tracking branch 'origin/master' into extension
astrelsky Oct 13, 2024
2e74832
handle temporary and reloaded python modules for extending java classes
astrelsky Oct 14, 2024
9aa0d94
annotation support part 1
astrelsky Oct 20, 2024
b04e4bb
annotation support part 2
astrelsky Oct 20, 2024
4a2271b
handle non ascii classpath with system classloader #1194 #1222
astrelsky Oct 23, 2024
841054c
Merge remote-tracking branch 'upstream/utfpath' into extension
astrelsky Oct 26, 2024
39b8018
fixed annotation bugs
astrelsky Oct 26, 2024
7828ca5
fixed boxed parameters and parameter annotations
astrelsky Oct 26, 2024
76e0911
use typing.Annotated for fields
astrelsky Oct 26, 2024
93b3d5f
docs and more tests
astrelsky Oct 26, 2024
3b4d159
english
astrelsky Oct 26, 2024
1ec997e
remove tabs
astrelsky Oct 26, 2024
185333c
correct indentation again...
astrelsky Oct 26, 2024
e5f473e
too many underscores
astrelsky Oct 26, 2024
56a9166
Merge remote-tracking branch 'upstream/utfpath' into extension
astrelsky Nov 1, 2024
75a4831
Merge remote-tracking branch 'upstream/utfpath' into extension
astrelsky Nov 2, 2024
8e31451
fixed handling of JPExtensionType deletion
astrelsky Nov 2, 2024
2e4e121
prevent potential uaf when reloading
astrelsky Nov 2, 2024
9137ddc
fixed attributes, just need to fix proxy default method override
astrelsky Nov 10, 2024
63e4f80
refactored protected attribute handling
astrelsky Nov 17, 2024
5906c3a
fixed deleted reference issue when casting an extension object
astrelsky Nov 23, 2024
492c9ec
Merge remote-tracking branch 'origin/master' into extension
astrelsky Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[bumpversion]
current_version = 1.5.2.dev0
current_version = 2.0.0_dev0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{build}
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\_(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}_{release}{build}
{major}.{minor}.{patch}

[bumpversion:part:release]
first_value = dev
optional_value = prod
values =
values =
dev
prod

Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,15 @@ jacoco/
wheelhouse/
vc*.pdb
*.class
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
*.project
*.ninja*
_jpype.*
.clangd
.classpath
compile_commands.json
*.gradle
*.settings
*.vscode
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required (VERSION 3.30)

project("_jpype" LANGUAGES CXX)

set (Python_FIND_ABI "ANY" "ANY" "ANY" "ON")
set(Python_Interpreter_GIL_DISABLED ON)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_SHARED_MODULE_SUFFIX ".cp313t-win_amd64.pyd")

set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_ROOT})

set(D_SRC_COMMON ${PROJECT_ROOT}/native/common)
set(D_SRC_PYTHON ${PROJECT_ROOT}/native/python)

file(GLOB SrcFiles ${D_SRC_COMMON}/*.cpp ${D_SRC_PYTHON}/*.cpp)

add_compile_options(
"$<$<COMPILE_LANGUAGE:CXX>:-Od;>"
)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DPy_GIL_DISABLED=1 /W3 /GL")
#target_sources(${PROJECT_NAME} MODULE ${SrcFiles})
add_library(${PROJECT_NAME} MODULE ${SrcFiles})
target_include_directories(${PROJECT_NAME} PRIVATE "C:\\Program Files\\Python313\\include" ${PROJECT_ROOT}/native/jni_include ${D_SRC_COMMON}/include ${D_SRC_PYTHON}/include)
#target_link_libraries(${PROJECT_NAME} PRIVATE Python3::Module)
target_link_directories(${PROJECT_NAME} PRIVATE "C:\\Program Files\\Python313\\libs")
32 changes: 32 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,35 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

==============
ASM License
==============

ASM: a very small and fast Java bytecode manipulation framework
Copyright (c) 2000-2011 INRIA, France Telecom
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
215 changes: 215 additions & 0 deletions _jpype-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
import types
import typing
import jpype
from java.lang import Class # type: ignore

__version__: str

class _JArray(_JObject):
length: jpype.JInt
def __init__(self, *args, **kwargs) -> None: ...
def __buffer__(self, *args, **kwargs): ...
def __delitem__(self, other) -> None: ...
def __getitem__(self, index): ...
def __len__(self) -> int: ...
def __release_buffer__(self, *args, **kwargs): ...
def __setitem__(self, index, object) -> None: ...

class _JArrayPrimitive(_JArray):
def __buffer__(self, *args, **kwargs): ...
def __release_buffer__(self, *args, **kwargs): ...

class _JBoolean(int, _JObject):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __eq__(self, other: object) -> bool: ...
def __float__(self) -> float: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
@classmethod
def __init_subclass__(cls, *args, internal: bool, **kwargs): ...
def __int__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setattr__(self, name, value): ...

class _JBuffer(_JObject):
def __buffer__(self, *args, **kwargs): ...
def __release_buffer__(self, *args, **kwargs): ...

class _JChar(str, _JObject):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __abs__(self): ...
def __add__(self, other): ...
def __and__(self, other): ...
def __bool__(self) -> bool: ...
def __delattr__(self, name): ...
def __divmod__(self, other): ...
def __eq__(self, other: object) -> bool: ...
def __float__(self) -> float: ...
def __floordiv__(self, other): ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ...
def __invert__(self): ...
def __le__(self, other: object) -> bool: ...
def __len__(self) -> int: ...
def __lshift__(self, other): ...
def __lt__(self, other: object) -> bool: ...
def __mul__(self, other): ...
def __ne__(self, other: object) -> bool: ...
def __neg__(self): ...
def __or__(self, other): ...
def __pos__(self): ...
def __radd__(self, other): ...
def __rand__(self, other): ...
def __rdivmod__(self, other): ...
def __rfloordiv__(self, other): ...
def __rlshift__(self, other): ...
def __rmul__(self, other): ...
def __ror__(self, other): ...
def __rrshift__(self, other): ...
def __rshift__(self, other): ...
def __rsub__(self, other): ...
def __rxor__(self, other): ...
def __setattr__(self, name, value): ...
def __sub__(self, other): ...
def __xor__(self, other): ...
@classmethod
def __init_subclass__(cls, *args, internal: bool, **kwargs): ...

class _JClass(type):
class_: Class
def __init__(self, *args, **kwargs) -> None: ...
def mro(self, *args, **kwargs): ...
def __del__(self, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __getitem__(self, index): ...
def __imatmul__(self, *args, **kwargs): ...
def __instancecheck__(self, *args, **kwargs): ...
def __matmul__(self, *args, **kwargs): ...
@classmethod
def __prepare__(cls, *args, **kwargs): ...
def __rmatmul__(self, *args, **kwargs): ...
def __setattr__(self, name, value): ...
def __subclasscheck__(self, *args, **kwargs): ...

class _JClassHints:
def __init__(self, *args, **kwargs) -> None: ...

class _JComparable(_JObject):
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

class _JException(Exception, _JObject):
def __init__(self, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __setattr__(self, name, value): ...

class _JField:
def __delete__(self, *args, **kwargs): ...
def __get__(self, instance, owner): ...
def __set__(self, instance, value): ...

class _JMethod(function):
def matchReport(self, *args, **kwargs): ...
def __call__(self, *args, **kwargs): ...
def __get__(self, instance, owner): ...

class _JMonitor:
def __init__(self, *args, **kwargs) -> None: ...
def __enter__(self): ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None): ...

class _JNumberFloat(float, _JObject):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __eq__(self, other: object) -> bool: ...
def __float__(self) -> float: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
@classmethod
def __init_subclass__(cls, *args, internal: bool, **kwargs): ...
def __int__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setattr__(self, name, value): ...

class _JNumberLong(int, _JObject):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __eq__(self, other: object) -> bool: ...
def __float__(self) -> float: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
@classmethod
def __init_subclass__(cls, *args, internal: bool, **kwargs): ...
def __int__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setattr__(self, name, value): ...

class _JObject:
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __del__(self, *args, **kwargs) -> None: ...
def __delattr__(self, name): ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
@classmethod
def __init_subclass__(cls, *args, **kwargs): ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setattr__(self, name, value): ...

class _JPackage(types.ModuleType):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def __call__(self, *args, **kwargs): ...
def __dir__(self): ...
def __imatmul__(self, *args, **kwargs): ...
def __matmul__(self, *args, **kwargs): ...
def __rmatmul__(self, *args, **kwargs): ...

class _JProxy:
__javaclass__: jpype.JClass
__javainst__: typing.Any
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
def equals(self, *args, **kwargs): ...
def hashCode(self, *args, **kwargs): ...
def toString(self, *args, **kwargs): ...

def arrayFromBuffer(*args, **kwargs): ...
def attachThreadAsDaemon(*args, **kwargs): ...
def attachThreadToJVM(*args, **kwargs): ...
def convertToDirectBuffer(*args, **kwargs): ...
def detachThreadFromJVM(*args, **kwargs): ...
def enableStacktraces(*args, **kwargs): ...
def examine(*args, **kwargs): ...
def gcStats(*args, **kwargs): ...
def isPackage(*args, **kwargs): ...
def isStarted(*args, **kwargs): ...
def isThreadAttachedToJVM(*args, **kwargs): ...
def shutdown(*args, **kwargs): ...
def startup(*args, **kwargs): ...
def trace(*args, **kwargs): ...
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apply plugin: 'java-library'
apply plugin: 'eclipse'

sourceCompatibility = 8
targetCompatibility = 8

sourceSets {
main {
java {
srcDirs = ['native/java']
}
}
}

jar {
destinationDirectory.set(file(project.rootDir))
archiveFileName.set('org.jpype.jar')
manifest {
attributes(
'Premain-Class': 'org.jpype.agent.JPypeAgent'
)
}
}
Loading