-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_lambda2.py
More file actions
35 lines (29 loc) · 965 Bytes
/
debug_lambda2.py
File metadata and controls
35 lines (29 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
import traceback
import sys
from pathlib import Path
from pyjopa.parser import Java8Parser
from pyjopa.codegen import CodeGenerator
from pyjopa.classreader import ClassPath
parser = Java8Parser()
classpath = ClassPath()
try:
classpath.add_rt_jar()
except FileNotFoundError:
print("Warning: rt.jar not found")
try:
# Test the failing lambda function test instead
ast = parser.parse_file('tests/integration/cat12_lambda_function.java')
codegen = CodeGenerator(classpath=classpath)
# Compile using the correct method
class_files = codegen.compile(ast)
# Write bytecode
for internal_name, bytecode in class_files.items():
filename = f"{internal_name.replace('/', '_')}.class"
with open(filename, 'wb') as f:
f.write(bytecode)
print(f"Wrote {len(bytecode)} bytes to {filename}")
except Exception as e:
print(f"Error: {e}")
traceback.print_exc()
sys.exit(1)