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

Errors #5

Open
Kreijstal opened this issue Apr 7, 2024 · 2 comments
Open

Errors #5

Kreijstal opened this issue Apr 7, 2024 · 2 comments

Comments

@Kreijstal
Copy link

I merely git clonned and ran the tests..

$ sh test.sh
EEEE............EE
======================================================================
ERROR: test_cocktail_sort (__main__.ArrayTest.test_cocktail_sort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
    self.jvm.load_class_file('example/ArrayTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

======================================================================
ERROR: test_insertion_sort (__main__.ArrayTest.test_insertion_sort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
    self.jvm.load_class_file('example/ArrayTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

======================================================================
ERROR: test_loop_multiple (__main__.ArrayTest.test_loop_multiple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
    self.jvm.load_class_file('example/ArrayTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

======================================================================
ERROR: test_sum (__main__.ArrayTest.test_sum)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
    self.jvm.load_class_file('example/ArrayTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

======================================================================
ERROR: test_reverse_string (__main__.StringTest.test_reverse_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 56, in setUp
    self.jvm.load_class_file('example/StringTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

======================================================================
ERROR: test_rot13_hello_world (__main__.StringTest.test_rot13_hello_world)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 56, in setUp
    self.jvm.load_class_file('example/StringTest.class')
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
    c = ClassFile().from_file(path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
    c = CPInfo().from_reader(cf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
    self.tag = CPTag(tag)
               ^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 18 is not a valid CPTag

----------------------------------------------------------------------
Ran 18 tests in 0.236s

FAILED (errors=6)
@gkbrk
Copy link
Owner

gkbrk commented Apr 9, 2024

Constant Pool tag 18 is CONSTANT_InvokeDynamic. This wasn't being emitted by the Java compiler for the example code when the interpreter was written.

Which Java version are you compiling with? I think using an older version will probably work. Or adding InvokeDynamic support to python-jvm-interpreter.

@Kreijstal
Copy link
Author

temurin 21, can you at least add a warning or assertion warning about the jdk version, thank you, Ill try with older jdk

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

No branches or pull requests

2 participants