+ if opt_verbose.value > 0 then print "# Running javap on {class_files.length} Java classes"
+ clock.lapse
+
+ # Run javap of the class file
+ class_files.unshift "-public"
+ var javap = new ProcessReader("javap", class_files...)
+ javap_output += javap.read_all
+ javap.wait
+ javap.close
+ var status = javap.status
+
+ if status != 0 then
+ print_error "Warning: javap failed to parse all class files, is it a valid class file?"
+ exit 1
+ end
+
+ sys.perfs["javap"].add clock.lapse
+end
+
+# Concatenate the preprocessed javap outputs
+for class_file in javap_files do
+ if opt_verbose.value > 0 then print "# Using the preprocessed file {class_file}"
+
+ var ext = class_file.file_extension
+ assert ext == "javap"
+
+ javap_output += class_file.to_path.read_all
+end
+
+if opt_verbose.value > 0 then print "# Parsing javap output"
+if opt_verbose.value > 1 then javap_output.write_to_file "tests/javap.javap"
+
+# Lexer
+var lexer = new Lexer_javap(javap_output)
+var parser = new Parser_javap
+var tokens = lexer.lex
+parser.tokens.add_all tokens
+sys.perfs["core lexer"].add clock.lapse
+
+# Parser
+var root_node = parser.parse
+if root_node isa NError then
+ print_error "Warning: Parsing failed with {root_node.message}:{root_node.position or else ""}"
+ exit 1
+end
+sys.perfs["core parser"].add clock.lapse
+
+# Build model
+if opt_verbose.value > 0 then print "# Building model"
+assert root_node isa NStart
+var visitor = new JavaVisitor(model)
+visitor.enter_visit root_node
+sys.perfs["core model"].add clock.lapse
+
+# Resolve types
+model.resolve_types
+sys.perfs["core resolve"].add clock.lapse
+
+# Build class hierarchy
+model.build_class_hierarchy
+sys.perfs["core hierarchy"].add clock.lapse
+
+if opt_verbose.value > 0 then print "# Generating Nit code"
+
+# Generate the Nit module
+var use_comment = opt_unknown.value == 0
+var use_stub = opt_unknown.value == 1
+var generator = new CodeGenerator(out_file, model, use_comment, use_stub)