@@ -66,8 +66,10 @@ class java_bytecode_parsert final : public parsert
6666 {
6767 if (index==0 || index>=constant_pool.size ())
6868 {
69- error () << " invalid constant pool index (" << index << " )" << eom;
70- error () << " constant pool size: " << constant_pool.size () << eom;
69+ log.error () << " invalid constant pool index (" << index << " )"
70+ << messaget::eom;
71+ log.error () << " constant pool size: " << constant_pool.size ()
72+ << messaget::eom;
7173 throw 0 ;
7274 }
7375
@@ -117,7 +119,7 @@ class java_bytecode_parsert final : public parsert
117119 {
118120 if (!*in)
119121 {
120- error () << " unexpected end of bytecode file" << eom;
122+ log. error () << " unexpected end of bytecode file" << messaget:: eom;
121123 throw 0 ;
122124 }
123125 in->get ();
@@ -135,7 +137,7 @@ class java_bytecode_parsert final : public parsert
135137 {
136138 if (!*in)
137139 {
138- error () << " unexpected end of bytecode file" << eom;
140+ log. error () << " unexpected end of bytecode file" << messaget:: eom;
139141 throw 0 ;
140142 }
141143 result <<= 8u ;
@@ -384,19 +386,19 @@ bool java_bytecode_parsert::parse()
384386
385387 catch (const char *message)
386388 {
387- error () << message << eom;
389+ log. error () << message << messaget:: eom;
388390 return true ;
389391 }
390392
391393 catch (const std::string &message)
392394 {
393- error () << message << eom;
395+ log. error () << message << messaget:: eom;
394396 return true ;
395397 }
396398
397399 catch (...)
398400 {
399- error () << " parsing error" << eom;
401+ log. error () << " parsing error" << messaget:: eom;
400402 return true ;
401403 }
402404
@@ -435,13 +437,13 @@ void java_bytecode_parsert::rClassFile()
435437
436438 if (magic!=0xCAFEBABE )
437439 {
438- error () << " wrong magic" << eom;
440+ log. error () << " wrong magic" << messaget:: eom;
439441 throw 0 ;
440442 }
441443
442444 if (major_version<44 )
443445 {
444- error () << " unexpected major version" << eom;
446+ log. error () << " unexpected major version" << messaget:: eom;
445447 throw 0 ;
446448 }
447449
@@ -641,7 +643,7 @@ void java_bytecode_parsert::rconstant_pool()
641643 const u2 constant_pool_count = read<u2>();
642644 if (constant_pool_count==0 )
643645 {
644- error () << " invalid constant_pool_count" << eom;
646+ log. error () << " invalid constant_pool_count" << messaget:: eom;
645647 throw 0 ;
646648 }
647649
@@ -683,7 +685,7 @@ void java_bytecode_parsert::rconstant_pool()
683685 // Eight-byte constants take up two entries in the constant_pool table.
684686 if (it==constant_pool.end ())
685687 {
686- error () << " invalid double entry" << eom;
688+ log. error () << " invalid double entry" << messaget:: eom;
687689 throw 0 ;
688690 }
689691 it++;
@@ -707,8 +709,8 @@ void java_bytecode_parsert::rconstant_pool()
707709 break ;
708710
709711 default :
710- error () << " unknown constant pool entry (" << it->tag << " )"
711- << eom;
712+ log. error () << " unknown constant pool entry (" << it->tag << " )"
713+ << messaget:: eom;
712714 throw 0 ;
713715 }
714716 }
@@ -1140,7 +1142,7 @@ void java_bytecode_parsert::rbytecode(std::vector<instructiont> &instructions)
11401142
11411143 if (address!=code_length)
11421144 {
1143- error () << " bytecode length mismatch" << eom;
1145+ log. error () << " bytecode length mismatch" << messaget:: eom;
11441146 throw 0 ;
11451147 }
11461148}
@@ -1809,7 +1811,7 @@ optionalt<java_bytecode_parse_treet> java_bytecode_parse(
18091811{
18101812 java_bytecode_parsert java_bytecode_parser (skip_instructions);
18111813 java_bytecode_parser.in =&istream;
1812- java_bytecode_parser.set_message_handler (message_handler);
1814+ java_bytecode_parser.log . set_message_handler (message_handler);
18131815
18141816 bool parser_result=java_bytecode_parser.parse ();
18151817
@@ -1979,8 +1981,8 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
19791981 method_handle_infot method_handle{entry};
19801982
19811983 const u2 num_bootstrap_arguments = read<u2>();
1982- debug () << " INFO: parse BootstrapMethod handle " << num_bootstrap_arguments
1983- << " #args" << eom;
1984+ log. debug () << " INFO: parse BootstrapMethod handle "
1985+ << num_bootstrap_arguments << " #args" << messaget:: eom;
19841986
19851987 // read u2 values of entry into vector
19861988 std::vector<u2> u2_values (num_bootstrap_arguments);
@@ -2020,9 +2022,9 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
20202022 if (num_bootstrap_arguments < 3 )
20212023 {
20222024 store_unknown_method_handle (bootstrap_method_index);
2023- debug ()
2025+ log. debug ()
20242026 << " format of BootstrapMethods entry not recognized: too few arguments"
2025- << eom;
2027+ << messaget:: eom;
20262028 continue ;
20272029 }
20282030
@@ -2043,9 +2045,9 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
20432045
20442046 if (!recognized)
20452047 {
2046- debug () << " format of BootstrapMethods entry not recognized: extra "
2047- " arguments of wrong type"
2048- << eom;
2048+ log. debug () << " format of BootstrapMethods entry not recognized: extra "
2049+ " arguments of wrong type"
2050+ << messaget:: eom;
20492051 store_unknown_method_handle (bootstrap_method_index);
20502052 continue ;
20512053 }
@@ -2060,22 +2062,23 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
20602062 method_handle_argument.tag != CONSTANT_MethodHandle ||
20612063 method_type_argument.tag != CONSTANT_MethodType)
20622064 {
2063- debug () << " format of BootstrapMethods entry not recognized: arguments "
2064- " wrong type"
2065- << eom;
2065+ log.debug ()
2066+ << " format of BootstrapMethods entry not recognized: arguments "
2067+ " wrong type"
2068+ << messaget::eom;
20662069 store_unknown_method_handle (bootstrap_method_index);
20672070 continue ;
20682071 }
20692072
2070- debug () << " INFO: parse lambda handle" << eom;
2073+ log. debug () << " INFO: parse lambda handle" << messaget:: eom;
20712074 optionalt<lambda_method_handlet> lambda_method_handle =
20722075 parse_method_handle (method_handle_infot{method_handle_argument});
20732076
20742077 if (!lambda_method_handle.has_value ())
20752078 {
2076- debug () << " format of BootstrapMethods entry not recognized: method "
2077- " handle not recognised"
2078- << eom;
2079+ log. debug () << " format of BootstrapMethods entry not recognized: method "
2080+ " handle not recognised"
2081+ << messaget:: eom;
20792082 store_unknown_method_handle (bootstrap_method_index);
20802083 continue ;
20812084 }
@@ -2084,14 +2087,15 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
20842087 POSTCONDITION (
20852088 lambda_method_handle->handle_type != method_handle_typet::UNKNOWN_HANDLE);
20862089
2087- debug () << " lambda function reference "
2088- << id2string (lambda_method_handle->get_method_descriptor ()
2089- .base_method_name ())
2090- << " in class \" " << parse_tree.parsed_class .name << " \" "
2091- << " \n interface type is "
2092- << id2string (pool_entry (interface_type_argument.ref1 ).s )
2093- << " \n method type is "
2094- << id2string (pool_entry (method_type_argument.ref1 ).s ) << eom;
2090+ log.debug ()
2091+ << " lambda function reference "
2092+ << id2string (
2093+ lambda_method_handle->get_method_descriptor ().base_method_name ())
2094+ << " in class \" " << parse_tree.parsed_class .name << " \" "
2095+ << " \n interface type is "
2096+ << id2string (pool_entry (interface_type_argument.ref1 ).s )
2097+ << " \n method type is "
2098+ << id2string (pool_entry (method_type_argument.ref1 ).s ) << messaget::eom;
20952099 parse_tree.parsed_class .add_method_handle (
20962100 bootstrap_method_index, *lambda_method_handle);
20972101 }
0 commit comments