Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward #971

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Forward #971

wants to merge 15 commits into from

Conversation

Thrameos
Copy link
Contributor

This is the prototype code for JForword which allows resources to be created prior to starting the JVM. The internal methods are all working, but it requires clean up, hooking into the main functionality so that stubs are created automatically, and testing.

This one will be pretty difficult to test as it requires playing with behaviors like weak referencing and JVM starting. The easy tests are to manually create a forward after the JVM is started.

@codecov
Copy link

codecov bot commented May 10, 2021

Codecov Report

Merging #971 (0b61aad) into master (661c541) will decrease coverage by 1.49%.
The diff coverage is 32.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #971      +/-   ##
==========================================
- Coverage   87.54%   86.04%   -1.50%     
==========================================
  Files         114      116       +2     
  Lines       10076    10356     +280     
  Branches     4063     4106      +43     
==========================================
+ Hits         8821     8911      +90     
- Misses        642      833     +191     
+ Partials      613      612       -1     
Impacted Files Coverage Δ
jpype/_core.py 95.47% <ø> (+0.40%) ⬆️
native/python/include/pyjp.h 100.00% <ø> (ø)
native/common/pyjp_forward.cpp 7.14% <7.14%> (ø)
jpype/_jforward.py 40.54% <40.54%> (ø)
jpype/__init__.py 95.23% <100.00%> (+0.23%) ⬆️
native/python/pyjp_class.cpp 85.32% <100.00%> (+0.41%) ⬆️
native/python/pyjp_method.cpp 93.78% <100.00%> (+0.55%) ⬆️
native/python/pyjp_module.cpp 82.87% <100.00%> (+0.04%) ⬆️
native/python/pyjp_number.cpp 92.57% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 661c541...0b61aad. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented May 10, 2021

This pull request introduces 2 alerts when merging 359b5e8 into 6e9a5b1 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jun 5, 2021

This pull request introduces 2 alerts when merging 0b61aad into 661c541 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for FIXME comment

Copy link
Contributor

@pelson pelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> import jpype.jroot.java
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "jpype/_jforward.py", line 243, in create_module
    mod = self._load_module(spec.name)
  File "jpype/_jforward.py", line 256, in _load_module
    return JForward(java_name)
  File "jpype/jpype/_jforward.py", line 169, in __new__
    return _lookup(symbol)
  File "jpype/jpype/_jforward.py", line 19, in _lookup
    if _jpype.isPackage(symbol):
jpype._core.JVMNotRunning: Java Virtual Machine is not running


def __new__(cls, symbol: typing.Optional[str]):
if not _jpype.isStarted():
return _lookup(symbol)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can conclude that _lookup needn't have the JVM running, right?

def _lookup(symbol: typing.Optional[str]):
if symbol is None:
return None
if _jpype.isPackage(symbol):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This errors if the JVM isn't running.

@pelson
Copy link
Contributor

pelson commented Feb 8, 2024

Clearly we stalled on this one (totally understandable). I was hoping to at least review what is here already, but it seems that the fundamentals aren't yet working (e.g. _lookup using isPackage, and requiring the JVM). Are you likely to get the time to pick this back up at some point? If not, should we just close it?

@pelson
Copy link
Contributor

pelson commented Mar 18, 2024

Some really valuable insight in #1176 (comment). I plan to respond to the specific JForward points here, but will focus on that MR for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants