home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / error.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  145.3 KB  |  5,363 lines

  1. // $Id: error.cpp,v 1.60 2001/02/15 10:36:05 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #include "error.h"
  12. #include "control.h"
  13. #include "semantic.h"
  14. #include "ast.h"
  15.  
  16. #ifdef    HAVE_JIKES_NAMESPACE
  17. namespace Jikes {    // Open namespace Jikes block
  18. #endif
  19.  
  20. unsigned char SemanticError::warning[SemanticError::_num_kinds] = { 0 };
  21. wchar_t * (*SemanticError::print_message[SemanticError::_num_kinds]) (ErrorInfo &, LexStream *, Control &) = { NULL };
  22.  
  23. void ErrorInfo::Initialize(LexStream *l, wchar_t  *m, JikesErrorSeverity s)    
  24. {
  25.     lex_stream   = l;
  26.  
  27.     left_line_no    = lex_stream -> Line   (left_token  );
  28.     left_column_no  = lex_stream -> Column (left_token  );
  29.     right_line_no   = lex_stream -> Line   (right_token );
  30.     right_column_no = lex_stream -> Column (right_token );
  31.     
  32.     /*
  33.      *   
  34.      * I do not understand following code and it is causing incorrect column values
  35.      * calculation. I commented in out for now. If you see any reason to restore
  36.      * it - please let me know.
  37.      * (lord)
  38.      *
  39.      
  40.      if(right_column_no != 0) // could not compute a column number
  41.      right_column_no += (right_string_length - 1); // point to last character in right token
  42.      
  43.     */
  44.  
  45.     msg      = m;
  46.     severity = s;
  47. }
  48.  
  49. ErrorInfo::ErrorInfo()
  50. :msg(NULL),
  51. severity(JikesError::JIKES_ERROR)
  52. {
  53. }
  54.  
  55. ErrorInfo::~ErrorInfo()
  56. {
  57.     delete [] msg;
  58. }
  59.  
  60.  
  61. JikesError::JikesErrorSeverity ErrorInfo::getSeverity        () { return severity        ; }
  62. int ErrorInfo::getLeftLineNo      () { return left_line_no    ; }
  63. int ErrorInfo::getLeftColumnNo    () { return left_column_no  ; }
  64. int ErrorInfo::getRightLineNo     () { return right_line_no   ; }
  65. int ErrorInfo::getRightColumnNo   () { return right_column_no ; }
  66.  
  67. const char *ErrorInfo::getFileName() 
  68.     assert(lex_stream);
  69.     return lex_stream -> FileName();   
  70. }
  71.  
  72. const wchar_t *ErrorInfo::getErrorMessage() 
  73. {
  74.     assert(msg);
  75.     return msg;
  76. }
  77.  
  78. bool ErrorInfo::emacs_style_report=false;
  79.  
  80. const wchar_t *ErrorInfo::getErrorReport() 
  81. {
  82.     return emacs_style_report?emacsErrorString():regularErrorString();
  83. }
  84.  
  85. wchar_t *ErrorInfo::regularErrorString() 
  86. {
  87.     ErrorString s;
  88.  
  89.     if(left_token < right_token)
  90.         PrintLargeSource(s);
  91.     else 
  92.         PrintSmallSource(s);
  93.     
  94.     s << "\n*** " << getSeverityString() << ": "
  95.       << getErrorMessage()
  96.       << '\n';
  97.     
  98.     return s.Array();
  99. }
  100.  
  101. //
  102. // This procedure is invoked to print a large message that may
  103. // span more than one line. The parameter message points to the
  104. // starting line. The parameter k points to the error message in
  105. // the error structure.
  106. //
  107. void ErrorInfo::PrintLargeSource(ErrorString &s)
  108. {
  109.     if (left_line_no == right_line_no)
  110.     {
  111.         if (left_line_no == 0)
  112.             s << "\n";
  113.         else
  114.         {
  115.             s << "\n\n";
  116.             s.width(6);
  117.             s << left_line_no << ". ";
  118.             for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  119.                 s << lex_stream -> InputBuffer()[i];
  120.  
  121.             int offset = lex_stream -> WcharOffset(left_token, right_token);
  122.             s.width(left_column_no + 8);
  123.             s << "<";
  124.             s.width(right_column_no + right_string_length - left_column_no - 1 + offset);
  125.             s.fill('-');
  126.             s << ">";
  127.             s.fill(' ');
  128.         }
  129.     }
  130.     else
  131.     {
  132.         s << "\n\n";
  133.         s.width(left_column_no + 8);
  134.         s << "<";
  135.  
  136.         s.width(lex_stream -> LineSegmentLength(left_token));
  137.         s.fill('-');
  138.         s << "\n";
  139.         s.fill(' ');
  140.  
  141.         s.width(6);
  142.         s << left_line_no << ". ";
  143.         for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  144.             s << lex_stream -> InputBuffer()[i];
  145.  
  146.         if (right_line_no > left_line_no + 1)
  147.         {
  148.             s.width(left_column_no + 7);
  149.             s << " ";
  150.             s << ". . .\n";
  151.         }
  152.  
  153.         s.width(6);
  154.         s << right_line_no << ". ";
  155.         for (int j = lex_stream -> LineStart(right_line_no); j <= lex_stream -> LineEnd(right_line_no); j++)
  156.             s << lex_stream -> InputBuffer()[j];
  157.  
  158.         int offset = lex_stream -> WcharOffset(right_token);
  159.         s.width(8);
  160.         s << "";
  161.         s.width(right_column_no + right_string_length - 1 + offset);
  162.         s.fill('-');
  163.         s << ">";
  164.         s.fill(' ');
  165.     }
  166. }
  167.  
  168. //
  169. // This procedure is invoked to print a small message that may
  170. // only span a single line. The parameter k points to the error
  171. // message in the error structure.
  172. //
  173. void ErrorInfo::PrintSmallSource(ErrorString &s)
  174. {
  175.     if (left_line_no == 0)
  176.         s << "\n";
  177.     else
  178.     {
  179.         s << "\n\n";
  180.         s.width(6);
  181.         s << left_line_no;
  182.         s << ". ";
  183.         for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  184.             s << lex_stream -> InputBuffer()[i];
  185.  
  186.         s.width(left_column_no + 7);
  187.         s << "";
  188.         if (left_column_no == right_column_no && right_string_length == 1)
  189.             s << '^';
  190.         else
  191.         {
  192.             int offset = lex_stream -> WcharOffset(left_token, right_token);
  193.             s << '<';
  194.             s.width(right_column_no + right_string_length - left_column_no - 1 + offset);
  195.             s.fill('-');
  196.             s << ">";
  197.             s.fill(' ');
  198.         }
  199.     }
  200. }
  201.  
  202. wchar_t *ErrorInfo::emacsErrorString()
  203. {
  204.     ErrorString s;
  205.  
  206.     s << getFileName()
  207.       << ':' << left_line_no  << ':' << left_column_no
  208.       << ':' << right_line_no << ':' << right_column_no
  209.       << ": " << getSeverityString() << ": " 
  210.       << getErrorMessage() << '\n';
  211.     
  212.     return s.Array();
  213. }
  214.  
  215.                        
  216. SemanticError::SemanticError(Control &control_, FileSymbol *file_symbol) : num_errors(0),
  217.                                                                            num_warnings(0),
  218.                                                                            control(control_),
  219.                                                                            lex_stream(file_symbol -> lex_stream),
  220.                                                                            clone_count(0),
  221.                                                                            buffer(1024),
  222.                                                                            error(512)
  223. {
  224.     ErrorInfo::emacs_style_report=!control.option.errors;
  225. }
  226.  
  227. //
  228. // This procedure is invoked by an JIKES PARSER or a semantic
  229. // routine to process an error message.  The JIKES parser always
  230. // passes the value 0 to msg_level to indicate an error.
  231. // This routine simply stores all necessary information about
  232. // the message into an array: error.
  233. //
  234. void SemanticError::Report(SemanticErrorKind msg_code,
  235.                            LexStream::TokenIndex left_token,
  236.                            LexStream::TokenIndex right_token,
  237.                            wchar_t *insert1,
  238.                            wchar_t *insert2,
  239.                            wchar_t *insert3,
  240.                            wchar_t *insert4,
  241.                            wchar_t *insert5,
  242.                            wchar_t *insert6,
  243.                            wchar_t *insert7,
  244.                            wchar_t *insert8,
  245.                            wchar_t *insert9)
  246. {
  247.     //
  248.     // Do not report errors detected while processing a clone !!!
  249.     // If we have a warning and the nowarn option is set, ignore it.
  250.     //
  251.     if (clone_count > 0 ||
  252.         (control.option.nowarn && (warning[msg_code] == 1 || (warning[msg_code] == 2 && (! control.option.zero_defect)))))
  253.         return;
  254.  
  255.     int i = error.NextIndex();
  256.  
  257.     if (warning[msg_code] > 0)
  258.          num_warnings++;
  259.     else num_errors++;
  260.  
  261.     error[i].msg_code = msg_code;
  262.  
  263.     int total_length = 0,
  264.         length1 = 0,
  265.         length2 = 0,
  266.         length3 = 0,
  267.         length4 = 0,
  268.         length5 = 0,
  269.         length6 = 0,
  270.         length7 = 0,
  271.         length8 = 0,
  272.         length9 = 0;
  273.  
  274.     if (insert1)
  275.     {
  276.         length1 = wcslen(insert1);
  277.         total_length += (length1 + 1);
  278.     }
  279.     else error[i].insert1 = NULL;
  280.  
  281.     if (insert2)
  282.     {
  283.         length2 = wcslen(insert2);
  284.         total_length += (length2 + 1);
  285.     }
  286.     else error[i].insert2 = NULL;
  287.  
  288.     if (insert3)
  289.     {
  290.         length3 = wcslen(insert3);
  291.         total_length += (length3 + 1);
  292.     }
  293.     else error[i].insert3 = NULL;
  294.  
  295.     if (insert4)
  296.     {
  297.         length4 = wcslen(insert4);
  298.         total_length += (length4 + 1);
  299.     }
  300.     else error[i].insert4 = NULL;
  301.  
  302.     if (insert5)
  303.     {
  304.         length5 = wcslen(insert5);
  305.         total_length += (length5 + 1);
  306.     }
  307.     else error[i].insert5 = NULL;
  308.  
  309.     if (insert6)
  310.     {
  311.         length6 = wcslen(insert6);
  312.         total_length += (length6 + 1);
  313.     }
  314.     else error[i].insert6 = NULL;
  315.  
  316.     if (insert7)
  317.     {
  318.         length7 = wcslen(insert7);
  319.         total_length += (length7 + 1);
  320.     }
  321.     else error[i].insert7 = NULL;
  322.  
  323.     if (insert8)
  324.     {
  325.         length8 = wcslen(insert8);
  326.         total_length += (length8 + 1);
  327.     }
  328.     else error[i].insert8 = NULL;
  329.  
  330.     if (insert9)
  331.     {
  332.         length9 = wcslen(insert9);
  333.         total_length += (length9 + 1);
  334.     }
  335.     else error[i].insert9 = NULL;
  336.  
  337.     if (total_length > 0)
  338.     {
  339.         wchar_t *ptr = new wchar_t[total_length];
  340.         buffer.Next() = ptr;
  341.  
  342.         if (insert1)
  343.         {
  344.             memmove(ptr, insert1, length1 * sizeof(wchar_t));
  345.             error[i].insert1 = ptr;
  346.             ptr += length1;
  347.             *ptr++ = U_NULL;
  348.         }
  349.  
  350.         if (insert2)
  351.         {
  352.             memmove(ptr, insert2, length2 * sizeof(wchar_t));
  353.             error[i].insert2 = ptr;
  354.             ptr += length2;
  355.             *ptr++ = U_NULL;
  356.         }
  357.  
  358.         if (insert3)
  359.         {
  360.             memmove(ptr, insert3, length3 * sizeof(wchar_t));
  361.             error[i].insert3 = ptr;
  362.             ptr += length3;
  363.             *ptr++ = U_NULL;
  364.         }
  365.  
  366.         if (insert4)
  367.         {
  368.             memmove(ptr, insert4, length4 * sizeof(wchar_t));
  369.             error[i].insert4 = ptr;
  370.             ptr += length4;
  371.             *ptr++ = U_NULL;
  372.         }
  373.  
  374.         if (insert5)
  375.         {
  376.             memmove(ptr, insert5, length5 * sizeof(wchar_t));
  377.             error[i].insert5 = ptr;
  378.             ptr += length5;
  379.             *ptr++ = U_NULL;
  380.         }
  381.  
  382.         if (insert6)
  383.         {
  384.             memmove(ptr, insert6, length6 * sizeof(wchar_t));
  385.             error[i].insert6 = ptr;
  386.             ptr += length6;
  387.             *ptr++ = U_NULL;
  388.         }
  389.  
  390.         if (insert7)
  391.         {
  392.             memmove(ptr, insert7, length7 * sizeof(wchar_t));
  393.             error[i].insert7 = ptr;
  394.             ptr += length7;
  395.             *ptr++ = U_NULL;
  396.         }
  397.  
  398.         if (insert8)
  399.         {
  400.             memmove(ptr, insert8, length8 * sizeof(wchar_t));
  401.             error[i].insert8 = ptr;
  402.             ptr += length8;
  403.             *ptr++ = U_NULL;
  404.         }
  405.  
  406.         if (insert9)
  407.         {
  408.             memmove(ptr, insert9, length9 * sizeof(wchar_t));
  409.             error[i].insert9 = ptr;
  410.             ptr += length9;
  411.             *ptr++ = U_NULL;
  412.         }
  413.     }
  414.  
  415.     error[i].num         = i;
  416.     error[i].left_token  = (left_token > right_token ? right_token : left_token);
  417.     error[i].right_token = right_token;
  418.     error[i].right_string_length = lex_stream -> NameStringLength(right_token);
  419.  
  420.     //
  421.     // Dump the error immediately ?
  422.     //
  423.     if (control.option.dump_errors)
  424.     {
  425.         reportError(i);
  426.  
  427.         if (buffer.Length() > 0)
  428.         {
  429.             delete [] buffer[0];
  430.             buffer.Reset();
  431.         }
  432.         error.Reset(1); // we need at least 1 error in order for the return code to be set properly. See print_messages
  433.     }
  434.  
  435.     return;
  436. }
  437.  
  438. void SemanticError::StaticInitializer()
  439. {
  440.     memset(warning, 0, _num_kinds * sizeof(unsigned char));
  441.  
  442.     warning[INVALID_OPTION] = 1;
  443.     warning[DISABLED_OPTION] = 1;
  444.     warning[CANNOT_OPEN_ZIP_FILE] = 1;
  445.     warning[CANNOT_OPEN_PATH_DIRECTORY] = 1;
  446.  
  447.     warning[EMPTY_DECLARATION] = 1;
  448.     warning[REDUNDANT_ABSTRACT] = 1;
  449.     warning[REDUNDANT_FINAL] = 1;
  450.     warning[REDUNDANT_PUBLIC] = 1;
  451.     warning[REDUNDANT_STATIC] = 1;
  452.     warning[OBSOLESCENT_ABSTRACT] = 1;
  453.     warning[OBSOLESCENT_BRACKETS] = 1;
  454.     warning[NO_TYPES] = 1;
  455.     warning[PARENT_TYPE_IN_UNNAMED_PACKAGE] = 1;
  456.  
  457.     warning[DEPRECATED_TYPE] = 1;
  458.     warning[DEPRECATED_FIELD] = 1;
  459.     warning[DEPRECATED_METHOD] = 1;
  460.     warning[DEPRECATED_CONSTRUCTOR] = 1;
  461.  
  462.     warning[UNNECESSARY_TYPE_IMPORT] = 1;
  463.     warning[MULTIPLE_PUBLIC_TYPES] = 1;
  464.     warning[TYPE_IN_MULTIPLE_FILES] = 1;
  465.     warning[MISMATCHED_TYPE_AND_FILE_NAMES] = 1;
  466.     warning[REFERENCE_TO_TYPE_IN_MISMATCHED_FILE] = 1;
  467.     warning[ONE_UNNAMED_PACKAGE] = 1;
  468.     warning[RECOMPILATION] = 1;
  469.     warning[METHOD_WITH_CONSTRUCTOR_NAME] = 1;
  470.  
  471.     warning[DEFAULT_METHOD_NOT_OVERRIDDEN] = 1;
  472.  
  473.     //
  474.     // TODO: Review the cases below. They should be flagged as errors.
  475.     //       However, since javac does not flag them at all, we only issue
  476.     //       a warning.
  477.     warning[STATIC_PROTECTED_FIELD_ACCESS] = 2;
  478.     warning[STATIC_PROTECTED_METHOD_ACCESS] = 2;
  479.     warning[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL] = 2;
  480.     warning[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER] = 2;
  481.     warning[PRIVATE_METHOD_OVERRIDE] = 1;
  482.     warning[PRIVATE_METHOD_OVERRIDE_EXTERNALLY] = 1;
  483.  
  484.     //
  485.     // Something stronger than a warning, but code will be generated anyway
  486.     //
  487.     warning[BAD_INPUT_FILE] = 2;
  488.     warning[UNREADABLE_INPUT_FILE] = 2;
  489.     warning[UNREACHABLE_DEFAULT_CATCH_CLAUSE] = 2;
  490.     warning[ZERO_DIVIDE_CAUTION] = 2;
  491.  
  492. //
  493. // TODO: Let these conditions be flagged as errors now.
  494. //
  495. //    warning[UNREACHABLE_CATCH_CLAUSE] = 2;
  496. //    warning[VARIABLE_NOT_DEFINITELY_ASSIGNED] = 2;
  497. //    warning[TARGET_VARIABLE_IS_FINAL] = 2;
  498. //    warning[FINAL_VARIABLE_TARGET_IN_LOOP] = 2;
  499. //    warning[VOID_TO_STRING] = 2;
  500. //
  501.  
  502. #ifdef JIKES_DEBUG
  503.     for (int i = 0; i < _num_kinds; i++)
  504.         print_message[i] = NULL;
  505. #endif
  506.  
  507.     print_message[BAD_ERROR] = PrintBAD_ERROR;
  508.     print_message[DEFAULT_ERROR] = PrintDEFAULT_ERROR;
  509.     print_message[INVALID_OPTION] = PrintINVALID_OPTION;
  510.     print_message[INVALID_K_OPTION] = PrintINVALID_K_OPTION;
  511.     print_message[INVALID_K_TARGET] = PrintINVALID_K_TARGET;
  512.     print_message[INVALID_TAB_VALUE] = PrintINVALID_TAB_VALUE;
  513.     print_message[INVALID_DIRECTORY] = PrintINVALID_DIRECTORY;
  514.     print_message[UNSUPPORTED_OPTION] = PrintUNSUPPORTED_OPTION;
  515.     print_message[UNSUPPORTED_ENCODING] = PrintUNSUPPORTED_ENCODING;
  516.     print_message[DISABLED_OPTION] = PrintDISABLED_OPTION;
  517.     print_message[NO_CURRENT_DIRECTORY] = PrintNO_CURRENT_DIRECTORY;
  518.     print_message[CANNOT_OPEN_ZIP_FILE] = PrintCANNOT_OPEN_ZIP_FILE;
  519.     print_message[CANNOT_OPEN_PATH_DIRECTORY] = PrintCANNOT_OPEN_PATH_DIRECTORY;
  520.     print_message[PACKAGE_NOT_FOUND] = PrintPACKAGE_NOT_FOUND;
  521.     print_message[CANNOT_OPEN_DIRECTORY] = PrintCANNOT_OPEN_DIRECTORY;
  522.     print_message[BAD_INPUT_FILE] = PrintBAD_INPUT_FILE;
  523.     print_message[UNREADABLE_INPUT_FILE] = PrintUNREADABLE_INPUT_FILE;
  524.     print_message[NON_STANDARD_LIBRARY_TYPE] = PrintNON_STANDARD_LIBRARY_TYPE;
  525.     print_message[LIBRARY_METHOD_NOT_FOUND] = PrintLIBRARY_METHOD_NOT_FOUND;
  526.     print_message[CANNOT_REOPEN_FILE] = PrintCANNOT_REOPEN_FILE;
  527.     print_message[CANNOT_WRITE_FILE] = PrintCANNOT_WRITE_FILE;
  528.     print_message[CONSTANT_POOL_OVERFLOW] = PrintCONSTANT_POOL_OVERFLOW;
  529.     print_message[INTERFACES_OVERFLOW] = PrintINTERFACES_OVERFLOW;
  530.     print_message[METHODS_OVERFLOW] = PrintMETHODS_OVERFLOW;
  531.     print_message[STRING_OVERFLOW] = PrintSTRING_OVERFLOW;
  532.     print_message[PARAMETER_OVERFLOW] = PrintPARAMETER_OVERFLOW;
  533.     print_message[ARRAY_OVERFLOW] = PrintARRAY_OVERFLOW;
  534.     print_message[FIELDS_OVERFLOW] = PrintFIELDS_OVERFLOW;
  535.     print_message[LOCAL_VARIABLES_OVERFLOW] = PrintLOCAL_VARIABLES_OVERFLOW;
  536.     print_message[STACK_OVERFLOW] = PrintSTACK_OVERFLOW;
  537.     print_message[CODE_OVERFLOW] = PrintCODE_OVERFLOW;
  538.     print_message[CANNOT_COMPUTE_COLUMNS] = PrintCANNOT_COMPUTE_COLUMNS;
  539.     print_message[EMPTY_DECLARATION] = PrintEMPTY_DECLARATION;
  540.     print_message[REDUNDANT_ABSTRACT] = PrintREDUNDANT_ABSTRACT;
  541.     print_message[REDUNDANT_FINAL] = PrintREDUNDANT_FINAL;
  542.     print_message[REDUNDANT_PUBLIC] = PrintREDUNDANT_PUBLIC;
  543.     print_message[REDUNDANT_STATIC] = PrintREDUNDANT_STATIC;
  544.     print_message[OBSOLESCENT_ABSTRACT] = PrintOBSOLESCENT_ABSTRACT;
  545.     print_message[OBSOLESCENT_BRACKETS] = PrintOBSOLESCENT_BRACKETS;
  546.     print_message[NO_TYPES] = PrintNO_TYPES;
  547.     print_message[MULTIPLE_PUBLIC_TYPES] = PrintMULTIPLE_PUBLIC_TYPES;
  548.     print_message[TYPE_IN_MULTIPLE_FILES] = PrintTYPE_IN_MULTIPLE_FILES;
  549.     print_message[PACKAGE_TYPE_CONFLICT] = PrintPACKAGE_TYPE_CONFLICT;
  550.     print_message[DIRECTORY_FILE_CONFLICT] = PrintDIRECTORY_FILE_CONFLICT;
  551.     print_message[FILE_FILE_CONFLICT] = PrintFILE_FILE_CONFLICT;
  552.     print_message[MISMATCHED_TYPE_AND_FILE_NAMES] = PrintMISMATCHED_TYPE_AND_FILE_NAMES;
  553.     print_message[REFERENCE_TO_TYPE_IN_MISMATCHED_FILE] = PrintREFERENCE_TO_TYPE_IN_MISMATCHED_FILE;
  554.     print_message[DUPLICATE_INNER_TYPE_NAME] = PrintDUPLICATE_INNER_TYPE_NAME;
  555.     print_message[DUPLICATE_TYPE_DECLARATION] = PrintDUPLICATE_TYPE_DECLARATION;
  556.     print_message[UNNECESSARY_TYPE_IMPORT] = PrintUNNECESSARY_TYPE_IMPORT;
  557.     print_message[DUPLICATE_ACCESS_MODIFIER] = PrintDUPLICATE_ACCESS_MODIFIER;
  558.     print_message[DUPLICATE_MODIFIER] = PrintDUPLICATE_MODIFIER;
  559.     print_message[FINAL_ABSTRACT_CLASS] = PrintFINAL_ABSTRACT_CLASS;
  560.     print_message[VOLATILE_FINAL] = PrintVOLATILE_FINAL;
  561.     print_message[FINAL_VOLATILE] = PrintFINAL_VOLATILE;
  562.     print_message[INVALID_TOP_LEVEL_CLASS_MODIFIER] = PrintINVALID_TOP_LEVEL_CLASS_MODIFIER;
  563.     print_message[INVALID_INNER_CLASS_MODIFIER] = PrintINVALID_INNER_CLASS_MODIFIER;
  564.     print_message[INVALID_STATIC_INNER_CLASS_MODIFIER] = PrintINVALID_STATIC_INNER_CLASS_MODIFIER;
  565.     print_message[INVALID_LOCAL_CLASS_MODIFIER] = PrintINVALID_LOCAL_CLASS_MODIFIER;
  566.     print_message[INVALID_INTERFACE_MODIFIER] = PrintINVALID_INTERFACE_MODIFIER;
  567.     print_message[INVALID_FIELD_MODIFIER] = PrintINVALID_FIELD_MODIFIER;
  568.     print_message[INVALID_LOCAL_MODIFIER] = PrintINVALID_LOCAL_MODIFIER;
  569.     print_message[INVALID_METHOD_MODIFIER] = PrintINVALID_METHOD_MODIFIER;
  570.     print_message[INVALID_SIGNATURE_MODIFIER] = PrintINVALID_SIGNATURE_MODIFIER;
  571.     print_message[INVALID_CONSTRUCTOR_MODIFIER] = PrintINVALID_CONSTRUCTOR_MODIFIER;
  572.     print_message[INVALID_CONSTANT_MODIFIER] = PrintINVALID_CONSTANT_MODIFIER;
  573.     print_message[UNINITIALIZED_FIELD] = PrintUNINITIALIZED_FIELD;
  574.     print_message[PARENT_TYPE_IN_UNNAMED_PACKAGE] = PrintPARENT_TYPE_IN_UNNAMED_PACKAGE;
  575.     print_message[RECOMPILATION] = PrintRECOMPILATION;
  576.     print_message[TYPE_NOT_FOUND] = PrintTYPE_NOT_FOUND;
  577.     print_message[DUPLICATE_ON_DEMAND_IMPORT] = PrintDUPLICATE_ON_DEMAND_IMPORT;
  578.     print_message[NOT_A_TYPE] = PrintNOT_A_TYPE;
  579.     print_message[NOT_A_CLASS] = PrintNOT_A_CLASS;
  580.     print_message[NOT_AN_INTERFACE] = PrintNOT_AN_INTERFACE;
  581.     print_message[SUPER_IS_FINAL] = PrintSUPER_IS_FINAL;
  582.     print_message[OBJECT_WITH_SUPER_TYPE] = PrintOBJECT_WITH_SUPER_TYPE;
  583.     print_message[OBJECT_HAS_NO_SUPER_TYPE] = PrintOBJECT_HAS_NO_SUPER_TYPE;
  584.     print_message[DUPLICATE_FIELD] = PrintDUPLICATE_FIELD;
  585.     print_message[DUPLICATE_METHOD] = PrintDUPLICATE_METHOD;
  586.     print_message[DUPLICATE_CONSTRUCTOR] = PrintDUPLICATE_CONSTRUCTOR;
  587.     print_message[MISMATCHED_INHERITED_METHOD] = PrintMISMATCHED_INHERITED_METHOD;
  588.     print_message[MISMATCHED_INHERITED_METHOD_EXTERNALLY] = PrintMISMATCHED_INHERITED_METHOD_EXTERNALLY;
  589.     print_message[MISMATCHED_INHERITED_METHODS_IN_BASE] = PrintMISMATCHED_INHERITED_METHODS_IN_BASE;
  590.     print_message[DUPLICATE_FORMAL_PARAMETER] = PrintDUPLICATE_FORMAL_PARAMETER;
  591.     print_message[MISMATCHED_CONSTRUCTOR_NAME] = PrintMISMATCHED_CONSTRUCTOR_NAME;
  592.     print_message[METHOD_WITH_CONSTRUCTOR_NAME] = PrintMETHOD_WITH_CONSTRUCTOR_NAME;
  593.     print_message[DUPLICATE_LOCAL_VARIABLE_DECLARATION] = PrintDUPLICATE_LOCAL_VARIABLE_DECLARATION;
  594.     print_message[DUPLICATE_LOCAL_TYPE_DECLARATION] = PrintDUPLICATE_LOCAL_TYPE_DECLARATION;
  595.     print_message[MULTIPLE_DEFAULT_LABEL] = PrintMULTIPLE_DEFAULT_LABEL;
  596.     print_message[UNDECLARED_LABEL] = PrintUNDECLARED_LABEL;
  597.     print_message[DUPLICATE_LABEL] = PrintDUPLICATE_LABEL;
  598.     print_message[CATCH_PRIMITIVE_TYPE] = PrintCATCH_PRIMITIVE_TYPE;
  599.     print_message[CATCH_ARRAY_TYPE] = PrintCATCH_ARRAY_TYPE;
  600.     print_message[AMBIGUOUS_FIELD] = PrintAMBIGUOUS_FIELD;
  601.     print_message[AMBIGUOUS_TYPE] = PrintAMBIGUOUS_TYPE;
  602.     print_message[FIELD_IS_TYPE] = PrintFIELD_IS_TYPE;
  603.     print_message[FIELD_NOT_FOUND] = PrintFIELD_NOT_FOUND;
  604.     print_message[FIELD_NAME_MISSPELLED] = PrintFIELD_NAME_MISSPELLED;
  605.     print_message[FIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE] = PrintFIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE;
  606.     print_message[FIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE] = PrintFIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE;
  607.     print_message[NAME_NOT_FOUND] = PrintNAME_NOT_FOUND;
  608.     print_message[METHOD_NOT_FIELD] = PrintMETHOD_NOT_FIELD;
  609.     print_message[NAME_NOT_YET_AVAILABLE] = PrintNAME_NOT_YET_AVAILABLE;
  610.     print_message[NAME_NOT_VARIABLE] = PrintNAME_NOT_VARIABLE;
  611.     print_message[NAME_NOT_CLASS_VARIABLE] = PrintNAME_NOT_CLASS_VARIABLE;
  612.     print_message[NOT_A_NUMERIC_VARIABLE] = PrintNOT_A_NUMERIC_VARIABLE;
  613.     print_message[METHOD_NOT_FOUND] = PrintMETHOD_NOT_FOUND;
  614.     print_message[METHOD_NAME_NOT_FOUND_IN_TYPE] = PrintMETHOD_NAME_NOT_FOUND_IN_TYPE;
  615.     print_message[METHOD_NAME_MISSPELLED] = PrintMETHOD_NAME_MISSPELLED;
  616.     print_message[METHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE] = PrintMETHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE;
  617.     print_message[METHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE] = PrintMETHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE;
  618.     print_message[HIDDEN_METHOD_IN_ENCLOSING_CLASS] = PrintHIDDEN_METHOD_IN_ENCLOSING_CLASS;
  619.     print_message[FIELD_NOT_METHOD] = PrintFIELD_NOT_METHOD;
  620.     print_message[TYPE_NOT_METHOD] = PrintTYPE_NOT_METHOD;
  621.     print_message[TYPE_NOT_FIELD] = PrintTYPE_NOT_FIELD;
  622.     print_message[METHOD_NOT_CLASS_METHOD] = PrintMETHOD_NOT_CLASS_METHOD;
  623.     print_message[AMBIGUOUS_CONSTRUCTOR_INVOCATION] = PrintAMBIGUOUS_CONSTRUCTOR_INVOCATION;
  624.     print_message[AMBIGUOUS_METHOD_INVOCATION] = PrintAMBIGUOUS_METHOD_INVOCATION;
  625.     print_message[CONSTRUCTOR_NOT_FOUND] = PrintCONSTRUCTOR_NOT_FOUND;
  626.     print_message[METHOD_FOUND_FOR_CONSTRUCTOR] = PrintMETHOD_FOUND_FOR_CONSTRUCTOR;
  627.     print_message[ABSTRACT_TYPE_CREATION] = PrintABSTRACT_TYPE_CREATION;
  628.     print_message[INVALID_INSTANCEOF_CONVERSION] = PrintINVALID_INSTANCEOF_CONVERSION;
  629.     print_message[INVALID_CAST_CONVERSION] = PrintINVALID_CAST_CONVERSION;
  630.     print_message[INVALID_CAST_TYPE] = PrintINVALID_CAST_TYPE;
  631.     print_message[INCOMPATIBLE_TYPE_FOR_INITIALIZATION] = PrintINCOMPATIBLE_TYPE_FOR_INITIALIZATION;
  632.     print_message[INCOMPATIBLE_TYPE_FOR_ASSIGNMENT] = PrintINCOMPATIBLE_TYPE_FOR_ASSIGNMENT;
  633.     print_message[INCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION] = PrintINCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION;
  634.     print_message[INCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION] = PrintINCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION;
  635.     print_message[VOID_ARRAY] = PrintVOID_ARRAY;
  636.     print_message[VOID_TYPE_IN_EQUALITY_EXPRESSION] = PrintVOID_TYPE_IN_EQUALITY_EXPRESSION;
  637.     print_message[TYPE_NOT_THROWABLE] = PrintTYPE_NOT_THROWABLE;
  638.     print_message[TYPE_NOT_PRIMITIVE] = PrintTYPE_NOT_PRIMITIVE;
  639.     print_message[TYPE_NOT_INTEGRAL] = PrintTYPE_NOT_INTEGRAL;
  640.     print_message[TYPE_NOT_NUMERIC] = PrintTYPE_NOT_NUMERIC;
  641.     print_message[TYPE_NOT_INTEGER] = PrintTYPE_NOT_INTEGER;
  642.     print_message[TYPE_NOT_BOOLEAN] = PrintTYPE_NOT_BOOLEAN;
  643.     print_message[TYPE_NOT_ARRAY] = PrintTYPE_NOT_ARRAY;
  644.     print_message[TYPE_NOT_REFERENCE] = PrintTYPE_NOT_REFERENCE;
  645.     print_message[TYPE_NOT_VALID_FOR_SWITCH] = PrintTYPE_NOT_VALID_FOR_SWITCH;
  646.     print_message[TYPE_IS_VOID] = PrintTYPE_IS_VOID;
  647.     print_message[VALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE] = PrintVALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE;
  648.     print_message[TYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE] = PrintTYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE;
  649.     print_message[DUPLICATE_CASE_VALUE] = PrintDUPLICATE_CASE_VALUE;
  650.     print_message[MISPLACED_THIS_EXPRESSION] = PrintMISPLACED_THIS_EXPRESSION;
  651.     print_message[MISPLACED_SUPER_EXPRESSION] = PrintMISPLACED_SUPER_EXPRESSION;
  652.     print_message[TARGET_VARIABLE_IS_FINAL] = PrintTARGET_VARIABLE_IS_FINAL;
  653.     print_message[FINAL_VARIABLE_TARGET_IN_LOOP] = PrintFINAL_VARIABLE_TARGET_IN_LOOP;
  654.     print_message[UNINITIALIZED_FINAL_VARIABLE] = PrintUNINITIALIZED_FINAL_VARIABLE;
  655.     print_message[UNINITIALIZED_STATIC_FINAL_VARIABLE] = PrintUNINITIALIZED_STATIC_FINAL_VARIABLE;
  656.     print_message[UNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR] = PrintUNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR;
  657.     print_message[INIT_SCALAR_WITH_ARRAY] = PrintINIT_SCALAR_WITH_ARRAY;
  658.     print_message[INIT_ARRAY_WITH_SCALAR] = PrintINIT_ARRAY_WITH_SCALAR;
  659.     print_message[INVALID_BYTE_VALUE] = PrintINVALID_BYTE_VALUE;
  660.     print_message[INVALID_SHORT_VALUE] = PrintINVALID_SHORT_VALUE;
  661.     print_message[INVALID_CHARACTER_VALUE] = PrintINVALID_CHARACTER_VALUE;
  662.     print_message[INVALID_INT_VALUE] = PrintINVALID_INT_VALUE;
  663.     print_message[INVALID_LONG_VALUE] = PrintINVALID_LONG_VALUE;
  664.     print_message[INVALID_FLOAT_VALUE] = PrintINVALID_FLOAT_VALUE;
  665.     print_message[INVALID_DOUBLE_VALUE] = PrintINVALID_DOUBLE_VALUE;
  666.     print_message[INVALID_STRING_VALUE] = PrintINVALID_STRING_VALUE;
  667.     print_message[RETURN_STATEMENT_IN_INITIALIZER] = PrintRETURN_STATEMENT_IN_INITIALIZER;
  668.     print_message[MISPLACED_RETURN_WITH_EXPRESSION] = PrintMISPLACED_RETURN_WITH_EXPRESSION;
  669.     print_message[MISPLACED_RETURN_WITH_NO_EXPRESSION] = PrintMISPLACED_RETURN_WITH_NO_EXPRESSION;
  670.     print_message[MISMATCHED_RETURN_AND_METHOD_TYPE] = PrintMISMATCHED_RETURN_AND_METHOD_TYPE;
  671.     print_message[EXPRESSION_NOT_THROWABLE] = PrintEXPRESSION_NOT_THROWABLE;
  672.     print_message[BAD_THROWABLE_EXPRESSION_IN_TRY] = PrintBAD_THROWABLE_EXPRESSION_IN_TRY;
  673.     print_message[BAD_THROWABLE_EXPRESSION_IN_METHOD] = PrintBAD_THROWABLE_EXPRESSION_IN_METHOD;
  674.     print_message[BAD_THROWABLE_EXPRESSION] = PrintBAD_THROWABLE_EXPRESSION;
  675.     print_message[MISPLACED_BREAK_STATEMENT] = PrintMISPLACED_BREAK_STATEMENT;
  676.     print_message[MISPLACED_CONTINUE_STATEMENT] = PrintMISPLACED_CONTINUE_STATEMENT;
  677.     print_message[MISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintMISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION;
  678.     print_message[INVALID_CONTINUE_TARGET] = PrintINVALID_CONTINUE_TARGET;
  679.     print_message[NON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD;
  680.     print_message[NON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD;
  681.     print_message[NON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS] = PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS;
  682.     print_message[NON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD;
  683.     print_message[NO_ABSTRACT_METHOD_IMPLEMENTATION] = PrintNO_ABSTRACT_METHOD_IMPLEMENTATION;
  684.     print_message[DUPLICATE_INTERFACE] = PrintDUPLICATE_INTERFACE;
  685.     print_message[UNKNOWN_QUALIFIED_NAME_BASE] = PrintUNKNOWN_QUALIFIED_NAME_BASE;
  686.     print_message[UNKNOWN_AMBIGUOUS_NAME] = PrintUNKNOWN_AMBIGUOUS_NAME;
  687.     print_message[CIRCULAR_INTERFACE] = PrintCIRCULAR_INTERFACE;
  688.     print_message[CIRCULAR_CLASS] = PrintCIRCULAR_CLASS;
  689.     print_message[TYPE_NOT_ACCESSIBLE] = PrintTYPE_NOT_ACCESSIBLE;
  690.     print_message[PRIVATE_FIELD_NOT_ACCESSIBLE] = PrintPRIVATE_FIELD_NOT_ACCESSIBLE;
  691.     print_message[PROTECTED_FIELD_NOT_ACCESSIBLE] = PrintPROTECTED_FIELD_NOT_ACCESSIBLE;
  692.     print_message[DEFAULT_FIELD_NOT_ACCESSIBLE] = PrintDEFAULT_FIELD_NOT_ACCESSIBLE;
  693.     print_message[PRIVATE_METHOD_NOT_ACCESSIBLE] = PrintPRIVATE_METHOD_NOT_ACCESSIBLE;
  694.     print_message[PROTECTED_METHOD_NOT_ACCESSIBLE] = PrintPROTECTED_METHOD_NOT_ACCESSIBLE;
  695.     print_message[DEFAULT_METHOD_NOT_ACCESSIBLE] = PrintDEFAULT_METHOD_NOT_ACCESSIBLE;
  696.     print_message[PRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintPRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE;
  697.     print_message[PROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintPROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE;
  698.     print_message[DEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintDEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE;
  699.     print_message[CONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION] = PrintCONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION;
  700.     print_message[CONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION] = PrintCONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION;
  701.     print_message[PARAMETER_REDECLARED] = PrintPARAMETER_REDECLARED;
  702.     print_message[BAD_ABSTRACT_METHOD_MODIFIER] = PrintBAD_ABSTRACT_METHOD_MODIFIER;
  703.     print_message[ABSTRACT_METHOD_MODIFIER_CONFLICT] = PrintABSTRACT_METHOD_MODIFIER_CONFLICT;
  704.     print_message[ABSTRACT_METHOD_INVOCATION] = PrintABSTRACT_METHOD_INVOCATION;
  705.     print_message[FINAL_METHOD_OVERRIDE] = PrintFINAL_METHOD_OVERRIDE;
  706.     print_message[FINAL_METHOD_OVERRIDE_EXTERNALLY] = PrintFINAL_METHOD_OVERRIDE_EXTERNALLY;
  707.     print_message[PRIVATE_METHOD_OVERRIDE] = PrintPRIVATE_METHOD_OVERRIDE;
  708.     print_message[PRIVATE_METHOD_OVERRIDE_EXTERNALLY] = PrintPRIVATE_METHOD_OVERRIDE_EXTERNALLY;
  709.     print_message[INSTANCE_METHOD_OVERRIDE] = PrintINSTANCE_METHOD_OVERRIDE;
  710.     print_message[INSTANCE_METHOD_OVERRIDE_EXTERNALLY] = PrintINSTANCE_METHOD_OVERRIDE_EXTERNALLY;
  711.     print_message[CLASS_METHOD_OVERRIDE] = PrintCLASS_METHOD_OVERRIDE;
  712.     print_message[CLASS_METHOD_OVERRIDE_EXTERNALLY] = PrintCLASS_METHOD_OVERRIDE_EXTERNALLY;
  713.     print_message[MISMATCHED_OVERRIDDEN_EXCEPTION] = PrintMISMATCHED_OVERRIDDEN_EXCEPTION;
  714.     print_message[MISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY] = PrintMISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY;
  715.     print_message[ABSTRACT_METHOD_WITH_BODY] = PrintABSTRACT_METHOD_WITH_BODY;
  716.     print_message[NON_ABSTRACT_METHOD_WITHOUT_BODY] = PrintNON_ABSTRACT_METHOD_WITHOUT_BODY;
  717.     print_message[BAD_ACCESS_METHOD_OVERRIDE] = PrintBAD_ACCESS_METHOD_OVERRIDE;
  718.     print_message[BAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY] = PrintBAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY;
  719.     print_message[STATIC_OVERRIDE_ABSTRACT] = PrintSTATIC_OVERRIDE_ABSTRACT;
  720.     print_message[STATIC_OVERRIDE_ABSTRACT_EXTERNALLY] = PrintSTATIC_OVERRIDE_ABSTRACT_EXTERNALLY;
  721.     print_message[CIRCULAR_THIS_CALL] = PrintCIRCULAR_THIS_CALL;
  722.     print_message[INSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  723.     print_message[INSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  724.     print_message[SYNTHETIC_VARIABLE_ACCESS] = PrintSYNTHETIC_VARIABLE_ACCESS;
  725.     print_message[SYNTHETIC_METHOD_INVOCATION] = PrintSYNTHETIC_METHOD_INVOCATION;
  726.     print_message[SYNTHETIC_CONSTRUCTOR_INVOCATION] = PrintSYNTHETIC_CONSTRUCTOR_INVOCATION;
  727.     print_message[THIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintTHIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  728.     print_message[SUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintSUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  729.     print_message[INNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  730.     print_message[EXPRESSION_NOT_CONSTANT] = PrintEXPRESSION_NOT_CONSTANT;
  731.     print_message[UNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION] = PrintUNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION;
  732.     print_message[UNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION] = PrintUNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION;
  733.     print_message[UNREACHABLE_CATCH_CLAUSE] = PrintUNREACHABLE_CATCH_CLAUSE;
  734.     print_message[UNREACHABLE_DEFAULT_CATCH_CLAUSE] = PrintUNREACHABLE_DEFAULT_CATCH_CLAUSE;
  735.     print_message[UNREACHABLE_STATEMENT] = PrintUNREACHABLE_STATEMENT;
  736.     print_message[UNREACHABLE_STATEMENTS] = PrintUNREACHABLE_STATEMENTS;
  737.     print_message[UNREACHABLE_CONSTRUCTOR_BODY] = PrintUNREACHABLE_CONSTRUCTOR_BODY;
  738.     print_message[BLOCKED_CATCH_CLAUSE] = PrintBLOCKED_CATCH_CLAUSE;
  739.     print_message[VARIABLE_NOT_DEFINITELY_ASSIGNED] = PrintVARIABLE_NOT_DEFINITELY_ASSIGNED;
  740.     print_message[TYPED_METHOD_WITH_NO_RETURN] = PrintTYPED_METHOD_WITH_NO_RETURN;
  741.  
  742.     print_message[DEFAULT_METHOD_NOT_OVERRIDDEN] = PrintDEFAULT_METHOD_NOT_OVERRIDDEN;
  743.  
  744.     print_message[ONE_UNNAMED_PACKAGE] = PrintONE_UNNAMED_PACKAGE;
  745.     print_message[TYPE_NOT_IN_UNNAMED_PACKAGE] = PrintTYPE_NOT_IN_UNNAMED_PACKAGE;
  746.     print_message[TYPE_IN_WRONG_PACKAGE] = PrintTYPE_IN_WRONG_PACKAGE;
  747.     print_message[TYPE_NAME_MISMATCH] = PrintTYPE_NAME_MISMATCH;
  748.  
  749.     print_message[DEPRECATED_TYPE] = PrintDEPRECATED_TYPE;
  750.     print_message[DEPRECATED_FIELD] = PrintDEPRECATED_FIELD;
  751.     print_message[DEPRECATED_METHOD] = PrintDEPRECATED_METHOD;
  752.     print_message[DEPRECATED_CONSTRUCTOR] = PrintDEPRECATED_CONSTRUCTOR;
  753.  
  754.     print_message[COMPRESSED_ZIP_FILE] = PrintCOMPRESSED_ZIP_FILE;
  755.     print_message[INVALID_CLASS_FILE] = PrintINVALID_CLASS_FILE;
  756.     print_message[CANNOT_OPEN_CLASS_FILE] = PrintCANNOT_OPEN_CLASS_FILE;
  757.  
  758.     print_message[INTERFACE_NOT_INNER_CLASS] = PrintINTERFACE_NOT_INNER_CLASS;
  759.     print_message[STATIC_NOT_INNER_CLASS] = PrintSTATIC_NOT_INNER_CLASS;
  760.     print_message[TYPE_NOT_INNER_CLASS] = PrintTYPE_NOT_INNER_CLASS;
  761.     print_message[SUPER_TYPE_NOT_INNER_CLASS] = PrintSUPER_TYPE_NOT_INNER_CLASS;
  762.     print_message[STATIC_FIELD_IN_INNER_CLASS] = PrintSTATIC_FIELD_IN_INNER_CLASS;
  763.     print_message[STATIC_METHOD_IN_INNER_CLASS] = PrintSTATIC_METHOD_IN_INNER_CLASS;
  764.     print_message[STATIC_TYPE_IN_INNER_CLASS] = PrintSTATIC_TYPE_IN_INNER_CLASS;
  765.     print_message[STATIC_INITIALIZER_IN_INNER_CLASS] = PrintSTATIC_INITIALIZER_IN_INNER_CLASS;
  766.     print_message[INNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE] = PrintINNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE;
  767.     print_message[STATIC_PROTECTED_FIELD_ACCESS] = PrintSTATIC_PROTECTED_FIELD_ACCESS;
  768.     print_message[STATIC_PROTECTED_METHOD_ACCESS] = PrintSTATIC_PROTECTED_METHOD_ACCESS;
  769.     print_message[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL] = PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL;
  770.     print_message[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER] = PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER;
  771.     print_message[ILLEGAL_THIS_FIELD_ACCESS] = PrintILLEGAL_THIS_FIELD_ACCESS;
  772.     print_message[CONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS] = PrintCONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS;
  773.     print_message[ENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION] = PrintENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION;
  774.     print_message[ENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION] = PrintENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION;
  775.     print_message[ENCLOSING_INSTANCE_NOT_ACCESSIBLE] = PrintENCLOSING_INSTANCE_NOT_ACCESSIBLE;
  776.     print_message[INVALID_ENCLOSING_INSTANCE] = PrintINVALID_ENCLOSING_INSTANCE;
  777.     print_message[ZERO_DIVIDE_ERROR] = PrintZERO_DIVIDE_ERROR;
  778.     print_message[ZERO_DIVIDE_CAUTION] = PrintZERO_DIVIDE_CAUTION;
  779.     print_message[VOID_TO_STRING] = PrintVOID_TO_STRING;
  780.  
  781. #ifdef JIKES_DEBUG
  782.     //
  783.     // Make sure that there is a message associated with each code
  784.     //
  785.     for (int k = 0; k < _num_kinds; k++)
  786.         assert(print_message[k] != NULL);
  787. #endif
  788. }
  789.  
  790.  
  791. //
  792. // This procedure uses a  quick sort algorithm to sort the ERRORS
  793. // by the left_line_no and left_column_no fields.
  794. //
  795. void SemanticError::SortMessages()
  796. {
  797.      int lower,
  798.          upper,
  799.          lostack[32],
  800.          histack[32];
  801.  
  802.      int top,
  803.          i,
  804.          j;
  805.      ErrorInfo pivot,
  806.                temp;
  807.  
  808.      top = 0;
  809.      lostack[top] = 0;
  810.      histack[top] = error.Length() - 1;
  811.  
  812.      while(top >= 0)
  813.      {
  814.          lower = lostack[top];
  815.          upper = histack[top];
  816.          top--;
  817.  
  818.          while(upper > lower)
  819.          {
  820.              //
  821.              // The array is most-likely almost sorted. Therefore,
  822.              // we use the middle element as the pivot element.
  823.              //
  824.              i = (lower + upper) / 2;
  825.              pivot = error[i];
  826.              error[i] = error[lower];
  827.  
  828.              //
  829.              // Split the array section indicated by LOWER and UPPER
  830.              // using ARRAY(LOWER) as the pivot.
  831.              //
  832.              i = lower;
  833.              for (j = lower + 1; j <= upper; j++)
  834.                  if ((error[j].left_token < pivot.left_token) ||
  835.                  //
  836.                  // When two error messages start in the same location
  837.                  // and one is nested inside the other, the outer one
  838.                  // is placed first so that it can be printed last.
  839.                  // Recall that its right-span location is reached
  840.                  // after the inner one has been completely processed.
  841.                  //
  842.                      (error[j].left_token == pivot.left_token &&
  843.                       error[j].right_token > pivot.right_token) ||
  844.                  //
  845.                  // When two error messages are at the same location
  846.                  // span, check the NUM field to keep the sort stable.
  847.                  // When the location spans only a single symbol,
  848.                  // the one with the lowest "num" is placed first.
  849.                  //
  850.                      (error[j].left_token  == pivot.left_token  &&
  851.                       error[j].right_token == pivot.right_token &&
  852.                       pivot.left_token == pivot.right_token     &&
  853.                       error[j].num < pivot.num)                       ||
  854.                  //
  855.                  // When two error messages are at the same location
  856.                  // which spans more than one symbol in the source,
  857.                  // the first message is treated as being nested into
  858.                  // the second message and (just like the nested case
  859.                  // above) it is placed last in the sorted sequence.
  860.                  //
  861.                      (error[j].left_token  == pivot.left_token  &&
  862.                       error[j].right_token == pivot.right_token &&
  863.                       pivot.left_token < pivot.right_token      &&
  864.                       error[j].num > pivot.num))
  865.                  {
  866.                      temp = error[++i];
  867.                      error[i] = error[j];
  868.                      error[j] = temp;
  869.                  }
  870.              error[lower] = error[i];
  871.              error[i] = pivot;
  872.  
  873.              top++;
  874.              if ((i - lower) < (upper - i))
  875.              {
  876.                  lostack[top] = i + 1;
  877.                  histack[top] = upper;
  878.                  upper = i - 1;
  879.              }
  880.              else
  881.              {
  882.                  histack[top] = i - 1;
  883.                  lostack[top] = lower;
  884.                  lower = i + 1;
  885.              }
  886.          }
  887.      }
  888.  
  889.      return;
  890. }
  891.  
  892.  
  893. //
  894. // This is the local private procedure that prints the semantic error messages.
  895. //
  896. int SemanticError::PrintMessages()
  897. {
  898.     int return_code = (num_errors > 0 ? 1 : 0);
  899.  
  900.     //
  901.     // If the errors have not yet been dumped,...
  902.     //
  903.     if (! control.option.dump_errors)
  904.     {
  905.         if (control.option.errors)
  906.         {
  907.             if (num_errors == 0)
  908.             {
  909.                 if (control.option.nowarn) // we only had warnings and they should not be reported
  910.                     return return_code;
  911.  
  912.                 Coutput << "\nIssued "
  913.                         << num_warnings
  914.                         << (lex_stream -> file_symbol -> semantic == control.system_semantic ? " system" : " semantic")
  915.                         << " warning" << (num_warnings <= 1 ? "" : "s");
  916.             }
  917.             else // we had some errors, and possibly warnings as well
  918.             {
  919.                 Coutput << "\nFound "
  920.                         << num_errors
  921.                         << (lex_stream -> file_symbol -> semantic == control.system_semantic ? " system" : " semantic")
  922.                         << " error" << (num_errors <= 1 ? "" : "s");
  923.                 if (num_warnings > 0 && !control.option.nowarn)
  924.                 {
  925.                      Coutput << " and issued "
  926.                              << num_warnings << " warning" << (num_warnings <= 1 ? "" : "s");
  927.                 }
  928.             }
  929.  
  930.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  931.             {
  932.                 Coutput << " compiling \""
  933.                         << lex_stream -> FileName()
  934.                         << '\"';
  935.             }
  936.             Coutput << ':';
  937.  
  938.             //
  939.             //
  940.             //
  941.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  942.             {
  943.                 lex_stream -> RereadInput();
  944.  
  945.                 if (! lex_stream -> InputBuffer())
  946.                 {
  947.                     char *file_name = lex_stream -> FileName();
  948.                     int length = lex_stream -> FileNameLength();
  949.                     wchar_t *name = new wchar_t[length + 1];
  950.                     for (int i = 0; i < length; i++)
  951.                         name[i] = file_name[i];
  952.                     name[length] = U_NULL;
  953.                     control.system_semantic -> ReportSemError(SemanticError::CANNOT_REOPEN_FILE,
  954.                                                               0,
  955.                                                               0,
  956.                                                               name);
  957.                     delete [] name;
  958.                 }
  959.             }
  960.  
  961.             if (lex_stream -> file_symbol -> semantic == control.system_semantic || lex_stream -> InputBuffer())
  962.             {
  963.                 SortMessages();
  964.                 for (int k = 0; k < error.Length(); k++)
  965.                 {
  966.                     if ((warning[error[k].msg_code] != 1) || (! control.option.nowarn))
  967.                     {                        
  968.                         reportError(k);
  969.                     }
  970.                 }
  971.                 lex_stream -> DestroyInput();
  972.             }
  973.         }
  974.         else
  975.         {
  976.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  977.             {
  978.                 if (! lex_stream -> ComputeColumns())
  979.                 {
  980.                     char *file_name = lex_stream -> FileName();
  981.                     int length = lex_stream -> FileNameLength();
  982.                     wchar_t *name = new wchar_t[length + 1];
  983.                     for (int i = 0; i < length; i++)
  984.                         name[i] = file_name[i];
  985.                     name[length] = U_NULL;
  986.                     control.system_semantic -> ReportSemError(SemanticError::CANNOT_COMPUTE_COLUMNS,
  987.                                                               0,
  988.                                                               0,
  989.                                                               name);
  990.                     delete [] name;
  991.                 }
  992.             }
  993.  
  994.             SortMessages();
  995.             for (int k = 0; k < error.Length(); k++)
  996.             {
  997.                 if ((warning[error[k].msg_code] != 1) || (! control.option.nowarn))
  998.                 {
  999.                     reportError(k);
  1000.                 }
  1001.             }
  1002.         }
  1003.     }
  1004.  
  1005.     Coutput.flush();
  1006.  
  1007.     return return_code;
  1008. }
  1009.  
  1010. void SemanticError::reportError(int k)
  1011. {
  1012.     error[k].Initialize(lex_stream,
  1013.                         (print_message[error[k].msg_code]) (error[k], lex_stream, control),
  1014.                         (warning[error[k].msg_code] == 1
  1015.                          ? ErrorInfo::JIKES_WARNING
  1016.                          : (warning[error[k].msg_code] == 2 && (! control.option.zero_defect)
  1017.                             ? ErrorInfo::JIKES_CAUTION
  1018.                             : ErrorInfo::JIKES_ERROR))
  1019.     );
  1020.  
  1021.     JikesAPI::getInstance()->reportError(&error[k]);
  1022. }
  1023.  
  1024.  
  1025. //
  1026. // These "print_" procedures are invoked to print specific
  1027. // error messages. The parameter err identifies the error to
  1028. // be processed.
  1029. //
  1030. wchar_t *SemanticError::PrintBAD_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1031. {
  1032.     ErrorString s;
  1033.     s << "chaos: Error code " << err.msg_code << " is not a valid error message code.";
  1034.     return s.Array();
  1035. }
  1036.  
  1037.  
  1038. wchar_t *SemanticError::PrintDEFAULT_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1039. {
  1040.     ErrorString s;
  1041.  
  1042.     if (err.insert1)
  1043.         s << err.insert1;
  1044.     if (err.insert2)
  1045.         s << err.insert2;
  1046.     if (err.insert3)
  1047.         s << err.insert3;
  1048.     if (err.insert4)
  1049.         s << err.insert4;
  1050.     if (err.insert5)
  1051.         s << err.insert5;
  1052.     if (err.insert6)
  1053.         s << err.insert6;
  1054.     if (err.insert7)
  1055.         s << err.insert7;
  1056.     if (err.insert8)
  1057.         s << err.insert8;
  1058.     if (err.insert9)
  1059.         s << err.insert9;
  1060.  
  1061.     return s.Array();
  1062. }
  1063.  
  1064.  
  1065. wchar_t *SemanticError::PrintINVALID_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1066. {
  1067.     ErrorString s;
  1068.  
  1069.     s << '\"'
  1070.             << err.insert1
  1071.             << "\" is an invalid option; "
  1072.             << StringConstant::U8S_command_format
  1073.             << '.';
  1074.  
  1075.     return s.Array();
  1076. }
  1077.  
  1078.  
  1079. wchar_t *SemanticError::PrintINVALID_K_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1080. {
  1081.     ErrorString s;
  1082.  
  1083.     s << "No argument specified for +K option. The proper form is \"+Kxxx=xxx\" (with no intervening space).";
  1084.  
  1085.     return s.Array();
  1086. }
  1087.  
  1088.  
  1089. wchar_t *SemanticError::PrintINVALID_K_TARGET(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1090. {
  1091.     ErrorString s;
  1092.     
  1093.     s << '\"'
  1094.             << err.insert1
  1095.             << "\" is not a valid target in a +K option. The target must be a numeric type or boolean.";
  1096.  
  1097.     return s.Array();
  1098. }
  1099.  
  1100.  
  1101. wchar_t *SemanticError::PrintINVALID_TAB_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1102. {
  1103.     ErrorString s;
  1104.  
  1105.     s << '\"'
  1106.             << err.insert1
  1107.             << "\" is not a valid tab size. An integer value is expected.";
  1108.  
  1109.     return s.Array();
  1110. }
  1111.  
  1112.  
  1113. wchar_t *SemanticError::PrintINVALID_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1114. {
  1115.     ErrorString s;
  1116.     
  1117.     s << "The directory specified in the \"-d\" option, \""
  1118.             << err.insert1
  1119.             << "\", is either invalid or it could not be expanded.";
  1120.  
  1121.     return s.Array();
  1122. }
  1123.  
  1124.  
  1125. wchar_t *SemanticError::PrintUNSUPPORTED_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1126. {
  1127.     ErrorString s;
  1128.     
  1129.     s << "This option \""
  1130.             << err.insert1
  1131.             << "\" is currently unsupported.";
  1132.  
  1133.     return s.Array();
  1134. }
  1135.  
  1136.  
  1137. wchar_t *SemanticError::PrintDISABLED_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1138. {
  1139.     ErrorString s;
  1140.     
  1141.     s << "This option \""
  1142.             << err.insert1
  1143.             << "\" has been temporarily disabled.";
  1144.  
  1145.     return s.Array();
  1146. }
  1147.  
  1148.  
  1149. wchar_t *SemanticError::PrintUNSUPPORTED_ENCODING(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1150. {
  1151.     ErrorString s;
  1152.     
  1153.     s << "Unsupported encoding: \""
  1154.             << err.insert1
  1155.             << "\".";
  1156.     
  1157.     return s.Array();
  1158. }              
  1159.  
  1160. wchar_t *SemanticError::PrintNO_CURRENT_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1161. {
  1162.     ErrorString s;
  1163.     
  1164.     s << "Could not open current directory.";
  1165.  
  1166.     return s.Array();
  1167. }
  1168.  
  1169.  
  1170. wchar_t *SemanticError::PrintCANNOT_OPEN_ZIP_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1171. {
  1172.     ErrorString s;
  1173.     
  1174.     s << "The file \""
  1175.             << err.insert1
  1176.             << "\" is not a valid zip file.";
  1177.  
  1178.     return s.Array();
  1179. }
  1180.  
  1181.  
  1182. wchar_t *SemanticError::PrintCANNOT_OPEN_PATH_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1183. {
  1184.     ErrorString s;
  1185.     
  1186.     s << "The file \""
  1187.             << err.insert1
  1188.             << "\" is not a valid directory.";
  1189.  
  1190.     return s.Array();
  1191. }
  1192.  
  1193. wchar_t *SemanticError::PrintPACKAGE_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1194. {
  1195.     ErrorString s;
  1196.  
  1197.     s << "Could not find package \""
  1198.       << err.insert1
  1199.       << "\" in:\n" ;
  1200.  
  1201.     for (int i = 1; i < control.classpath.Length(); i++)
  1202.     {
  1203.         PathSymbol *path_symbol = control.classpath[i];
  1204.         wchar_t *path = path_symbol -> Name();
  1205.         s << "                "
  1206.           << path
  1207.           << "\n";
  1208.     }
  1209.  
  1210.     return s.Array();
  1211. }
  1212.  
  1213.  
  1214. wchar_t *SemanticError::PrintCANNOT_OPEN_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1215. {
  1216.     ErrorString s;
  1217.     
  1218.     s << "Unable to open directory \""
  1219.             << err.insert1
  1220.             << "\".";
  1221.  
  1222.     return s.Array();
  1223. }
  1224.  
  1225.  
  1226. wchar_t *SemanticError::PrintBAD_INPUT_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1227. {
  1228.     ErrorString s;
  1229.     
  1230.     s << "The input file \""
  1231.             << err.insert1
  1232.             << "\" does not have the \".java\" extension.";
  1233.  
  1234.     return s.Array();
  1235. }
  1236.  
  1237.  
  1238. wchar_t *SemanticError::PrintUNREADABLE_INPUT_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1239. {
  1240.     ErrorString s;
  1241.     
  1242.     s << "The input file \""
  1243.             << err.insert1
  1244.             << "\" was not found.";
  1245.  
  1246.     return s.Array();
  1247. }
  1248.  
  1249.  
  1250. wchar_t *SemanticError::PrintNON_STANDARD_LIBRARY_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1251. {
  1252.     ErrorString s;
  1253.  
  1254.     s << "A non-standard version of the type \"";
  1255.     if (NotDot(err.insert1))
  1256.     {
  1257.         s << err.insert1
  1258.                 << "/";
  1259.     }
  1260.     s << err.insert2
  1261.             << "\" was found. Class files that depend on this type may not have been generated.";
  1262.  
  1263.     return s.Array();
  1264. }
  1265.  
  1266.  
  1267. wchar_t *SemanticError::PrintLIBRARY_METHOD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1268. {
  1269.     ErrorString s;
  1270.  
  1271.     s << "A class file was not generated for the type \"";
  1272.     if (NotDot(err.insert1))
  1273.     {
  1274.         s << err.insert1
  1275.                 << "/";
  1276.     }
  1277.     s << err.insert2
  1278.             << "\" because a library method that it depends on was not found. See system messages for more information.";
  1279.  
  1280.     return s.Array();
  1281. }
  1282.  
  1283.  
  1284. wchar_t *SemanticError::PrintCANNOT_REOPEN_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1285. {
  1286.     ErrorString s;
  1287.     
  1288.     s << "Unable to reopen file \""
  1289.             << err.insert1
  1290.             << "\".";
  1291.  
  1292.     return s.Array();
  1293. }
  1294.  
  1295.  
  1296. wchar_t *SemanticError::PrintCANNOT_WRITE_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1297. {
  1298.     ErrorString s;
  1299.     
  1300.     s << "Unable to write file \""
  1301.             << err.insert1
  1302.             << "\".";
  1303.  
  1304.     return s.Array();
  1305. }
  1306.  
  1307.  
  1308. wchar_t *SemanticError::PrintCONSTANT_POOL_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1309. {
  1310.     ErrorString s;
  1311.  
  1312.     s << "Processing of this type, \"";
  1313.     if (NotDot(err.insert1))
  1314.     {
  1315.         s << err.insert1
  1316.                 << "/";
  1317.     }
  1318.     s << err.insert2
  1319.        << "\", produced a constant pool that exceeded the limit of 65535 elements.";
  1320.  
  1321.     return s.Array();
  1322. }
  1323.  
  1324.  
  1325. wchar_t *SemanticError::PrintINTERFACES_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1326. {
  1327.     ErrorString s;
  1328.  
  1329.     s << "The type \"";
  1330.     if (NotDot(err.insert1))
  1331.     {
  1332.         s << err.insert1
  1333.                 << "/";
  1334.     }
  1335.     s << err.insert2
  1336.             << "\" implements more than 65535 interfaces.";
  1337.  
  1338.     return s.Array();
  1339. }
  1340.  
  1341.  
  1342. wchar_t *SemanticError::PrintMETHODS_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1343. {
  1344.     ErrorString s;
  1345.     
  1346.     s << "The type \"";
  1347.     if (NotDot(err.insert1))
  1348.     {
  1349.         s << err.insert1
  1350.                 << "/";
  1351.     }
  1352.     s << err.insert2
  1353.             << "\" contains more than 65535 methods.";
  1354.  
  1355.     return s.Array();
  1356. }
  1357.  
  1358.  
  1359. wchar_t *SemanticError::PrintSTRING_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1360. {
  1361.     ErrorString s;
  1362.  
  1363.     s << "The type \"";
  1364.     if (NotDot(err.insert1))
  1365.     {
  1366.         s << err.insert1
  1367.                 << "/";
  1368.     }
  1369.     s << err.insert2
  1370.             << "\" generated one or more strings whose length exceeds the maximum length of 65535 Utf8 chacracters.";
  1371.  
  1372.     return s.Array();
  1373. }
  1374.  
  1375.  
  1376. wchar_t *SemanticError::PrintPARAMETER_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1377. {
  1378.     ErrorString s;
  1379.  
  1380.     s << "Method \""
  1381.             << err.insert1
  1382.             << "\" in type \"";
  1383.     if (NotDot(err.insert2))
  1384.     {
  1385.         s << err.insert2
  1386.                 << "/";
  1387.     }
  1388.     s << err.insert3
  1389.             << "\" contains more than 255 formal parameters. Note that a parameter of type long or double counts as 2 parameters.";
  1390.  
  1391.     return s.Array();
  1392. }
  1393.  
  1394.  
  1395. wchar_t *SemanticError::PrintARRAY_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1396. {
  1397.     ErrorString s;
  1398.     
  1399.     s << "The number of dimensions in an array is limited to 255.";
  1400.  
  1401.     return s.Array();
  1402. }
  1403.  
  1404.  
  1405. wchar_t *SemanticError::PrintFIELDS_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1406. {
  1407.     ErrorString s;
  1408.  
  1409.     s << "The type \"";
  1410.     if (NotDot(err.insert1))
  1411.     {
  1412.         s << err.insert1
  1413.                 << "/";
  1414.     }
  1415.     s << err.insert2
  1416.             << "\" contains more than 65535 fields.";
  1417.  
  1418.     return s.Array();
  1419. }
  1420.  
  1421.  
  1422. wchar_t *SemanticError::PrintLOCAL_VARIABLES_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1423. {
  1424.     ErrorString s;
  1425.  
  1426.     s << "Method \""
  1427.             << err.insert1
  1428.             << "\" in type \"";
  1429.     if (NotDot(err.insert2))
  1430.     {
  1431.         s << err.insert2
  1432.                 << "/";
  1433.     }
  1434.     s << err.insert3
  1435.             << "\" contains more than 65535 local variables.";
  1436.  
  1437.     return s.Array();
  1438. }
  1439.  
  1440.  
  1441. wchar_t *SemanticError::PrintSTACK_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1442. {
  1443.     ErrorString s;
  1444.  
  1445.     s << "Processing of the method or constructor \""
  1446.             << err.insert1
  1447.             << "\" in type \"";
  1448.     if (NotDot(err.insert2))
  1449.     {
  1450.         s << err.insert2
  1451.                 << "/";
  1452.     }
  1453.     s << err.insert3
  1454.             << "\" requires a stack that exceeds the maximum limit of 65535.";
  1455.  
  1456.     return s.Array();
  1457. }
  1458.  
  1459.  
  1460. wchar_t *SemanticError::PrintCODE_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1461. {
  1462.     ErrorString s;
  1463.  
  1464.     s << "Processing of the method or constructor \""
  1465.             << err.insert1
  1466.             << "\" in type \"";
  1467.     if (NotDot(err.insert2))
  1468.     {
  1469.         s << err.insert2
  1470.                 << "/";
  1471.     }
  1472.     s << err.insert3
  1473.             << "\" produced a code attribute that exceeds the code limit of 65535 elements.";
  1474.  
  1475.     return s.Array();
  1476. }
  1477.  
  1478.  
  1479. wchar_t *SemanticError::PrintCANNOT_COMPUTE_COLUMNS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1480. {
  1481.     ErrorString s;
  1482.  
  1483.     s << "Unable to reopen file \""
  1484.             << err.insert1
  1485.             << "\". Therefore, column positions may be incorrect.";
  1486.  
  1487.     return s.Array();
  1488. }
  1489.  
  1490.  
  1491. wchar_t *SemanticError::PrintREDUNDANT_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1492. {
  1493.     ErrorString s;
  1494.     
  1495.     s << "The use of the \"abstract\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1496.  
  1497.     return s.Array();
  1498. }
  1499.  
  1500.  
  1501. wchar_t *SemanticError::PrintREDUNDANT_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1502. {
  1503.     ErrorString s;
  1504.     
  1505.     s << "The use of the \"final\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1506.  
  1507.     return s.Array();
  1508. }
  1509.  
  1510.  
  1511. wchar_t *SemanticError::PrintREDUNDANT_PUBLIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1512. {
  1513.     ErrorString s;
  1514.     
  1515.     s << "The use of the \"public\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1516.  
  1517.     return s.Array();
  1518. }
  1519.  
  1520.  
  1521. wchar_t *SemanticError::PrintREDUNDANT_STATIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1522. {
  1523.     ErrorString s;
  1524.     
  1525.     s << "The use of the \"static\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1526.  
  1527.     return s.Array();
  1528. }
  1529.  
  1530.  
  1531. wchar_t *SemanticError::PrintEMPTY_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1532. {
  1533.     ErrorString s;
  1534.     
  1535.     s << "An EmptyDeclaration is a deprecated feature that should not be used - \";\" ignored.";
  1536.  
  1537.     return s.Array();
  1538. }
  1539.  
  1540.  
  1541. wchar_t *SemanticError::PrintOBSOLESCENT_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1542. {
  1543.     ErrorString s;
  1544.     
  1545.     s << "Every interface in implicitly abstract. This modifier is obsolete and should not be used in new Java programs.";
  1546.  
  1547.     return s.Array();
  1548. }
  1549.  
  1550.  
  1551. wchar_t *SemanticError::PrintOBSOLESCENT_BRACKETS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1552. {
  1553.     ErrorString s;
  1554.     
  1555.     s << "The use of empty bracket pairs following a MethodDeclarator should not be used in new Java programs.";
  1556.  
  1557.     return s.Array();
  1558. }
  1559.  
  1560.  
  1561. wchar_t *SemanticError::PrintNO_TYPES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1562. {
  1563.     ErrorString s;
  1564.     
  1565.     s << "This compilation unit contains no type declaration.";
  1566.  
  1567.     return s.Array();
  1568. }
  1569.  
  1570.  
  1571. wchar_t *SemanticError::PrintTYPE_IN_MULTIPLE_FILES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1572. {
  1573.     ErrorString s;
  1574.  
  1575.     s << "The file \"";
  1576.     if (NotDot(err.insert1))
  1577.     {
  1578.         s << err.insert1
  1579.                 << "/";
  1580.     }
  1581.     s << err.insert2
  1582.             << ".java\" contains type \""
  1583.             << err.insert4
  1584.             << "\" which conflicts with file \"";
  1585.     if (NotDot(err.insert3))
  1586.     {
  1587.         s << err.insert3
  1588.                 << "/";
  1589.     }
  1590.     s << err.insert4
  1591.             << ".java\".";
  1592.  
  1593.     return s.Array();
  1594. }
  1595.  
  1596.  
  1597. wchar_t *SemanticError::PrintPACKAGE_TYPE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1598. {
  1599.     ErrorString s;
  1600.  
  1601.     s << "The type \"";
  1602.     if (NotDot(err.insert1))
  1603.     {
  1604.         s << err.insert1
  1605.                 << "/";
  1606.     }
  1607.     s << err.insert2
  1608.             << "\" contained in file \""
  1609.             << err.insert3
  1610.             << "\" conflicts with the package \"";
  1611.     if (NotDot(err.insert1))
  1612.     {
  1613.         s << err.insert1
  1614.                 << "/";
  1615.     }
  1616.     s << err.insert2
  1617.             << "\".";
  1618.  
  1619.     return s.Array();
  1620. }
  1621.  
  1622.  
  1623. wchar_t *SemanticError::PrintDIRECTORY_FILE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1624. {
  1625.     ErrorString s;
  1626.  
  1627.     s << "The type \""
  1628.             << err.insert1
  1629.             << "\" contained in file \"";
  1630.     if (NotDot(err.insert2))
  1631.     {
  1632.         s << err.insert2
  1633.                 << "/";
  1634.     }
  1635.     s << err.insert3
  1636.             << ".java\" conflicts with the directory \""
  1637.             << err.insert4
  1638.             << "\".";
  1639.  
  1640.     return s.Array();
  1641. }
  1642.  
  1643.  
  1644. wchar_t *SemanticError::PrintFILE_FILE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1645. {
  1646.     ErrorString s;
  1647.     
  1648.     s << "Cannot write class file \""
  1649.             << err.insert1
  1650.             << ".class\" because that name conflicts with the name of the class file \""
  1651.             << err.insert2
  1652.             << "\" in directory \""
  1653.             << err.insert3
  1654.             << "\". This is illegal because file names are case-insensitive in this system.";
  1655.  
  1656.     return s.Array();
  1657. }
  1658.  
  1659.  
  1660. wchar_t *SemanticError::PrintMULTIPLE_PUBLIC_TYPES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1661. {
  1662.     ErrorString s;
  1663.     
  1664.     s << "The type \""
  1665.             << err.insert1
  1666.             << "\" is declared public in compilation unit \""
  1667.             << lex_stream -> FileName()
  1668.             << "\" which also contains the public type, \""
  1669.             << err.insert2
  1670.             << "\".";
  1671.  
  1672.     return s.Array();
  1673. }
  1674.  
  1675.  
  1676. wchar_t *SemanticError::PrintMISMATCHED_TYPE_AND_FILE_NAMES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1677. {
  1678.     ErrorString s;
  1679.     
  1680.     s << "The public type \""
  1681.             << err.insert1
  1682.             << "\" does not match the name of its containing file \""
  1683.             << lex_stream -> FileName()
  1684.             << "\".";
  1685.  
  1686.     return s.Array();
  1687. }
  1688.  
  1689.  
  1690. wchar_t *SemanticError::PrintREFERENCE_TO_TYPE_IN_MISMATCHED_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1691. {
  1692.     ErrorString s;
  1693.     
  1694.     s << "The type \""
  1695.             << err.insert1
  1696.             << "\" is defined in the file \""
  1697.             << err.insert2
  1698.             << ".java\" but referenced in the file \""
  1699.             << lex_stream -> FileName()
  1700.             << "\". It is recommended that it be redefined in \""
  1701.             << err.insert1
  1702.             << ".java\".";
  1703.  
  1704.     return s.Array();
  1705. }
  1706.  
  1707.  
  1708. wchar_t *SemanticError::PrintDUPLICATE_INNER_TYPE_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1709. {
  1710.     ErrorString s;
  1711.     
  1712.     s << "The inner type named \""
  1713.             << err.insert1
  1714.             << "\" is nested in an outer class of the same name at location "
  1715.             << err.insert2
  1716.             << '.';
  1717.  
  1718.     return s.Array();
  1719. }
  1720.  
  1721.  
  1722. wchar_t *SemanticError::PrintDUPLICATE_TYPE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1723. {
  1724.     ErrorString s;
  1725.     
  1726.     s << "Duplicate declaration of type \""
  1727.             << err.insert1
  1728.             << "\". The other occurrence is at location "
  1729.             << err.insert2
  1730.             << '.';
  1731.  
  1732.     return s.Array();
  1733. }
  1734.  
  1735.  
  1736. wchar_t *SemanticError::PrintUNNECESSARY_TYPE_IMPORT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1737. {
  1738.     ErrorString s;
  1739.     
  1740.     s << "Unnecessary import of type \""
  1741.             << err.insert1
  1742.             << "\". The type is declared at location "
  1743.             << err.insert2
  1744.             << '.';
  1745.  
  1746.     return s.Array();
  1747. }
  1748.  
  1749.  
  1750. wchar_t *SemanticError::PrintUNINITIALIZED_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1751. {
  1752.     ErrorString s;
  1753.     
  1754.     s << "The field \""
  1755.             << err.insert1
  1756.             << "\" is not initialized.";
  1757.  
  1758.     return s.Array();
  1759. }
  1760.  
  1761.  
  1762. wchar_t *SemanticError::PrintDUPLICATE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1763. {
  1764.     ErrorString s;
  1765.     
  1766.     s << "Duplicate specification of this modifier.";
  1767.  
  1768.     return s.Array();
  1769. }
  1770.  
  1771.  
  1772. wchar_t *SemanticError::PrintDUPLICATE_ACCESS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1773. {
  1774.     ErrorString s;
  1775.     
  1776.     s << "Duplicate specification of an access modifier. "
  1777.             "Only one instance of \"public\", \"private\", or \"protected\" may appear in a declaration.";
  1778.  
  1779.     return s.Array();
  1780. }
  1781.  
  1782.  
  1783. wchar_t *SemanticError::PrintINVALID_TOP_LEVEL_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1784. {
  1785.     ErrorString s;
  1786.     
  1787.     s << err.insert1
  1788.             << " is not a valid modifier for a top-level class.";
  1789.  
  1790.     return s.Array();
  1791. }
  1792.  
  1793.  
  1794. wchar_t *SemanticError::PrintINVALID_INNER_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1795. {
  1796.     ErrorString s;
  1797.     
  1798.     s << err.insert1
  1799.             << " is not a valid modifier for an inner class.";
  1800.  
  1801.     return s.Array();
  1802. }
  1803.  
  1804.  
  1805. wchar_t *SemanticError::PrintINVALID_STATIC_INNER_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1806. {
  1807.     ErrorString s;
  1808.     
  1809.     s << err.insert1
  1810.             << " is not a valid modifier for an inner class that is enclosed in an interface.";
  1811.  
  1812.     return s.Array();
  1813. }
  1814.  
  1815.  
  1816. wchar_t *SemanticError::PrintINVALID_LOCAL_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1817. {
  1818.     ErrorString s;
  1819.     
  1820.     s << err.insert1
  1821.             << " is not a valid modifier for a local inner class.";
  1822.  
  1823.     return s.Array();
  1824. }
  1825.  
  1826.  
  1827. wchar_t *SemanticError::PrintFINAL_ABSTRACT_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1828. {
  1829.     ErrorString s;
  1830.     
  1831.     s << "A class may not be declared both \"final\" and \"abstract\".";
  1832.  
  1833.     return s.Array();
  1834. }
  1835.  
  1836.  
  1837. wchar_t *SemanticError::PrintINVALID_INTERFACE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1838. {
  1839.     ErrorString s;
  1840.     
  1841.     s << err.insert1
  1842.             << " is not a valid interface modifier.";
  1843.  
  1844.     return s.Array();
  1845. }
  1846.  
  1847.  
  1848. wchar_t *SemanticError::PrintVOLATILE_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1849. {
  1850.     ErrorString s;
  1851.     
  1852.     s << "A \"volatile\" field may not be declared \"final\".";
  1853.  
  1854.     return s.Array();
  1855. }
  1856.  
  1857.  
  1858. wchar_t *SemanticError::PrintFINAL_VOLATILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1859. {
  1860.     ErrorString s;
  1861.     
  1862.     s << "A \"final\" field may not be declared \"volatile\".";
  1863.  
  1864.     return s.Array();
  1865. }
  1866.  
  1867.  
  1868. wchar_t *SemanticError::PrintINVALID_FIELD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1869. {
  1870.     ErrorString s;
  1871.     
  1872.     s << err.insert1
  1873.             << " is not a valid field modifier.";
  1874.  
  1875.     return s.Array();
  1876. }
  1877.  
  1878.  
  1879. wchar_t *SemanticError::PrintINVALID_LOCAL_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1880. {
  1881.     ErrorString s;
  1882.     
  1883.     s << err.insert1
  1884.             << " is not a valid local variable or parameter modifier.";
  1885.  
  1886.     return s.Array();
  1887. }
  1888.  
  1889.  
  1890. wchar_t *SemanticError::PrintINVALID_METHOD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1891. {
  1892.     ErrorString s;
  1893.     
  1894.     s << err.insert1
  1895.             << " is not a valid method modifier.";
  1896.  
  1897.     return s.Array();
  1898. }
  1899.  
  1900.  
  1901. wchar_t *SemanticError::PrintINVALID_SIGNATURE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1902. {
  1903.     ErrorString s;
  1904.     
  1905.     s << err.insert1
  1906.             << " is not a valid signature modifier.";
  1907.  
  1908.     return s.Array();
  1909. }
  1910.  
  1911.  
  1912. wchar_t *SemanticError::PrintINVALID_CONSTRUCTOR_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1913. {
  1914.     ErrorString s;
  1915.     
  1916.     s << err.insert1
  1917.             << " is not a valid constructor modifier.";
  1918.  
  1919.     return s.Array();
  1920. }
  1921.  
  1922.  
  1923. wchar_t *SemanticError::PrintINVALID_CONSTANT_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1924. {
  1925.     ErrorString s;
  1926.     
  1927.     s << err.insert1
  1928.             << " is not a valid constant modifier.";
  1929.  
  1930.     return s.Array();
  1931. }
  1932.  
  1933.  
  1934. wchar_t *SemanticError::PrintPARENT_TYPE_IN_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1935. {
  1936.     ErrorString s;
  1937.  
  1938.     s << "The type associated with this construct is (or depends on) the type ";
  1939.     if (NotDot(err.insert1))
  1940.     {
  1941.         s << err.insert1
  1942.                 << "/";
  1943.     }
  1944.     s << err.insert2
  1945.             << " which is contained in an unnamed package.";
  1946.  
  1947.     return s.Array();
  1948. }
  1949.  
  1950.  
  1951. wchar_t *SemanticError::PrintRECOMPILATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1952. {
  1953.     ErrorString s;
  1954.  
  1955.     s << "The type associated with this construct depends on file ";
  1956.     if (NotDot(err.insert1))
  1957.     {
  1958.         s << err.insert1
  1959.                 << "/";
  1960.     }
  1961.     s << err.insert2
  1962.             << ".class which, in turn, depends on file ";
  1963.     if (NotDot(err.insert3))
  1964.     {
  1965.         s << err.insert3
  1966.                 << "/";
  1967.     }
  1968.     s << err.insert4
  1969.             << ".java. All files that depend on this source file, in particular, ";
  1970.     if (NotDot(err.insert1))
  1971.     {
  1972.         s << err.insert1
  1973.                 << "/";
  1974.     }
  1975.     s << err.insert2
  1976.             << ".java should be recompiled.";
  1977.  
  1978.     return s.Array();
  1979. }
  1980.  
  1981.  
  1982. wchar_t *SemanticError::PrintTYPE_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1983. {
  1984.     ErrorString s;
  1985.  
  1986.     s << "Type ";
  1987.     if (NotDot(err.insert1))
  1988.     {
  1989.         s << err.insert1
  1990.                 << "/";
  1991.     }
  1992.     s << err.insert2
  1993.             << " was not found.";
  1994.  
  1995.     return s.Array();
  1996. }
  1997.  
  1998.  
  1999. wchar_t *SemanticError::PrintDUPLICATE_ON_DEMAND_IMPORT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2000. {
  2001.     ErrorString s;
  2002.  
  2003.     s << "Type "
  2004.             << err.insert1
  2005.             << " is imported on demand from package "
  2006.             << err.insert2
  2007.             << " and package "
  2008.             << err.insert3
  2009.             << '.';
  2010.  
  2011.     return s.Array();
  2012. }
  2013.  
  2014.  
  2015. wchar_t *SemanticError::PrintNOT_A_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2016. {
  2017.     ErrorString s;
  2018.     
  2019.     s << "A type is expected here.";
  2020.  
  2021.     return s.Array();
  2022. }
  2023.  
  2024.  
  2025. wchar_t *SemanticError::PrintNOT_A_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2026. {
  2027.     ErrorString s;
  2028.  
  2029.     s << "Interface \"";
  2030.     if (NotDot(err.insert1))
  2031.     {
  2032.         s << err.insert1
  2033.                 << '/';
  2034.     }
  2035.     s << err.insert2
  2036.             << "\" cannot be used where a class is expected.";
  2037.  
  2038.     return s.Array();
  2039. }
  2040.  
  2041.  
  2042. wchar_t *SemanticError::PrintNOT_AN_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2043. {
  2044.     ErrorString s;
  2045.  
  2046.     s << "Class ";
  2047.     if (NotDot(err.insert1))
  2048.     {
  2049.         s << err.insert1
  2050.                 << '/';
  2051.     }
  2052.     s << err.insert2
  2053.             << " cannot be used where an interface is expected.";
  2054.  
  2055.     return s.Array();
  2056. }
  2057.  
  2058.  
  2059. wchar_t *SemanticError::PrintSUPER_IS_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2060. {
  2061.     ErrorString s;
  2062.  
  2063.     s << "The super class \"";
  2064.     if (NotDot(err.insert1))
  2065.     {
  2066.         s << err.insert1
  2067.                 << '/';
  2068.     }
  2069.     s << err.insert2
  2070.             << "\" is final. A final class must not have subclasses.";
  2071.  
  2072.     return s.Array();
  2073. }
  2074.  
  2075.  
  2076. wchar_t *SemanticError::PrintOBJECT_WITH_SUPER_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2077. {
  2078.     ErrorString s;
  2079.     
  2080.     s << "The type "
  2081.             << err.insert1
  2082.             << '/'
  2083.             << err.insert2
  2084.             << " must not have a super type.";
  2085.  
  2086.     return s.Array();
  2087. }
  2088.  
  2089.  
  2090. wchar_t *SemanticError::PrintOBJECT_HAS_NO_SUPER_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2091. {
  2092.     ErrorString s;
  2093.     
  2094.     s << "The type "
  2095.             << err.insert1
  2096.             << '/'
  2097.             << err.insert2
  2098.             << " does not have a super type.";
  2099.  
  2100.     return s.Array();
  2101. }
  2102.  
  2103.  
  2104. wchar_t *SemanticError::PrintDUPLICATE_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2105. {
  2106.     ErrorString s;
  2107.     
  2108.     s << "Duplicate declaration of field \""
  2109.             << err.insert1
  2110.             << "\" in type \""
  2111.             << err.insert2
  2112.             << "\".";
  2113.  
  2114.     return s.Array();
  2115. }
  2116.  
  2117.  
  2118. wchar_t *SemanticError::PrintDUPLICATE_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2119. {
  2120.     ErrorString s;
  2121.     
  2122.     s << "Duplicate declaration of method \""
  2123.             << err.insert1
  2124.             << "\" in type \""
  2125.             << err.insert2
  2126.             << "\".";
  2127.  
  2128.     return s.Array();
  2129. }
  2130.  
  2131.  
  2132. wchar_t *SemanticError::PrintMISMATCHED_INHERITED_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2133. {
  2134.     ErrorString s;
  2135.  
  2136.     s << "The return type of method \""
  2137.             << err.insert1
  2138.             << "\" does not match the return type of method \""
  2139.             << err.insert2
  2140.             << "\" inherited from type \"";
  2141.     if (NotDot(err.insert3))
  2142.     {
  2143.         s << err.insert3
  2144.                 << "/";
  2145.     }
  2146.     s << err.insert4
  2147.             << "\".";
  2148.  
  2149.     return s.Array();
  2150. }
  2151.  
  2152.  
  2153. wchar_t *SemanticError::PrintMISMATCHED_INHERITED_METHOD_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2154. {
  2155.     ErrorString s;
  2156.  
  2157.     s << "In class \""
  2158.             << err.insert1
  2159.             << "\", the method \""
  2160.             << err.insert2
  2161.             << "\", inherited from type \"";
  2162.     if (NotDot(err.insert3))
  2163.     {
  2164.         s << err.insert3
  2165.                 << "/";
  2166.     }
  2167.     s << err.insert4
  2168.             << "\", does not have the same return type as the overridden method \""
  2169.             << err.insert5
  2170.             << "\", inherited from type \"";
  2171.     if (NotDot(err.insert6))
  2172.     {
  2173.         s << err.insert6
  2174.                 << "/";
  2175.     }
  2176.     s << err.insert7
  2177.             << "\".";
  2178.  
  2179.     return s.Array();
  2180. }
  2181.  
  2182. wchar_t *SemanticError::PrintMISMATCHED_INHERITED_METHODS_IN_BASE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2183. {
  2184.     ErrorString s;
  2185.     
  2186.     s << "In class \""
  2187.             << err.insert1
  2188.             << "\", the method \""
  2189.             << err.insert2
  2190.             << "\", inherited from type \"";
  2191.     if (NotDot(err.insert3))
  2192.     {
  2193.         s << err.insert3
  2194.                 << "/";
  2195.     }
  2196.     s << err.insert4
  2197.             << "\", does not have the same return type as the method \""
  2198.             << err.insert5
  2199.             << "\", inherited from type \"";
  2200.     if (NotDot(err.insert6))
  2201.     {
  2202.         s << err.insert6
  2203.                 << "/";
  2204.     }
  2205.     s << err.insert7
  2206.             << "\".";
  2207.  
  2208.     return s.Array();
  2209. }
  2210.  
  2211. wchar_t *SemanticError::PrintDUPLICATE_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2212. {
  2213.     ErrorString s;
  2214.     
  2215.     s << "Duplicate declaration of this constructor in type \""
  2216.             << err.insert1
  2217.             << "\".";
  2218.  
  2219.     return s.Array();
  2220. }
  2221.  
  2222.  
  2223. wchar_t *SemanticError::PrintMISMATCHED_CONSTRUCTOR_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2224. {
  2225.     ErrorString s;
  2226.     
  2227.     s << "The name of the constructor \""
  2228.             << err.insert1
  2229.             << "\" does not match the name of the class \""
  2230.             << err.insert2
  2231.             << "\".";
  2232.  
  2233.     return s.Array();
  2234. }
  2235.  
  2236.  
  2237. wchar_t *SemanticError::PrintMETHOD_WITH_CONSTRUCTOR_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2238. {
  2239.     ErrorString s;
  2240.     
  2241.     s << "The name of this method \""
  2242.             << err.insert1
  2243.             << "\" matches the name of the containing class. "
  2244.                "However, the method is not a constructor since its declarator is qualified with a type.";
  2245.  
  2246.     return s.Array();
  2247. }
  2248.  
  2249.  
  2250. wchar_t *SemanticError::PrintDUPLICATE_FORMAL_PARAMETER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2251. {
  2252.     ErrorString s;
  2253.     
  2254.     s << "Duplicate declaration of formal parameter "
  2255.             << err.insert1
  2256.             << '.';
  2257.  
  2258.     return s.Array();
  2259. }
  2260.  
  2261.  
  2262. wchar_t *SemanticError::PrintDUPLICATE_LOCAL_VARIABLE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2263. {
  2264.     ErrorString s;
  2265.     
  2266.     s << "Duplicate declaration of local variable \""
  2267.             << err.insert1
  2268.             << "\".";
  2269.  
  2270.     return s.Array();
  2271. }
  2272.  
  2273.  
  2274. wchar_t *SemanticError::PrintDUPLICATE_LOCAL_TYPE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2275. {
  2276.     ErrorString s;
  2277.     
  2278.     s << "Duplicate declaration of local class \""
  2279.             << err.insert1
  2280.             << "\". The other occurrence is at location "
  2281.             << err.insert2
  2282.             << '.';
  2283.  
  2284.     return s.Array();
  2285. }
  2286.  
  2287.  
  2288. wchar_t *SemanticError::PrintMULTIPLE_DEFAULT_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2289. {
  2290.     ErrorString s;
  2291.     
  2292.     s << "Multiple specification of default label in switch statement.";
  2293.  
  2294.     return s.Array();
  2295. }
  2296.  
  2297.  
  2298. wchar_t *SemanticError::PrintUNDECLARED_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2299. {
  2300.     ErrorString s;
  2301.     
  2302.     s << err.insert1
  2303.             << " is an undeclared label.";
  2304.  
  2305.     return s.Array();
  2306. }
  2307.  
  2308.  
  2309. wchar_t *SemanticError::PrintDUPLICATE_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2310. {
  2311.     ErrorString s;
  2312.     
  2313.     s << "Duplicate declaration of label \""
  2314.             << err.insert1
  2315.             << "\".";
  2316.  
  2317.     return s.Array();
  2318. }
  2319.  
  2320.  
  2321. wchar_t *SemanticError::PrintTYPE_NOT_THROWABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2322. {
  2323.     ErrorString s;
  2324.  
  2325.     s << "The type \"";
  2326.     if (NotDot(err.insert1))
  2327.     {
  2328.         s << err.insert1
  2329.                 << "/";
  2330.     }
  2331.     s << err.insert2
  2332.             << "\" is not a subclass of \"Throwable\".";
  2333.  
  2334.     return s.Array();
  2335. }
  2336.  
  2337.  
  2338. wchar_t *SemanticError::PrintCATCH_PRIMITIVE_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2339. {
  2340.     ErrorString s;
  2341.     
  2342.     s << "A primitive type cannot be used to declare a catch clause parameter - the type Error is assumed.";
  2343.  
  2344.     return s.Array();
  2345. }
  2346.  
  2347.  
  2348. wchar_t *SemanticError::PrintCATCH_ARRAY_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2349. {
  2350.     ErrorString s;
  2351.     
  2352.     s << "A array type cannot be used to declare a catch clause parameter - the type Error is assumed.";
  2353.  
  2354.     return s.Array();
  2355. }
  2356.  
  2357.  
  2358. wchar_t *SemanticError::PrintAMBIGUOUS_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2359. {
  2360.     ErrorString s;
  2361.  
  2362.     s << "The field name \""
  2363.             << err.insert1
  2364.             << "\" is an ambiguous name found in the types \"";
  2365.     if (NotDot(err.insert2))
  2366.     {
  2367.         s << err.insert2
  2368.                 << "/";
  2369.     }
  2370.     s << err.insert3
  2371.             << "\" and \"";
  2372.     if (NotDot(err.insert4))
  2373.     {
  2374.         s << err.insert4
  2375.                 << "/";
  2376.     }
  2377.     s << err.insert5
  2378.             << "\".";
  2379.  
  2380.     return s.Array();
  2381. }
  2382.  
  2383.  
  2384. wchar_t *SemanticError::PrintAMBIGUOUS_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2385. {
  2386.     ErrorString s;
  2387.  
  2388.     s << "The the nested type name \""
  2389.             << err.insert1
  2390.             << "\" is an ambiguous name found in the types \"";
  2391.     if (NotDot(err.insert2))
  2392.     {
  2393.         s << err.insert2
  2394.                 << "/";
  2395.     }
  2396.     s << err.insert3
  2397.             << "\" and \"";
  2398.     if (NotDot(err.insert4))
  2399.     {
  2400.         s << err.insert4
  2401.                 << "/";
  2402.     }
  2403.     s << err.insert5
  2404.             << "\".";
  2405.  
  2406.     return s.Array();
  2407. }
  2408.  
  2409.  
  2410. wchar_t *SemanticError::PrintFIELD_IS_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2411. {
  2412.     ErrorString s;
  2413.     
  2414.     s << "The name \""
  2415.             << err.insert1
  2416.             << "\" cannot be dereferenced as it represents a type.";
  2417.  
  2418.     return s.Array();
  2419. }
  2420.  
  2421.  
  2422. wchar_t *SemanticError::PrintFIELD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2423. {
  2424.     ErrorString s;
  2425.  
  2426.     s << "No field named \""
  2427.             << err.insert1
  2428.             << "\" was found in type \"";
  2429.     if (NotDot(err.insert2))
  2430.     {
  2431.         s << err.insert2
  2432.                 << "/";
  2433.     }
  2434.     s << err.insert3
  2435.             << "\".";
  2436.  
  2437.     return s.Array();
  2438. }
  2439.  
  2440.  
  2441. wchar_t *SemanticError::PrintFIELD_NAME_MISSPELLED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2442. {
  2443.     ErrorString s;
  2444.  
  2445.     s << "No field named \""
  2446.             << err.insert1
  2447.             << "\" was found in type \"";
  2448.     if (NotDot(err.insert2))
  2449.     {
  2450.         s << err.insert2
  2451.                 << "/";
  2452.     }
  2453.     s << err.insert3
  2454.             << "\". However, there is an accessible field \""
  2455.             << err.insert4
  2456.             << "\" whose name closely matches the name \""
  2457.             << err.insert1
  2458.             << "\".";
  2459.  
  2460.     return s.Array();
  2461. }
  2462.  
  2463.  
  2464. wchar_t *SemanticError::PrintFIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2465. {
  2466.     ErrorString s;
  2467.  
  2468.     s << "The field \""
  2469.             << err.insert1
  2470.             << "\" contained in class \"";
  2471.     if (NotDot(err.insert2))
  2472.     {
  2473.         s << err.insert2
  2474.                 << "/";
  2475.     }
  2476.     s << err.insert3
  2477.             << "\" has private access. Therefore, it is not accessible in class \"";
  2478.     if (NotDot(err.insert4))
  2479.     {
  2480.         s << err.insert4
  2481.                 << "/";
  2482.     }
  2483.     s << err.insert5
  2484.             << "\".";
  2485.  
  2486.     return s.Array();
  2487. }
  2488.  
  2489.  
  2490. wchar_t *SemanticError::PrintFIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2491. {
  2492.     ErrorString s;
  2493.  
  2494.     s << "The field \""
  2495.             << err.insert1
  2496.             << "\" contained in class \"";
  2497.     if (NotDot(err.insert2))
  2498.     {
  2499.         s << err.insert2
  2500.                 << "/";
  2501.     }
  2502.     s << err.insert3
  2503.             << "\" has default access. Therefore, it is not accessible in class \"";
  2504.     if (NotDot(err.insert4))
  2505.     {
  2506.         s << err.insert4
  2507.                 << "/";
  2508.     }
  2509.     s << err.insert5
  2510.             << "\" which is in a different package.";
  2511.  
  2512.     return s.Array();
  2513. }
  2514.  
  2515.  
  2516. wchar_t *SemanticError::PrintNAME_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2517. {
  2518.     ErrorString s;
  2519.     
  2520.     s << "No entity named \""
  2521.             << err.insert1
  2522.             << "\" was found in this environment.";
  2523.  
  2524.     return s.Array();
  2525. }
  2526.  
  2527.  
  2528. wchar_t *SemanticError::PrintNAME_NOT_YET_AVAILABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2529. {
  2530.     ErrorString s;
  2531.     
  2532.     s << "Illegal use of name \""
  2533.             << err.insert1
  2534.             << "\" which has not yet been fully declared at this point.";
  2535.  
  2536.     return s.Array();
  2537. }
  2538.  
  2539.  
  2540. wchar_t *SemanticError::PrintNAME_NOT_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2541. {
  2542.     ErrorString s;
  2543.     
  2544.     s << "The name \""
  2545.             << err.insert1
  2546.             << "\" does not denote a valid variable. If \""
  2547.             << err.insert1
  2548.             << "\" is a method that takes no argument, it must be followed by \"()\".";
  2549.  
  2550.     return s.Array();
  2551. }
  2552.  
  2553.  
  2554. wchar_t *SemanticError::PrintMETHOD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2555. {
  2556.     ErrorString s;
  2557.     
  2558.     s << "No match was found for method \""
  2559.             << err.insert1
  2560.             << "\".";
  2561.  
  2562.     return s.Array();
  2563. }
  2564.  
  2565.  
  2566. wchar_t *SemanticError::PrintMETHOD_NAME_NOT_FOUND_IN_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2567. {
  2568.     ErrorString s;
  2569.  
  2570.     s << "No method named \""
  2571.             << err.insert1
  2572.             << "\" was found in type \"";
  2573.     if (NotDot(err.insert2))
  2574.     {
  2575.         s << err.insert2
  2576.                 << "/";
  2577.     }
  2578.     s << err.insert3
  2579.             << "\".";
  2580.  
  2581.     return s.Array();
  2582. }
  2583.  
  2584.  
  2585. wchar_t *SemanticError::PrintMETHOD_NAME_MISSPELLED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2586. {
  2587.     ErrorString s;
  2588.  
  2589.     s << "No method named \""
  2590.             << err.insert1
  2591.             << "\" was found in type \"";
  2592.     if (NotDot(err.insert2))
  2593.     {
  2594.         s << err.insert2
  2595.                 << "/";
  2596.     }
  2597.     s << err.insert3
  2598.             << "\". However, there is an accessible method \""
  2599.             << err.insert4
  2600.             << "\" whose name closely matches the name \""
  2601.             << err.insert1
  2602.             << "\".";
  2603.  
  2604.     return s.Array();
  2605. }
  2606.  
  2607.  
  2608. wchar_t *SemanticError::PrintMETHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2609. {
  2610.     ErrorString s;
  2611.  
  2612.     s << "Method \""
  2613.             << err.insert1
  2614.             << "\" in class \"";
  2615.     if (NotDot(err.insert2))
  2616.     {
  2617.         s << err.insert2
  2618.                 << "/";
  2619.     }
  2620.     s << err.insert3
  2621.             << "\" has private access. Therefore, it is not accessible in class \"";
  2622.     if (NotDot(err.insert4))
  2623.     {
  2624.         s << err.insert4
  2625.                 << "/";
  2626.     }
  2627.     s << err.insert5
  2628.             << "\".";
  2629.  
  2630.     return s.Array();
  2631. }
  2632.  
  2633.  
  2634. wchar_t *SemanticError::PrintMETHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2635. {
  2636.     ErrorString s;
  2637.  
  2638.     s << "Method \""
  2639.             << err.insert1
  2640.             << "\" in class \"";
  2641.     if (NotDot(err.insert2))
  2642.     {
  2643.         s << err.insert2
  2644.                 << "/";
  2645.     }
  2646.     s << err.insert3
  2647.             << "\" has protected or default access. Therefore, it is not accessible in class \"";
  2648.     if (NotDot(err.insert4))
  2649.     {
  2650.         s << err.insert4
  2651.                 << "/";
  2652.     }
  2653.     s << err.insert5
  2654.             << "\" which is in a different package.";
  2655.  
  2656.     return s.Array();
  2657. }
  2658.  
  2659.  
  2660. wchar_t *SemanticError::PrintHIDDEN_METHOD_IN_ENCLOSING_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2661. {
  2662.     ErrorString s;
  2663.  
  2664.     s << "The method \""
  2665.             << err.insert1
  2666.             << "\" contained in the enclosing type \"";
  2667.     if (NotDot(err.insert2))
  2668.     {
  2669.         s << err.insert2
  2670.                 << "/";
  2671.     }
  2672.     s << err.insert3
  2673.             << "\" is a perfect match for this method call."
  2674.                " However, it is not visible in this nested class because a"
  2675.                " method with the same name in an intervening class is hiding it.";
  2676.  
  2677.     return s.Array();
  2678. }
  2679.  
  2680.  
  2681. wchar_t *SemanticError::PrintFIELD_NOT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2682. {
  2683.     ErrorString s;
  2684.  
  2685.     s << "The name \""
  2686.             << err.insert1
  2687.             << "\" is not a method name but the name of a field member of the type \"";
  2688.     if (NotDot(err.insert2))
  2689.     {
  2690.         s << err.insert2
  2691.                 << "/";
  2692.     }
  2693.     s << err.insert3
  2694.             << "\".";
  2695.  
  2696.     return s.Array();
  2697. }
  2698.  
  2699.  
  2700. wchar_t *SemanticError::PrintTYPE_NOT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2701. {
  2702.     ErrorString s;
  2703.  
  2704.     s << "The keyword \"new\" is expected before this name, \""
  2705.             << err.insert1
  2706.             << "\", as it is not the name of a method but the name of a type.";
  2707.  
  2708.     return s.Array();
  2709. }
  2710.  
  2711.  
  2712. wchar_t *SemanticError::PrintTYPE_NOT_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2713. {
  2714.     ErrorString s;
  2715.  
  2716.     s << "A type \""
  2717.             << err.insert1
  2718.             << "\" was found where a field name or method call was expected. Did you mean to write \""
  2719.             << err.insert1
  2720.             << ".xxx\", or \"new "
  2721.             << err.insert1
  2722.             << "()\", or ... ?";
  2723.  
  2724.     return s.Array();
  2725. }
  2726.  
  2727.  
  2728. wchar_t *SemanticError::PrintMETHOD_NOT_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2729. {
  2730.     ErrorString s;
  2731.  
  2732.     s << "The name \""
  2733.             << err.insert1
  2734.             << "\" is not a field name but the name of a method declared in the type \"";
  2735.     if (NotDot(err.insert2))
  2736.     {
  2737.         s << err.insert2
  2738.                 << "/";
  2739.     }
  2740.     s << err.insert3
  2741.             << "\".";
  2742.  
  2743.     return s.Array();
  2744. }
  2745.  
  2746.  
  2747. wchar_t *SemanticError::PrintAMBIGUOUS_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2748. {
  2749.     ErrorString s;
  2750.  
  2751.     s << "Ambiguous invocation of constructor \""
  2752.             << err.insert1
  2753.             << "\".";
  2754.  
  2755.     return s.Array();
  2756. }
  2757.  
  2758.  
  2759. wchar_t *SemanticError::PrintAMBIGUOUS_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2760. {
  2761.     ErrorString s;
  2762.  
  2763.     s << "Ambiguous invocation of method \""
  2764.             << err.insert1
  2765.             << "\". At least two methods are accessible from here: Method \""
  2766.             << err.insert2
  2767.             << "\" declared in type \"";
  2768.     if (NotDot(err.insert3))
  2769.     {
  2770.         s << err.insert3
  2771.                 << '/';
  2772.     }
  2773.     s << err.insert4
  2774.             << "\" and method \""
  2775.             << err.insert5
  2776.             << "\" declared in type \"";
  2777.     if (NotDot(err.insert6))
  2778.     {
  2779.         s << err.insert6
  2780.                 << '/';
  2781.     }
  2782.     s << err.insert7
  2783.             << "\".";
  2784.  
  2785.     return s.Array();
  2786. }
  2787.  
  2788.  
  2789. wchar_t *SemanticError::PrintNAME_NOT_CLASS_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2790. {
  2791.     ErrorString s;
  2792.     
  2793.     s << "The name \""
  2794.             << err.insert1
  2795.             << "\" does not denote a class (static) variable.";
  2796.  
  2797.     return s.Array();
  2798. }
  2799.  
  2800.  
  2801. wchar_t *SemanticError::PrintNOT_A_NUMERIC_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2802. {
  2803.     ErrorString s;
  2804.     
  2805.     s << "Only a variable of numeric type can appear in this context.";
  2806.  
  2807.     return s.Array();
  2808. }
  2809.  
  2810.  
  2811. wchar_t *SemanticError::PrintMETHOD_NOT_CLASS_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2812. {
  2813.     ErrorString s;
  2814.     
  2815.     s << "The method \""
  2816.             << err.insert1
  2817.             << "\" does not denote a class method.";
  2818.  
  2819.     return s.Array();
  2820. }
  2821.  
  2822.  
  2823. wchar_t *SemanticError::PrintABSTRACT_TYPE_CREATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2824. {
  2825.     ErrorString s;
  2826.     
  2827.     s << "Attempt to instantiate an abstract class \""
  2828.             << err.insert1
  2829.             << "\".";
  2830.  
  2831.     return s.Array();
  2832. }
  2833.  
  2834.  
  2835. wchar_t *SemanticError::PrintCONSTRUCTOR_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2836. {
  2837.     ErrorString s;
  2838.     
  2839.     s << "No match was found for constructor \""
  2840.             << err.insert1
  2841.             << "\".";
  2842.  
  2843.     return s.Array();
  2844. }
  2845.  
  2846.  
  2847. wchar_t *SemanticError::PrintMETHOD_FOUND_FOR_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2848. {
  2849.     ErrorString s;
  2850.     
  2851.     s << "No match was found for constructor \""
  2852.             << err.insert1
  2853.             << "\". However, a method with the same name was found at location "
  2854.             << err.insert2
  2855.             << '.';
  2856.  
  2857.     return s.Array();
  2858. }
  2859.  
  2860.  
  2861. wchar_t *SemanticError::PrintINCOMPATIBLE_TYPE_FOR_INITIALIZATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2862. {
  2863.     ErrorString s;
  2864.  
  2865.     s << "The type of the left-hand side (or array type) in this initialization (or array creation expression), \"";
  2866.     if (NotDot(err.insert1))
  2867.     {
  2868.         s << err.insert1
  2869.                 << '/';
  2870.     }
  2871.     s << err.insert2
  2872.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2873.     if (NotDot(err.insert3))
  2874.     {
  2875.         s << err.insert3
  2876.                 << '/';
  2877.     }
  2878.     s << err.insert4
  2879.             << "\".";
  2880.  
  2881.     return s.Array();
  2882. }
  2883.  
  2884.  
  2885. wchar_t *SemanticError::PrintINCOMPATIBLE_TYPE_FOR_ASSIGNMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2886. {
  2887.     ErrorString s;
  2888.  
  2889.     s << "The type of the left-hand side in this assignment, \"";
  2890.     if (NotDot(err.insert1))
  2891.     {
  2892.         s << err.insert1
  2893.                 << '/';
  2894.     }
  2895.     s << err.insert2
  2896.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2897.     if (NotDot(err.insert3))
  2898.     {
  2899.         s << err.insert3
  2900.                 << '/';
  2901.     }
  2902.     s << err.insert4
  2903.             << "\".";
  2904.  
  2905.     return s.Array();
  2906. }
  2907.  
  2908.  
  2909. wchar_t *SemanticError::PrintINCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2910. {
  2911.     ErrorString s;
  2912.  
  2913.     s << "In this conditional expression, the type of the false subexpression, \"";
  2914.     if (NotDot(err.insert1))
  2915.     {
  2916.         s << err.insert1
  2917.                 << '/';
  2918.     }
  2919.     s << err.insert2
  2920.             << "\", is not compatible with the type of the true subexpression, \"";
  2921.     if (NotDot(err.insert3))
  2922.     {
  2923.         s << err.insert3
  2924.                 << '/';
  2925.     }
  2926.     s << err.insert4
  2927.             << "\".";
  2928.  
  2929.     return s.Array();
  2930. }
  2931.  
  2932.  
  2933. wchar_t *SemanticError::PrintVOID_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2934. {
  2935.     ErrorString s;
  2936.     
  2937.     s << "Arrays of type \"void\" are not legal.";
  2938.  
  2939.     return s.Array();
  2940. }
  2941.  
  2942.  
  2943. wchar_t *SemanticError::PrintVOID_TYPE_IN_EQUALITY_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2944. {
  2945.     ErrorString s;
  2946.     
  2947.     s << "Subexpressions of type \"void\" may not appear in an EqualityExpression.";
  2948.  
  2949.     return s.Array();
  2950. }
  2951.  
  2952.  
  2953. wchar_t *SemanticError::PrintINCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2954. {
  2955.     ErrorString s;
  2956.  
  2957.     s << "The type of the left-hand side expression, \"";
  2958.     if (NotDot(err.insert1))
  2959.     {
  2960.         s << err.insert1
  2961.                 << '/';
  2962.     }
  2963.     s << err.insert2
  2964.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2965.     if (NotDot(err.insert3))
  2966.     {
  2967.         s << err.insert3
  2968.                 << '/';
  2969.     }
  2970.     s << err.insert4
  2971.             << "\" (and vice-versa).";
  2972.  
  2973.     return s.Array();
  2974. }
  2975.  
  2976.  
  2977. wchar_t *SemanticError::PrintINVALID_INSTANCEOF_CONVERSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2978. {
  2979.     ErrorString s;
  2980.  
  2981.     s << "The type of the left-side expression, \"";
  2982.     if (NotDot(err.insert1))
  2983.     {
  2984.         s << err.insert1
  2985.                 << '/';
  2986.     }
  2987.     s << err.insert2
  2988.             << "\", cannot possibly be an instance of type \"";
  2989.     if (NotDot(err.insert3))
  2990.     {
  2991.         s << err.insert3
  2992.                 << '/';
  2993.     }
  2994.     s << err.insert4
  2995.             << "\".";
  2996.  
  2997.     return s.Array();
  2998. }
  2999.  
  3000.  
  3001. wchar_t *SemanticError::PrintINVALID_CAST_CONVERSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3002. {
  3003.     ErrorString s;
  3004.     
  3005.     s << "An expression of type \""
  3006.             << err.insert1
  3007.             << "\" cannot be cast into type \""
  3008.             << err.insert2
  3009.             << "\".";
  3010.  
  3011.     return s.Array();
  3012. }
  3013.  
  3014.  
  3015. wchar_t *SemanticError::PrintINVALID_CAST_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3016. {
  3017.     ErrorString s;
  3018.     
  3019.     s << "Expression found where a type is expected.";
  3020.  
  3021.     return s.Array();
  3022. }
  3023.  
  3024.  
  3025. wchar_t *SemanticError::PrintTYPE_NOT_PRIMITIVE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3026. {
  3027.     ErrorString s;
  3028.     
  3029.     s << "The type of this expression, \""
  3030.             << err.insert1
  3031.             << "\", is not a primitive type.";
  3032.  
  3033.     return s.Array();
  3034. }
  3035.  
  3036.  
  3037. wchar_t *SemanticError::PrintTYPE_NOT_INTEGRAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3038. {
  3039.     ErrorString s;
  3040.     
  3041.     s << "The type of this expression, \""
  3042.             << err.insert1
  3043.             << "\", is not an integral type.";
  3044.  
  3045.     return s.Array();
  3046. }
  3047.  
  3048.  
  3049. wchar_t *SemanticError::PrintTYPE_NOT_NUMERIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3050. {
  3051.     ErrorString s;
  3052.     
  3053.     s << "The type of this expression, \""
  3054.             << err.insert1
  3055.             << "\", is not numeric.";
  3056.  
  3057.     return s.Array();
  3058. }
  3059.  
  3060.  
  3061. wchar_t *SemanticError::PrintTYPE_NOT_INTEGER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3062. {
  3063.     ErrorString s;
  3064.     
  3065.     s << "The type of this expression, \""
  3066.             << err.insert1
  3067.             << "\", cannot be promoted to \"int\" by widening conversion.";
  3068.  
  3069.     return s.Array();
  3070. }
  3071.  
  3072.  
  3073. wchar_t *SemanticError::PrintTYPE_NOT_BOOLEAN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3074. {
  3075.     ErrorString s;
  3076.     
  3077.     s << "The type of this expression, \""
  3078.             << err.insert1
  3079.             << "\", is not boolean.";
  3080.  
  3081.     return s.Array();
  3082. }
  3083.  
  3084.  
  3085. wchar_t *SemanticError::PrintTYPE_NOT_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3086. {
  3087.     ErrorString s;
  3088.     
  3089.     s << "The type of this expression, \""
  3090.             << err.insert1
  3091.             << "\", is not an array type.";
  3092.  
  3093.     return s.Array();
  3094. }
  3095.  
  3096.  
  3097. wchar_t *SemanticError::PrintTYPE_NOT_REFERENCE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3098. {
  3099.     ErrorString s;
  3100.     
  3101.     s << "The type of this expression, \""
  3102.             << err.insert1
  3103.             << "\", is not a valid reference type in this context.";
  3104.  
  3105.     return s.Array();
  3106. }
  3107.  
  3108.  
  3109. wchar_t *SemanticError::PrintTYPE_NOT_VALID_FOR_SWITCH(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3110. {
  3111.     ErrorString s;
  3112.  
  3113.     s << "The type of a switch statement expression must be either \"int\", \"short\", \"char\" or \"byte\"."
  3114.             << " The type of this expression is \"";
  3115.     if (NotDot(err.insert1))
  3116.     {
  3117.         s << err.insert1
  3118.                 << '/';
  3119.     }
  3120.     s << err.insert2
  3121.             << "\".";
  3122.  
  3123.     return s.Array();
  3124. }
  3125.  
  3126.  
  3127. wchar_t *SemanticError::PrintTYPE_IS_VOID(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3128. {
  3129.     ErrorString s;
  3130.     
  3131.     s << "An expression of type \""
  3132.             << err.insert1
  3133.             << "\" is not valid in this context.";
  3134.  
  3135.     return s.Array();
  3136. }
  3137.  
  3138.  
  3139. wchar_t *SemanticError::PrintVALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3140. {
  3141.     ErrorString s;
  3142.     
  3143.     s << "The value of this expression, "
  3144.             << err.insert1
  3145.             << ", cannot be represented in the type of the switch statement expression, \""
  3146.             << err.insert2
  3147.             << "\".";
  3148.  
  3149.     return s.Array();
  3150. }
  3151.  
  3152.  
  3153. wchar_t *SemanticError::PrintTYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3154. {
  3155.     ErrorString s;
  3156.     
  3157.     s << "The type of this expression, \""
  3158.             << err.insert1
  3159.             << "\", is not assignment-convertible to the type of the switch statement expression, \""
  3160.             << err.insert2
  3161.             << "\".";
  3162.  
  3163.     return s.Array();
  3164. }
  3165.  
  3166.  
  3167. wchar_t *SemanticError::PrintDUPLICATE_CASE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3168. {
  3169.     ErrorString s;
  3170.     
  3171.     s << "The value of this expression, "
  3172.             << err.insert1
  3173.             << ", has already been used in this switch statement.";
  3174.  
  3175.     return s.Array();
  3176. }
  3177.  
  3178.  
  3179. wchar_t *SemanticError::PrintMISPLACED_THIS_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3180. {
  3181.     ErrorString s;
  3182.     
  3183.     s << "A \"this\" expression may only be used in the body of an instance method, "
  3184.                "constructor (after the explicit constructor invocation, if any), "
  3185.                "initializer block, or in the initializer expression of an instance variable.";
  3186.  
  3187.     return s.Array();
  3188. }
  3189.  
  3190.  
  3191. wchar_t *SemanticError::PrintMISPLACED_SUPER_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3192. {
  3193.     ErrorString s;
  3194.     
  3195.     s << "A \"super\" expression may only appear in the body of a class that has a super class and"
  3196.                " it must be enclosed in the body of an instance method or constructor or in the initializer"
  3197.                " of an instance variable.";
  3198.  
  3199.     return s.Array();
  3200. }
  3201.  
  3202.  
  3203. wchar_t *SemanticError::PrintFINAL_VARIABLE_TARGET_IN_LOOP(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3204. {
  3205.     ErrorString s;
  3206.     
  3207.     s << "Possible attempt to assign a value to a final variable \""
  3208.             << err.insert1
  3209.             << "\""
  3210.             << ", within the body of a loop that may execute more than once.";
  3211.  
  3212.     return s.Array();
  3213. }
  3214.  
  3215.  
  3216. wchar_t *SemanticError::PrintTARGET_VARIABLE_IS_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3217. {
  3218.     ErrorString s;
  3219.  
  3220.     s << "Possible attempt to reassign a value to the final variable \""
  3221.             << err.insert1
  3222.             << "\"";
  3223.     if (err.insert2)
  3224.     {
  3225.         s << ". The other assignement was at location "
  3226.                 << err.insert2;
  3227.     }
  3228.     s << '.';
  3229.  
  3230.     return s.Array();
  3231. }
  3232.  
  3233.  
  3234. wchar_t *SemanticError::PrintUNINITIALIZED_FINAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3235. {
  3236.     ErrorString s;
  3237.     
  3238.     s << "A final variable must be initialized.";
  3239.  
  3240.     return s.Array();
  3241. }
  3242.  
  3243.  
  3244. wchar_t *SemanticError::PrintUNINITIALIZED_STATIC_FINAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3245. {
  3246.     ErrorString s;
  3247.     
  3248.     s << "A blank class final variable must be initialized in a static initializer block. "
  3249.                "We will assume that it has been initialized to avoid emitting spurious messages.";
  3250.  
  3251.     return s.Array();
  3252. }
  3253.  
  3254.  
  3255. wchar_t *SemanticError::PrintUNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3256. {
  3257.     ErrorString s;
  3258.     
  3259.     s << "The blank final field \"this."
  3260.             << err.insert1
  3261.             << "\" is not definitely assigned a value in this constructor.";
  3262.  
  3263.     return s.Array();
  3264. }
  3265.  
  3266.  
  3267. wchar_t *SemanticError::PrintINIT_SCALAR_WITH_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3268. {
  3269.     ErrorString s;
  3270.     
  3271.     s << "An array initializer cannot be used to initialize a variable of type \""
  3272.             << err.insert1
  3273.             << "\".";
  3274.  
  3275.     return s.Array();
  3276. }
  3277.  
  3278.  
  3279. wchar_t *SemanticError::PrintINIT_ARRAY_WITH_SCALAR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3280. {
  3281.     ErrorString s;
  3282.     
  3283.     s << "A single expression cannot be used to initialize an array variable of type \""
  3284.             << err.insert1
  3285.             << "\".";
  3286.  
  3287.     return s.Array();
  3288. }
  3289.  
  3290.  
  3291. wchar_t *SemanticError::PrintINVALID_BYTE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3292. {
  3293.     ErrorString s;
  3294.     
  3295.     s << "A byte value must be an integer value (note that a character literal is not an integer value) in the range -128..127.";
  3296.  
  3297.     return s.Array();
  3298. }
  3299.  
  3300.  
  3301. wchar_t *SemanticError::PrintINVALID_SHORT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3302. {
  3303.     ErrorString s;
  3304.     
  3305.     s << "A short value must be an integer value (note that a character literal is not an integer value) "
  3306.                "in the range -32768..32767.";
  3307.  
  3308.     return s.Array();
  3309. }
  3310.  
  3311.  
  3312. wchar_t *SemanticError::PrintINVALID_CHARACTER_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3313. {
  3314.     ErrorString s;
  3315.     
  3316.     s << "A character literal must be a valid unicode value - i.e., a character literal enclosed in single quotes or "
  3317.                "an integer value in the range 0..65535 or an escaped 3-digit octal value in the range \\000..\\377.";
  3318.  
  3319.     return s.Array();
  3320. }
  3321.  
  3322.  
  3323. wchar_t *SemanticError::PrintINVALID_INT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3324. {
  3325.     ErrorString s;
  3326.     
  3327.     s << "The value of an \"int\" literal must be a decimal value in the range -2147483648..2147483647"
  3328.                " or a hexadecimal or octal literal that fits in 32 bits.";
  3329.  
  3330.     return s.Array();
  3331. }
  3332.  
  3333.  
  3334. wchar_t *SemanticError::PrintINVALID_LONG_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3335. {
  3336.     ErrorString s;
  3337.     
  3338.     s << "The value of a long literal must be a decimal value in the range "
  3339.                "-9223372036854775808..9223372036854775807 or a hexadecimal or octal literal that fits in 64 bits.";
  3340.  
  3341.     return s.Array();
  3342. }
  3343.  
  3344.  
  3345. wchar_t *SemanticError::PrintINVALID_FLOAT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3346. {
  3347.     ErrorString s;
  3348.     
  3349.     s << "Invalid floating-point constant.";
  3350.  
  3351.     return s.Array();
  3352. }
  3353.  
  3354.  
  3355. wchar_t *SemanticError::PrintINVALID_DOUBLE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3356. {
  3357.     ErrorString s;
  3358.     
  3359.     s << "Invalid double constant.";
  3360.  
  3361.     return s.Array();
  3362. }
  3363.  
  3364.  
  3365. wchar_t *SemanticError::PrintINVALID_STRING_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3366. {
  3367.     ErrorString s;
  3368.     
  3369.     s << "The value of this \"String\" literal is invalid. Perhaps it contains a bad escape sequence?";
  3370.  
  3371.     return s.Array();
  3372. }
  3373.  
  3374.  
  3375. wchar_t *SemanticError::PrintRETURN_STATEMENT_IN_INITIALIZER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3376. {
  3377.     ErrorString s;
  3378.     
  3379.     s << "A return statement may not appear in an initializer block.";
  3380.  
  3381.     return s.Array();
  3382. }
  3383.  
  3384.  
  3385. wchar_t *SemanticError::PrintMISPLACED_RETURN_WITH_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3386. {
  3387.     ErrorString s;
  3388.     
  3389.     s << "A return statement with expression must be contained in a method declaration that is "
  3390.                "declared to return a value.";
  3391.  
  3392.     return s.Array();
  3393. }
  3394.  
  3395.  
  3396. wchar_t *SemanticError::PrintMISPLACED_RETURN_WITH_NO_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3397. {
  3398.     ErrorString s;
  3399.     
  3400.     s << "A return statement with no expression may only appear in void method or a constructor.";
  3401.  
  3402.     return s.Array();
  3403. }
  3404.  
  3405.  
  3406. wchar_t *SemanticError::PrintMISMATCHED_RETURN_AND_METHOD_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3407. {
  3408.     ErrorString s;
  3409.  
  3410.     s << "The type of this return expression, \"";
  3411.     if (NotDot(err.insert1))
  3412.     {
  3413.         s << err.insert1
  3414.                 << '/';
  3415.     }
  3416.     s << err.insert2
  3417.             << "\", does not match the return type of the method, \"";
  3418.     if (NotDot(err.insert3))
  3419.     {
  3420.         s << err.insert3
  3421.                 << '/';
  3422.     }
  3423.     s << err.insert4
  3424.             << "\".";
  3425.  
  3426.     return s.Array();
  3427. }
  3428.  
  3429.  
  3430. wchar_t *SemanticError::PrintEXPRESSION_NOT_THROWABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3431. {
  3432.     ErrorString s;
  3433.     
  3434.     s << "The expression in a throw statement must denote a variable or value of a reference type "
  3435.                "which is assignable to the type Throwable.";
  3436.  
  3437.     return s.Array();
  3438. }
  3439.  
  3440.  
  3441. wchar_t *SemanticError::PrintBAD_THROWABLE_EXPRESSION_IN_TRY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3442. {
  3443.     ErrorString s;
  3444.  
  3445.     s << "The type of the expression in this throw statement, \"";
  3446.     if (NotDot(err.insert1))
  3447.     {
  3448.         s << err.insert1
  3449.                 << '/';
  3450.     }
  3451.     s << err.insert2
  3452.             << "\", is not catchable by the enclosing try statement;";
  3453.     if (wcslen(err.insert3) > 0)
  3454.     {
  3455.         s << " nor is it assignable to an exception in the throws clause of the enclosing method or constructor \""
  3456.                 << err.insert3
  3457.                 << "\";";
  3458.     }
  3459.     s << " nor is it a subclass of RuntimeException or Error.";
  3460.  
  3461.     return s.Array();
  3462. }
  3463.  
  3464.  
  3465. wchar_t *SemanticError::PrintBAD_THROWABLE_EXPRESSION_IN_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3466. {
  3467.     ErrorString s;
  3468.  
  3469.     s << "The type of the expression in this throw statement, \"";
  3470.     if (NotDot(err.insert1))
  3471.     {
  3472.         s << err.insert1
  3473.                 << '/';
  3474.     }
  3475.     s << err.insert2
  3476.             << "\", is not assignable to an exception in the throws clause of the enclosing method or constructor \""
  3477.             << err.insert3
  3478.             << "\"; nor is it a subclass of RuntimeException or Error.";
  3479.  
  3480.     return s.Array();
  3481. }
  3482.  
  3483.  
  3484. wchar_t *SemanticError::PrintBAD_THROWABLE_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3485. {
  3486.     ErrorString s;
  3487.  
  3488.     s << "The type of the expression in this throw statement, \"";
  3489.     if (NotDot(err.insert1))
  3490.     {
  3491.         s << err.insert1
  3492.                 << '/';
  3493.     }
  3494.     s << err.insert2
  3495.             << "\", is not a subclass of RuntimeException or Error.";
  3496.  
  3497.     return s.Array();
  3498. }
  3499.  
  3500.  
  3501. wchar_t *SemanticError::PrintMISPLACED_BREAK_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3502. {
  3503.     ErrorString s;
  3504.     
  3505.     s << "A \"break\" statement must be enclosed in a \"switch\", \"while\", \"do\" or \"for\" statement.";
  3506.  
  3507.     return s.Array();
  3508. }
  3509.  
  3510.  
  3511. wchar_t *SemanticError::PrintMISPLACED_CONTINUE_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3512. {
  3513.     ErrorString s;
  3514.     
  3515.     s << "A \"continue\" statement must be enclosed in a \"while\", \"do\" or \"for\" statement.";
  3516.  
  3517.     return s.Array();
  3518. }
  3519.  
  3520.  
  3521. wchar_t *SemanticError::PrintMISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3522. {
  3523.     ErrorString s;
  3524.     
  3525.     s << "Misplaced explicit constructor invocation.";
  3526.  
  3527.     return s.Array();
  3528. }
  3529.  
  3530.  
  3531. wchar_t *SemanticError::PrintINVALID_CONTINUE_TARGET(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3532. {
  3533.     ErrorString s;
  3534.     
  3535.     s << "The statement labeled \""
  3536.             << err.insert1
  3537.             << "\" cannot be continued since it is not a \"while\", \"do\" or \"for\" statement.";
  3538.  
  3539.     return s.Array();
  3540. }
  3541.  
  3542.  
  3543. wchar_t *SemanticError::PrintNON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3544. {
  3545.     ErrorString s;
  3546.     
  3547.     s << "The abstract method \""
  3548.             << err.insert1
  3549.             << "\" is enclosed in a type, \""
  3550.             << err.insert2
  3551.             << "\", that is not abstract.";
  3552.  
  3553.     return s.Array();
  3554. }
  3555.  
  3556.  
  3557. wchar_t *SemanticError::PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3558. {
  3559.     ErrorString s;
  3560.  
  3561.     s << "The abstract method \""
  3562.             << err.insert1
  3563.             << "\", inherited from type \"";
  3564.     if (NotDot(err.insert2))
  3565.     {
  3566.         s << err.insert2
  3567.                 << '/';
  3568.     }
  3569.     s << err.insert3
  3570.             << "\", is not implemented in the non-abstract class \"";
  3571.     if (NotDot(err.insert4))
  3572.     {
  3573.         s << err.insert4
  3574.                 << '/';
  3575.     }
  3576.     s << err.insert5
  3577.             << "\".";
  3578.  
  3579.     return s.Array();
  3580. }
  3581.  
  3582.  
  3583. wchar_t *SemanticError::PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3584. {
  3585.     ErrorString s;
  3586.  
  3587.     s << "The abstract method \""
  3588.             << err.insert1
  3589.             << "\", inherited from type \"";
  3590.     if (NotDot(err.insert2))
  3591.     {
  3592.         s << err.insert2
  3593.                 << '/';
  3594.     }
  3595.     s << err.insert3
  3596.             << "\", is not implemented in the non-abstract class \"";
  3597.     if (NotDot(err.insert4))
  3598.     {
  3599.         s << err.insert4
  3600.                 << '/';
  3601.     }
  3602.     s << err.insert5
  3603.             << "\". Since the type \"";
  3604.     if (NotDot(err.insert2))
  3605.     {
  3606.         s << err.insert2
  3607.                 << '/';
  3608.     }
  3609.     s << err.insert3
  3610.             << "\" was read from a class file, it is possible that it just needs to be recompiled "
  3611.                "because after having inherited method \""
  3612.             << err.insert1
  3613.             << "\" from an interface, the method was subsequently removed from that interface.";
  3614.  
  3615.     return s.Array();
  3616. }
  3617.  
  3618.  
  3619. wchar_t *SemanticError::PrintNON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3620. {
  3621.     ErrorString s;
  3622.  
  3623.     s << "The abstract method \""
  3624.             << err.insert1
  3625.             << "\", belonging to the class \"";
  3626.     if (NotDot(err.insert2))
  3627.     {
  3628.         s << err.insert2
  3629.                 << '/';
  3630.     }
  3631.     s << err.insert3
  3632.             << "\" has default access."
  3633.                " Therefore, it is not inherited and hence, it cannot be implemented in the non-abstract class \"";
  3634.     if (NotDot(err.insert4))
  3635.     {
  3636.         s << err.insert4
  3637.                 << '/';
  3638.     }
  3639.     s << err.insert5
  3640.             << "\".";
  3641.  
  3642.     return s.Array();
  3643. }
  3644.  
  3645.  
  3646. wchar_t *SemanticError::PrintNO_ABSTRACT_METHOD_IMPLEMENTATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3647. {
  3648.     ErrorString s;
  3649.  
  3650.     s << "No implementation of the abstract method \""
  3651.             << err.insert1
  3652.             << "\" declared in type \"";
  3653.     if (NotDot(err.insert2))
  3654.     {
  3655.         s << err.insert2
  3656.                 << '/';
  3657.     }
  3658.     s << err.insert3
  3659.             << "\" was found in class \""
  3660.             << err.insert4
  3661.             << "\".";
  3662.  
  3663.     return s.Array();
  3664. }
  3665.  
  3666.  
  3667. wchar_t *SemanticError::PrintDUPLICATE_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3668. {
  3669.     ErrorString s;
  3670.  
  3671.     s << "Duplicate specification of interface \"";
  3672.     if (NotDot(err.insert1))
  3673.     {
  3674.         s << err.insert1
  3675.                 << '/';
  3676.     }
  3677.     s << err.insert2
  3678.             << "\" in definition of type \""
  3679.             << err.insert3
  3680.             << "\".";
  3681.  
  3682.     return s.Array();
  3683. }
  3684.  
  3685.  
  3686. wchar_t *SemanticError::PrintUNKNOWN_QUALIFIED_NAME_BASE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3687. {
  3688.     ErrorString s;
  3689.     
  3690.     s << "\""
  3691.             << err.insert1
  3692.             << "\" is either a misplaced package name or a non-existent entity.";
  3693.  
  3694.     return s.Array();
  3695. }
  3696.  
  3697.  
  3698. wchar_t *SemanticError::PrintUNKNOWN_AMBIGUOUS_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3699. {
  3700.     ErrorString s;
  3701.     
  3702.     s << "\""
  3703.             << err.insert1
  3704.             << "\" is either a misplaced package name or a non-existent entity. An expression name is expected in this context.";
  3705.  
  3706.     return s.Array();
  3707. }
  3708.  
  3709.  
  3710. wchar_t *SemanticError::PrintCIRCULAR_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3711. {
  3712.     ErrorString s;
  3713.  
  3714.     s << "The class \"";
  3715.     if (NotDot(err.insert1))
  3716.     {
  3717.         s << err.insert1
  3718.                 << "/";
  3719.     }
  3720.     s << err.insert2
  3721.             << "\" is circularly defined with its super type(s).";
  3722.  
  3723.     return s.Array();
  3724. }
  3725.  
  3726.  
  3727. wchar_t *SemanticError::PrintCIRCULAR_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3728. {
  3729.     ErrorString s;
  3730.  
  3731.     s << "The interface \"";
  3732.     if (NotDot(err.insert1))
  3733.     {
  3734.         s << err.insert1
  3735.                 << "/";
  3736.     }
  3737.     s << err.insert2
  3738.             << "\" is circularly defined with its super type(s).";
  3739.  
  3740.     return s.Array();
  3741. }
  3742.  
  3743.  
  3744. wchar_t *SemanticError::PrintTYPE_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3745. {
  3746.     ErrorString s;
  3747.  
  3748.     s << "The type \"";
  3749.     if (NotDot(err.insert1))
  3750.     {
  3751.         s << err.insert1
  3752.                 << '/';
  3753.     }
  3754.     s << err.insert2
  3755.             << "\" with "
  3756.             << err.insert3
  3757.             << " access is not visible here.";
  3758.  
  3759.     return s.Array();
  3760. }
  3761.  
  3762.  
  3763. wchar_t *SemanticError::PrintPRIVATE_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3764. {
  3765.     ErrorString s;
  3766.  
  3767.     s << "The field \""
  3768.             << err.insert1
  3769.             << "\" in type \"";
  3770.     if (NotDot(err.insert2))
  3771.     {
  3772.         s << err.insert2
  3773.                 << '/';
  3774.     }
  3775.     s << err.insert3
  3776.             << "\" is private and not accessible here.";
  3777.  
  3778.     return s.Array();
  3779. }
  3780.  
  3781.  
  3782. wchar_t *SemanticError::PrintPROTECTED_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3783. {
  3784.     ErrorString s;
  3785.  
  3786.     s << "The field \""
  3787.             << err.insert1
  3788.             << "\" in type \"";
  3789.     if (NotDot(err.insert2))
  3790.     {
  3791.         s << err.insert2
  3792.                 << '/';
  3793.     }
  3794.     s << err.insert3
  3795.             << "\" is protected and not accessible here.";
  3796.  
  3797.     return s.Array();
  3798. }
  3799.  
  3800.  
  3801. wchar_t *SemanticError::PrintDEFAULT_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3802. {
  3803.     ErrorString s;
  3804.  
  3805.     s << "The field \""
  3806.             << err.insert1
  3807.             << "\" in type \"";
  3808.     if (NotDot(err.insert2))
  3809.     {
  3810.         s << err.insert2
  3811.                 << '/';
  3812.     }
  3813.     s << err.insert3
  3814.             << "\" has default access and is not accessible here.";
  3815.  
  3816.     return s.Array();
  3817. }
  3818.  
  3819.  
  3820. wchar_t *SemanticError::PrintPRIVATE_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3821. {
  3822.     ErrorString s;
  3823.  
  3824.     s << "Method \""
  3825.             << err.insert1
  3826.             << "\" in type \"";
  3827.     if (NotDot(err.insert2))
  3828.     {
  3829.         s << err.insert2
  3830.                 << '/';
  3831.     }
  3832.     s << err.insert3
  3833.             << "\" is private and not accessible here.";
  3834.  
  3835.     return s.Array();
  3836. }
  3837.  
  3838.  
  3839. wchar_t *SemanticError::PrintPROTECTED_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3840. {
  3841.     ErrorString s;
  3842.  
  3843.     s << "Method \""
  3844.             << err.insert1
  3845.             << "\" in type \"";
  3846.     if (NotDot(err.insert2))
  3847.     {
  3848.         s << err.insert2
  3849.                 << '/';
  3850.     }
  3851.     s << err.insert3
  3852.             << "\" is protected and not accessible here.";
  3853.  
  3854.     return s.Array();
  3855. }
  3856.  
  3857.  
  3858. wchar_t *SemanticError::PrintDEFAULT_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3859. {
  3860.     ErrorString s;
  3861.  
  3862.     s << "Method \""
  3863.             << err.insert1
  3864.             << "\" in type \"";
  3865.     if (NotDot(err.insert2))
  3866.     {
  3867.         s << err.insert2
  3868.                 << '/';
  3869.     }
  3870.     s << err.insert3
  3871.             << "\" has default access and is not accessible here.";
  3872.  
  3873.     return s.Array();
  3874. }
  3875.  
  3876.  
  3877. wchar_t *SemanticError::PrintPRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3878. {
  3879.     ErrorString s;
  3880.  
  3881.     s << "The constructor \""
  3882.             << err.insert1
  3883.             << "\" in type \"";
  3884.     if (NotDot(err.insert2))
  3885.     {
  3886.         s << err.insert2
  3887.                 << '/';
  3888.     }
  3889.     s << err.insert3
  3890.             << "\" is private. Therefore, it is not accessible here.";
  3891.  
  3892.     return s.Array();
  3893. }
  3894.  
  3895.  
  3896. wchar_t *SemanticError::PrintPROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3897. {
  3898.     ErrorString s;
  3899.  
  3900.     s << "The constructor \""
  3901.             << err.insert1
  3902.             << "\" in type \"";
  3903.     if (NotDot(err.insert2))
  3904.     {
  3905.         s << err.insert2
  3906.                 << '/';
  3907.     }
  3908.     s << err.insert3
  3909.             << "\" is protected. Therefore, it is not accessible here.";
  3910.  
  3911.     return s.Array();
  3912. }
  3913.  
  3914.  
  3915. wchar_t *SemanticError::PrintDEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3916. {
  3917.     ErrorString s;
  3918.  
  3919.     s << "The constructor \""
  3920.             << err.insert1
  3921.             << "\" in type \"";
  3922.     if (NotDot(err.insert2))
  3923.     {
  3924.         s << err.insert2
  3925.                 << '/';
  3926.     }
  3927.     s << err.insert3
  3928.             << "\" has default access. Therefore, it is not accessible here.";
  3929.  
  3930.     return s.Array();
  3931. }
  3932.  
  3933.  
  3934. wchar_t *SemanticError::PrintCONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3935. {
  3936.     ErrorString s;
  3937.  
  3938.     s << "The constructor invoked here can throw the exception \"";
  3939.     if (NotDot(err.insert1))
  3940.     {
  3941.         s << err.insert1
  3942.                 << "/";
  3943.     }
  3944.     s << err.insert2
  3945.             << "\" which is not thrown by the constructor containing this call.";
  3946.  
  3947.     return s.Array();
  3948. }
  3949.  
  3950.  
  3951. wchar_t *SemanticError::PrintCONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3952. {
  3953.     ErrorString s;
  3954.  
  3955.     s << "A constructor associated with this ";
  3956.  
  3957.     if (wcslen(err.insert1) == 0)
  3958.         s << "anonymous type";
  3959.     else
  3960.     {
  3961.         s << "type, \""
  3962.                 << err.insert1
  3963.                 << "\",";
  3964.     }
  3965.  
  3966.     s << " does not throw the exception \"";
  3967.     if (NotDot(err.insert2))
  3968.     {
  3969.         s << err.insert2
  3970.                 << "/";
  3971.     }
  3972.     s << err.insert3
  3973.             << "\" thrown by its super type, \"";
  3974.     if (NotDot(err.insert4))
  3975.     {
  3976.         s << err.insert4
  3977.                 << "/";
  3978.     }
  3979.     s << err.insert5
  3980.             << "\".";
  3981.  
  3982.     return s.Array();
  3983. }
  3984.  
  3985.  
  3986. wchar_t *SemanticError::PrintPARAMETER_REDECLARED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3987. {
  3988.     ErrorString s;
  3989.     
  3990.     s << "The name of a formal parameter, \""
  3991.             << err.insert1
  3992.             << "\", may not be used to declare a local variable or an exception parameter.";
  3993.  
  3994.     return s.Array();
  3995. }
  3996.  
  3997.  
  3998. wchar_t *SemanticError::PrintBAD_ABSTRACT_METHOD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3999. {
  4000.     ErrorString s;
  4001.     
  4002.     s << "A method declaration that contains the keyword \"abstract\" may not also contain one of the keywords: "
  4003.                "\"private\", \"static\", \"final\", \"native\" or \"synchronized\".";
  4004.  
  4005.     return s.Array();
  4006. }
  4007.  
  4008.  
  4009. wchar_t *SemanticError::PrintABSTRACT_METHOD_MODIFIER_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4010. {
  4011.     ErrorString s;
  4012.     
  4013.     s << "An abstract method may not also contain the keyword \""
  4014.             << err.insert1
  4015.             << "\".";
  4016.  
  4017.     return s.Array();
  4018. }
  4019.  
  4020.  
  4021. wchar_t *SemanticError::PrintABSTRACT_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4022. {
  4023.     ErrorString s;
  4024.     
  4025.     s << "An abstract method, \""
  4026.             << err.insert1
  4027.             << "\", cannot be invoked.";
  4028.  
  4029.     return s.Array();
  4030. }
  4031.  
  4032.  
  4033. wchar_t *SemanticError::PrintFINAL_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4034. {
  4035.     ErrorString s;
  4036.  
  4037.     s << "The method \""
  4038.             << err.insert1
  4039.             << "\" cannot override the final (or private) method \""
  4040.             << err.insert2
  4041.             << "\" declared in type \"";
  4042.     if (NotDot(err.insert3))
  4043.     {
  4044.         s << err.insert3
  4045.                 << "/";
  4046.     }
  4047.     s << err.insert4
  4048.             << "\".";
  4049.  
  4050.     return s.Array();
  4051. }
  4052.  
  4053.  
  4054. wchar_t *SemanticError::PrintFINAL_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4055. {
  4056.     ErrorString s;
  4057.  
  4058.     s << "In class \""
  4059.             << err.insert1
  4060.             << "\", the method \""
  4061.             << err.insert2
  4062.             << "\", inherited from type \"";
  4063.     if (NotDot(err.insert3))
  4064.     {
  4065.         s << err.insert3
  4066.                 << "/";
  4067.     }
  4068.     s << err.insert4
  4069.             << "\", overrides the final (or private) method \""
  4070.             << err.insert5
  4071.             << "\", inherited from type \"";
  4072.     if (NotDot(err.insert6))
  4073.     {
  4074.         s << err.insert6
  4075.                 << "/";
  4076.     }
  4077.     s << err.insert7
  4078.             << "\".";
  4079.  
  4080.     return s.Array();
  4081. }
  4082.  
  4083.  
  4084. wchar_t *SemanticError::PrintPRIVATE_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4085. {
  4086.     ErrorString s;
  4087.  
  4088.     s << "The method \""
  4089.             << err.insert1
  4090.             << "\" is overriding the private (should be treated as final) method \""
  4091.             << err.insert2
  4092.             << "\" declared in type \"";
  4093.     if (NotDot(err.insert3))
  4094.     {
  4095.         s << err.insert3
  4096.                 << "/";
  4097.     }
  4098.     s << err.insert4
  4099.             << "\".";
  4100.  
  4101.     return s.Array();
  4102. }
  4103.  
  4104.  
  4105. wchar_t *SemanticError::PrintPRIVATE_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4106. {
  4107.     ErrorString s;
  4108.  
  4109.     s << "In class \""
  4110.             << err.insert1
  4111.             << "\", the method \""
  4112.             << err.insert2
  4113.             << "\", inherited from type \"";
  4114.     if (NotDot(err.insert3))
  4115.     {
  4116.         s << err.insert3
  4117.                 << "/";
  4118.     }
  4119.     s << err.insert4
  4120.             << "\", overrides the private (should be treated as final) method \""
  4121.             << err.insert5
  4122.             << "\", inherited from type \"";
  4123.     if (NotDot(err.insert6))
  4124.     {
  4125.         s << err.insert6
  4126.                 << "/";
  4127.     }
  4128.     s << err.insert7
  4129.             << "\".";
  4130.  
  4131.     return s.Array();
  4132. }
  4133.  
  4134.  
  4135. wchar_t *SemanticError::PrintCLASS_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4136. {
  4137.     ErrorString s;
  4138.  
  4139.     s << "The instance method \""
  4140.             << err.insert1
  4141.             << "\" cannot override the static method \""
  4142.             << err.insert2
  4143.             << "\" declared in type \"";
  4144.     if (NotDot(err.insert3))
  4145.     {
  4146.         s << err.insert3
  4147.                 << "/";
  4148.     }
  4149.     s << err.insert4
  4150.             << "\".";
  4151.  
  4152.     return s.Array();
  4153. }
  4154.  
  4155.  
  4156. wchar_t *SemanticError::PrintCLASS_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4157. {
  4158.     ErrorString s;
  4159.  
  4160.     s << "In class \""
  4161.             << err.insert1
  4162.             << "\", the instance method \""
  4163.             << err.insert2
  4164.             << "\", inherited from type \"";
  4165.     if (NotDot(err.insert3))
  4166.     {
  4167.         s << err.insert3
  4168.                 << "/";
  4169.     }
  4170.     s << err.insert4
  4171.             << "\", cannot override the static method \""
  4172.             << err.insert5
  4173.             << "\", declared in type \"";
  4174.     if (NotDot(err.insert6))
  4175.     {
  4176.         s << err.insert6
  4177.                 << "/";
  4178.     }
  4179.     s << err.insert7
  4180.             << "\".";
  4181.  
  4182.     return s.Array();
  4183. }
  4184.  
  4185.  
  4186. wchar_t *SemanticError::PrintINSTANCE_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4187. {
  4188.     ErrorString s;
  4189.  
  4190.     s << "The static method \""
  4191.             << err.insert1
  4192.             << "\" cannot hide the instance method \""
  4193.             << err.insert2
  4194.             << "\" declared in \"";
  4195.     if (NotDot(err.insert3))
  4196.     {
  4197.         s << err.insert3
  4198.                 << "/";
  4199.     }
  4200.     s << err.insert4
  4201.             << "\".";
  4202.  
  4203.     return s.Array();
  4204. }
  4205.  
  4206.  
  4207. wchar_t *SemanticError::PrintINSTANCE_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4208. {
  4209.     ErrorString s;
  4210.  
  4211.     s << "In class \""
  4212.             << err.insert1
  4213.             << "\", the static method \""
  4214.             << err.insert2
  4215.             << "\", inherited from type \"";
  4216.     if (NotDot(err.insert3))
  4217.     {
  4218.         s << err.insert3
  4219.                 << "/";
  4220.     }
  4221.     s << err.insert4
  4222.             << "\", hides the instance method \""
  4223.             << err.insert5
  4224.             << "\", declared in type \"";
  4225.     if (NotDot(err.insert6))
  4226.     {
  4227.         s << err.insert6
  4228.                 << "/";
  4229.     }
  4230.     s << err.insert7
  4231.             << "\".";
  4232.  
  4233.     return s.Array();
  4234. }
  4235.  
  4236.  
  4237. wchar_t *SemanticError::PrintBAD_ACCESS_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4238. {
  4239.     ErrorString s;
  4240.  
  4241.     s << "The method \""
  4242.             << err.insert1
  4243.             << "\" with "
  4244.             << err.insert2
  4245.             << " access cannot override the method \""
  4246.             << err.insert3
  4247.             << "\" with "
  4248.             << err.insert4
  4249.             << " access declared in type \"";
  4250.     if (NotDot(err.insert5))
  4251.     {
  4252.         s << err.insert5
  4253.                 << "/";
  4254.     }
  4255.     s << err.insert6
  4256.             << "\".";
  4257.  
  4258.     return s.Array();
  4259. }
  4260.  
  4261.  
  4262. wchar_t *SemanticError::PrintBAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4263. {
  4264.     ErrorString s;
  4265.  
  4266.     s << "In class \""
  4267.             << err.insert1
  4268.             << "\", the method \""
  4269.             << err.insert2
  4270.             << "\" with "
  4271.             << err.insert3
  4272.             << " access inherited from type \"";
  4273.     if (NotDot(err.insert4))
  4274.     {
  4275.         s << err.insert4
  4276.                 << "/";
  4277.     }
  4278.     s << err.insert5
  4279.             << "\", cannot override the method \""
  4280.             << err.insert6
  4281.             << "\" with "
  4282.             << err.insert7
  4283.             << " access inherited from type \"";
  4284.     if (NotDot(err.insert8))
  4285.     {
  4286.         s << err.insert8
  4287.                 << "/";
  4288.     }
  4289.     s << err.insert9
  4290.             << "\".";
  4291.  
  4292.     return s.Array();
  4293. }
  4294.  
  4295.  
  4296. wchar_t *SemanticError::PrintMISMATCHED_OVERRIDDEN_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4297. {
  4298.     ErrorString s;
  4299.  
  4300.     s << "The exception \""
  4301.             << err.insert1
  4302.             << "\" is not the same as or a subclass of any exception in the throws clause of the overridden method \""
  4303.             << err.insert2
  4304.             << "\" declared in type \"";
  4305.     if (NotDot(err.insert3))
  4306.     {
  4307.         s << err.insert3
  4308.                 << "/";
  4309.     }
  4310.     s << err.insert4
  4311.             << "\".";
  4312.  
  4313.     return s.Array();
  4314. }
  4315.  
  4316.  
  4317. wchar_t *SemanticError::PrintMISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4318. {
  4319.     ErrorString s;
  4320.  
  4321.     s << "In class \""
  4322.             << err.insert1
  4323.             << "\", the exception \""
  4324.             << err.insert2
  4325.             << "\" specified in method \""
  4326.             << err.insert3
  4327.             << "\" inherited from type \"";
  4328.     if (NotDot(err.insert4))
  4329.     {
  4330.         s << err.insert4
  4331.                 << "/";
  4332.     }
  4333.     s << err.insert5
  4334.             << "\", is not the same as or a subclass of any exception in the throws clause of the overridden method \""
  4335.             << err.insert6
  4336.             << "\" declared in type \"";
  4337.     if (NotDot(err.insert7))
  4338.     {
  4339.         s << err.insert7
  4340.                 << "/";
  4341.     }
  4342.     s << err.insert8
  4343.             << "\".";
  4344.  
  4345.     return s.Array();
  4346. }
  4347.  
  4348.  
  4349. wchar_t *SemanticError::PrintABSTRACT_METHOD_WITH_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4350. {
  4351.     ErrorString s;
  4352.  
  4353.     s << "The declaration of the abstract or native method, \""
  4354.             << err.insert1
  4355.             << "\", must not contain a method body.";
  4356.  
  4357.     return s.Array();
  4358. }
  4359.  
  4360.  
  4361. wchar_t *SemanticError::PrintNON_ABSTRACT_METHOD_WITHOUT_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4362. {
  4363.     ErrorString s;
  4364.  
  4365.     s << "The declaration of the non-abstract and non-native method, \""
  4366.             << err.insert1
  4367.             << "\", must contain a method body.";
  4368.  
  4369.     return s.Array();
  4370. }
  4371.  
  4372.  
  4373. wchar_t *SemanticError::PrintSTATIC_OVERRIDE_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4374. {
  4375.     ErrorString s;
  4376.  
  4377.     s << "The static method \""
  4378.             << err.insert1
  4379.             << "\" cannot hide an abstract method of the same name declared in type \"";
  4380.     if (NotDot(err.insert2))
  4381.     {
  4382.         s << err.insert2
  4383.                 << "/";
  4384.     }
  4385.     s << err.insert3
  4386.             << "\".";
  4387.  
  4388.     return s.Array();
  4389. }
  4390.  
  4391.  
  4392. wchar_t *SemanticError::PrintSTATIC_OVERRIDE_ABSTRACT_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4393. {
  4394.     ErrorString s;
  4395.  
  4396.     s << "In class \""
  4397.             << err.insert1
  4398.             << "\", the static method \""
  4399.             << err.insert2
  4400.             << "\", inherited from type \"";
  4401.     if (NotDot(err.insert3))
  4402.     {
  4403.         s << err.insert3
  4404.                 << "/";
  4405.     }
  4406.     s << err.insert4
  4407.             << "\", cannot hide the abstract method \""
  4408.             << err.insert5
  4409.             << "\", inherited from type \"";
  4410.     if (NotDot(err.insert6))
  4411.     {
  4412.         s << err.insert6
  4413.                 << "/";
  4414.     }
  4415.     s << err.insert7
  4416.             << "\".";
  4417.  
  4418.     return s.Array();
  4419. }
  4420.  
  4421.  
  4422. wchar_t *SemanticError::PrintCIRCULAR_THIS_CALL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4423. {
  4424.     ErrorString s;
  4425.  
  4426.     s << "The constructor \""
  4427.             << err.insert1
  4428.             << "\" may not directly or indirectly invoke itself.";
  4429.  
  4430.     return s.Array();
  4431. }
  4432.  
  4433.  
  4434. wchar_t *SemanticError::PrintINSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4435. {
  4436.     ErrorString s;
  4437.  
  4438.     s << "The instance variable \""
  4439.             << err.insert1
  4440.             << "\" declared in class \""
  4441.             << err.insert2
  4442.             << "\" is not accessible in an explicit constructor invocation.";
  4443.  
  4444.     return s.Array();
  4445. }
  4446.  
  4447.  
  4448. wchar_t *SemanticError::PrintINSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4449. {
  4450.     ErrorString s;
  4451.  
  4452.     s << "The instance method \""
  4453.             << err.insert1
  4454.             << "\" declared in this class, \""
  4455.             << err.insert2
  4456.             << "\", or one of its super classes, is not accessible in an explicit constructor invocation.";
  4457.  
  4458.     return s.Array();
  4459. }
  4460.  
  4461.  
  4462. wchar_t *SemanticError::PrintSYNTHETIC_VARIABLE_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4463. {
  4464.     ErrorString s;
  4465.  
  4466.     s << "Illegal attempt to access the synthetic field \""
  4467.             << err.insert1
  4468.             << "\" contained in class \"";
  4469.     if (NotDot(err.insert2))
  4470.     {
  4471.         s << err.insert2
  4472.                 << "/";
  4473.     }
  4474.     s << err.insert3
  4475.             << "\".";
  4476.  
  4477.     return s.Array();
  4478. }
  4479.  
  4480.  
  4481. wchar_t *SemanticError::PrintSYNTHETIC_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4482. {
  4483.     ErrorString s;
  4484.  
  4485.     s << "Illegal attempt to invoke the synthetic method \""
  4486.             << err.insert1
  4487.             << "\" contained in class \"";
  4488.     if (NotDot(err.insert2))
  4489.     {
  4490.         s << err.insert2
  4491.                 << "/";
  4492.     }
  4493.     s << err.insert3
  4494.             << "\".";
  4495.  
  4496.     return s.Array();
  4497. }
  4498.  
  4499.  
  4500. wchar_t *SemanticError::PrintSYNTHETIC_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4501. {
  4502.     ErrorString s;
  4503.  
  4504.     s << "Illegal attempt to invoke the synthetic constructor \""
  4505.             << err.insert1
  4506.             << "\" from class \"";
  4507.     if (NotDot(err.insert2))
  4508.     {
  4509.         s << err.insert2
  4510.                 << "/";
  4511.     }
  4512.     s << err.insert3
  4513.             << "\".";
  4514.  
  4515.     return s.Array();
  4516. }
  4517.  
  4518.  
  4519. wchar_t *SemanticError::PrintTHIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4520. {
  4521.     ErrorString s;
  4522.     
  4523.     s << "The expression \""
  4524.             << err.insert1
  4525.             << "\" may not be used in an explicit constructor invocation.";
  4526.  
  4527.     return s.Array();
  4528. }
  4529.  
  4530.  
  4531. wchar_t *SemanticError::PrintSUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4532. {
  4533.     ErrorString s;
  4534.     
  4535.     s << "The expression \""
  4536.             << err.insert1
  4537.             << "\" may not be used in an explicit constructor invocation.";
  4538.  
  4539.     return s.Array();
  4540. }
  4541.  
  4542.  
  4543. wchar_t *SemanticError::PrintINNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4544. {
  4545.     ErrorString s;
  4546.  
  4547.     s << "The constructor for class \"";
  4548.     if (NotDot(err.insert1))
  4549.     {
  4550.         s << err.insert1
  4551.                 << "/";
  4552.     }
  4553.     s << err.insert2
  4554.             << "\" is not accessible from an explicit constructor invocation in the immediately enclosing class \"";
  4555.     if (NotDot(err.insert3))
  4556.     {
  4557.         s << err.insert3
  4558.                 << "/";
  4559.     }
  4560.     s << err.insert4
  4561.             << "\".";
  4562.  
  4563.     return s.Array();
  4564. }
  4565.  
  4566.  
  4567. wchar_t *SemanticError::PrintEXPRESSION_NOT_CONSTANT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4568. {
  4569.     ErrorString s;
  4570.     
  4571.     s << "A constant expression is expected in this context.";
  4572.  
  4573.     return s.Array();
  4574. }
  4575.  
  4576.  
  4577. wchar_t *SemanticError::PrintUNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4578. {
  4579.     ErrorString s;
  4580.  
  4581.     s << "The method \""
  4582.             << err.insert1
  4583.             << "\" can throw the checked exception \"";
  4584.     if (NotDot(err.insert2))
  4585.     {
  4586.         s << err.insert2
  4587.                 << "/";
  4588.     }
  4589.     s << err.insert3
  4590.             << "\", but its invocation is neither enclosed in a try statement that can catch "
  4591.                "that exception nor in the body of a method or constructor that \"throws\" that exception.";
  4592.  
  4593.     return s.Array();
  4594. }
  4595.  
  4596.  
  4597. wchar_t *SemanticError::PrintUNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4598. {
  4599.     ErrorString s;
  4600.  
  4601.     s << "The constructor \""
  4602.             << err.insert1
  4603.             << "\" can throw the checked exception \"";
  4604.     if (NotDot(err.insert2))
  4605.     {
  4606.         s << err.insert2
  4607.                 << "/";
  4608.     }
  4609.     s << err.insert3
  4610.             << "\", but its invocation is neither enclosed in a try statement that can catch "
  4611.                "that exception nor in the body of a method or constructor that \"throws\" that exception.";
  4612.  
  4613.     return s.Array();
  4614. }
  4615.  
  4616.  
  4617. wchar_t *SemanticError::PrintUNREACHABLE_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4618. {
  4619.     ErrorString s;
  4620.  
  4621.     s << "This catch block may be unreachable because there is no exception "
  4622.                "whose type is assignable to \"";
  4623.     if (NotDot(err.insert1))
  4624.     {
  4625.         s << err.insert1
  4626.                 << "/";
  4627.     }
  4628.     s << err.insert2
  4629.             << "\" that can be thrown during execution of the body of the try block.";
  4630.  
  4631.     return s.Array();
  4632. }
  4633.  
  4634.  
  4635. wchar_t *SemanticError::PrintUNREACHABLE_DEFAULT_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4636. {
  4637.     ErrorString s;
  4638.  
  4639.     s << "This try block cannot throw a \"checked exception\" (JLS section 14.7) that can be caught here. You may have intended to catch a RuntimeException instead of an Exception.";
  4640.  
  4641.     return s.Array();
  4642. }
  4643.  
  4644.  
  4645. wchar_t *SemanticError::PrintUNREACHABLE_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4646. {
  4647.     ErrorString s;
  4648.     
  4649.     s << "This statement is unreachable.";
  4650.  
  4651.     return s.Array();
  4652. }
  4653.  
  4654.  
  4655. wchar_t *SemanticError::PrintUNREACHABLE_STATEMENTS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4656. {
  4657.     ErrorString s;
  4658.     
  4659.     s << "These statements are unreachable.";
  4660.  
  4661.     return s.Array();
  4662. }
  4663.  
  4664.  
  4665. wchar_t *SemanticError::PrintUNREACHABLE_CONSTRUCTOR_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4666. {
  4667.     ErrorString s;
  4668.     
  4669.     s << "The body of this constructor is unreachable because the last initializer block "
  4670.                "in this class does not complete normally.";
  4671.  
  4672.     return s.Array();
  4673. }
  4674.  
  4675.  
  4676. wchar_t *SemanticError::PrintBLOCKED_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4677. {
  4678.     ErrorString s;
  4679.  
  4680.     s << "This catch block is unreachable: the exception \"";
  4681.     if (NotDot(err.insert1))
  4682.     {
  4683.         s << err.insert1
  4684.                 << "/";
  4685.     }
  4686.     s << err.insert2
  4687.             << "\" was used in a previous catch clause in this try statement at location "
  4688.             << err.insert3
  4689.             << '.';
  4690.  
  4691.     return s.Array();
  4692. }
  4693.  
  4694.  
  4695. wchar_t *SemanticError::PrintVARIABLE_NOT_DEFINITELY_ASSIGNED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4696. {
  4697.     ErrorString s;
  4698.     
  4699.     s << "The variable \""
  4700.             << err.insert1
  4701.             << "\" may be accessed here before having been definitely assigned a value.";
  4702.  
  4703.     return s.Array();
  4704. }
  4705.  
  4706.  
  4707. wchar_t *SemanticError::PrintTYPED_METHOD_WITH_NO_RETURN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4708. {
  4709.     ErrorString s;
  4710.     
  4711.     s << "The method \""
  4712.             << err.insert1
  4713.             << "\" must contain a return statement with an expression compatible with type \""
  4714.             << err.insert2
  4715.             << "\".";
  4716.  
  4717.     return s.Array();
  4718. }
  4719.  
  4720.  
  4721. wchar_t *SemanticError::PrintDEFAULT_METHOD_NOT_OVERRIDDEN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4722. {
  4723.     ErrorString s;
  4724.  
  4725.     s << "Method \""
  4726.             << err.insert1
  4727.             << "\" in class \"";
  4728.     if (NotDot(err.insert2))
  4729.     {
  4730.         s << err.insert2
  4731.                 << "/";
  4732.     }
  4733.     s << err.insert3
  4734.             << "\" does not override the corresponding method with default access in class \"";
  4735.     if (NotDot(err.insert4))
  4736.     {
  4737.         s << err.insert4
  4738.                 << "/";
  4739.     }
  4740.     s << err.insert5
  4741.             << "\".";
  4742.  
  4743.     return s.Array();
  4744. }
  4745.  
  4746.  
  4747. wchar_t *SemanticError::PrintTYPE_NOT_IN_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4748. {
  4749.     ErrorString s;
  4750.     
  4751.     s << "The file \""
  4752.             << err.insert1
  4753.             << ".class\" was found in directory \""
  4754.             << err.insert2
  4755.             << "\" specified in the CLASSPATH. However, that class file specifies a type associated with the named package \""
  4756.             << err.insert3
  4757.             << "\" instead of the unnamed package.";
  4758.  
  4759.     return s.Array();
  4760. }
  4761.  
  4762.  
  4763. wchar_t *SemanticError::PrintTYPE_IN_WRONG_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4764. {
  4765.     ErrorString s;
  4766.  
  4767.     s << "The type \""
  4768.             << err.insert1
  4769.             << "\" was found in package \""
  4770.             << err.insert2
  4771.             << "\". However, that type is associated with ";
  4772.     if (wcslen(err.insert3) == 0)
  4773.         s << "the unnamed package";
  4774.     else
  4775.     {
  4776.         s << "another named package, \""
  4777.                 << err.insert3
  4778.                 << "\"";
  4779.     }
  4780.     s << '.';
  4781.  
  4782.     return s.Array();
  4783. }
  4784.  
  4785.  
  4786. wchar_t *SemanticError::PrintTYPE_NAME_MISMATCH(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4787. {
  4788.     ErrorString s;
  4789.  
  4790.     s << "The name of the type specified, \"";
  4791.     if (NotDot(err.insert1))
  4792.     {
  4793.         s << err.insert1
  4794.                 << "/";
  4795.     }
  4796.     s << err.insert2
  4797.             << "\", does not match the name found in the class file: \""
  4798.             << err.insert3
  4799.             << "\".";
  4800.  
  4801.     return s.Array();
  4802. }
  4803.  
  4804.  
  4805. wchar_t *SemanticError::PrintDEPRECATED_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4806. {
  4807.     ErrorString s;
  4808.  
  4809.     s << "The type \"";
  4810.     if (NotDot(err.insert1))
  4811.     {
  4812.         s << err.insert1
  4813.                 << "/";
  4814.     }
  4815.     s << err.insert2
  4816.             << "\" has been deprecated.";
  4817.  
  4818.     return s.Array();
  4819. }
  4820.  
  4821.  
  4822. wchar_t *SemanticError::PrintDEPRECATED_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4823. {
  4824.     ErrorString s;
  4825.  
  4826.     s << "The variable \""
  4827.             << err.insert1
  4828.             << "\" declared in type \"";
  4829.     if (NotDot(err.insert2))
  4830.     {
  4831.         s << err.insert2
  4832.                 << "/";
  4833.     }
  4834.     s << err.insert3
  4835.             << "\" has been deprecated.";
  4836.  
  4837.     return s.Array();
  4838. }
  4839.  
  4840.  
  4841. wchar_t *SemanticError::PrintDEPRECATED_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4842. {
  4843.     ErrorString s;
  4844.  
  4845.     s << "The method \""
  4846.             << err.insert1
  4847.             << "\" declared in type \"";
  4848.     if (NotDot(err.insert2))
  4849.     {
  4850.         s << err.insert2
  4851.                 << "/";
  4852.     }
  4853.     s << err.insert3
  4854.             << "\" has been deprecated.";
  4855.  
  4856.     return s.Array();
  4857. }
  4858.  
  4859.  
  4860. wchar_t *SemanticError::PrintDEPRECATED_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4861. {
  4862.     ErrorString s;
  4863.  
  4864.     s << "The constructor \""
  4865.             << err.insert1
  4866.             << "\" declared in type \"";
  4867.     if (NotDot(err.insert2))
  4868.     {
  4869.         s << err.insert2
  4870.                 << "/";
  4871.     }
  4872.     s << err.insert3
  4873.             << "\" has been deprecated.";
  4874.  
  4875.     return s.Array();
  4876. }
  4877.  
  4878.  
  4879. wchar_t *SemanticError::PrintONE_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4880. {
  4881.     ErrorString s;
  4882.     
  4883.     s << "The type \""
  4884.             << err.insert1
  4885.             << "\" was found in directory \""
  4886.             << err.insert2
  4887.             << "\" specified in the CLASSPATH. It is accessible here only because, by default, this compiler uses "
  4888.                "one unnamed package. In a compiler that associates an unnamed package with each directory "
  4889.                "(as this compiler does with the +P option) this access would be illegal.";
  4890.  
  4891.     return s.Array();
  4892. }
  4893.  
  4894.  
  4895.  
  4896. wchar_t *SemanticError::PrintCOMPRESSED_ZIP_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4897. {
  4898.     ErrorString s;
  4899.     
  4900.     s << "The file "
  4901.             << err.insert1
  4902.             << "("
  4903.             << err.insert2
  4904.             << "/"
  4905.             << err.insert3
  4906.             << ") is in an unsupported compressed format. (Unzip and) Rezip \""
  4907.             << err.insert1
  4908.             << "\".";
  4909.  
  4910.     return s.Array();
  4911. }
  4912.  
  4913.  
  4914. wchar_t *SemanticError::PrintINVALID_CLASS_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4915. {
  4916.     ErrorString s;
  4917.  
  4918.     s << "The class file \"";
  4919.     if (NotDot(err.insert1))
  4920.     {
  4921.         s << err.insert1
  4922.                 << "/";
  4923.     }
  4924.     s << err.insert2
  4925.             << ".class\" has an invalid format.";
  4926.  
  4927.     return s.Array();
  4928. }
  4929.  
  4930.  
  4931. wchar_t *SemanticError::PrintCANNOT_OPEN_CLASS_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4932. {
  4933.     ErrorString s;
  4934.  
  4935.     s << "Unable to open file associated with type \"";
  4936.     if (NotDot(err.insert1))
  4937.     {
  4938.         s << err.insert1
  4939.                 << "/";
  4940.     }
  4941.     s << err.insert2
  4942.             << "\".";
  4943.  
  4944.     return s.Array();
  4945. }
  4946.  
  4947.  
  4948. wchar_t *SemanticError::PrintINTERFACE_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4949. {
  4950.     ErrorString s;
  4951.  
  4952.     s << "The interface \"";
  4953.     if (NotDot(err.insert1))
  4954.     {
  4955.         s << err.insert1
  4956.                 << "/";
  4957.     }
  4958.     s << err.insert2
  4959.             << "\" is not an inner class.";
  4960.  
  4961.     return s.Array();
  4962. }
  4963.  
  4964.  
  4965. wchar_t *SemanticError::PrintSTATIC_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4966. {
  4967.     ErrorString s;
  4968.  
  4969.     s << "The static class \"";
  4970.     if (NotDot(err.insert1))
  4971.     {
  4972.         s << err.insert1
  4973.                 << "/";
  4974.     }
  4975.     s << err.insert2
  4976.             << "\" is not an inner class.";
  4977.  
  4978.     return s.Array();
  4979. }
  4980.  
  4981.  
  4982. wchar_t *SemanticError::PrintTYPE_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4983. {
  4984.     ErrorString s;
  4985.  
  4986.     s << "The type \"";
  4987.     if (NotDot(err.insert1))
  4988.     {
  4989.         s << err.insert1
  4990.                 << "/";
  4991.     }
  4992.     s << err.insert2
  4993.             << "\", is not an inner class that is immediately enclosed in type \"";
  4994.     if (NotDot(err.insert3))
  4995.     {
  4996.         s << err.insert3
  4997.                 << "/";
  4998.     }
  4999.     s << err.insert4
  5000.             << "\".";
  5001.  
  5002.     return s.Array();
  5003. }
  5004.  
  5005.  
  5006. wchar_t *SemanticError::PrintSUPER_TYPE_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5007. {
  5008.     ErrorString s;
  5009.  
  5010.     s << "The super type \"";
  5011.     if (NotDot(err.insert1))
  5012.     {
  5013.         s << err.insert1
  5014.                 << "/";
  5015.     }
  5016.     s << err.insert2
  5017.             << "\" of this type, \"";
  5018.     if (NotDot(err.insert3))
  5019.     {
  5020.         s << err.insert3
  5021.                 << "/";
  5022.     }
  5023.     s << err.insert4
  5024.             << "\", is not an inner class that is immediately enclosed in type \"";
  5025.     if (NotDot(err.insert5))
  5026.     {
  5027.         s << err.insert5
  5028.                 << "/";
  5029.     }
  5030.     s << err.insert6
  5031.             << "\".";
  5032.  
  5033.     return s.Array();
  5034. }
  5035.  
  5036.  
  5037. wchar_t *SemanticError::PrintSTATIC_FIELD_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5038. {
  5039.     ErrorString s;
  5040.     
  5041.     s << "An inner class may not contain a static field that is not final.";
  5042.  
  5043.     return s.Array();
  5044. }
  5045.  
  5046.  
  5047. wchar_t *SemanticError::PrintSTATIC_METHOD_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5048. {
  5049.     ErrorString s;
  5050.     
  5051.     s << "Inner class may not contain static method.";
  5052.  
  5053.     return s.Array();
  5054. }
  5055.  
  5056.  
  5057. wchar_t *SemanticError::PrintSTATIC_TYPE_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5058. {
  5059.     ErrorString s;
  5060.     
  5061.     s << "The static type \""
  5062.             << err.insert1
  5063.             << "\" is enclosed in an inner class, \""
  5064.             << err.insert2
  5065.             << "\", located at "
  5066.             << err.insert3
  5067.             << '.';
  5068.  
  5069.     return s.Array();
  5070. }
  5071.  
  5072.  
  5073. wchar_t *SemanticError::PrintSTATIC_INITIALIZER_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5074. {
  5075.     ErrorString s;
  5076.     
  5077.     s << "This static initializer is enclosed in an inner class, \""
  5078.             << err.insert1
  5079.             << "\", located at "
  5080.             << err.insert2
  5081.             << '.';
  5082.  
  5083.     return s.Array();
  5084. }
  5085.  
  5086.  
  5087.  
  5088. wchar_t *SemanticError::PrintINNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5089. {
  5090.     ErrorString s;
  5091.  
  5092.     s << "Invalid reference in inner class \"";
  5093.     if (NotDot(err.insert1))
  5094.     {
  5095.         s << err.insert1
  5096.                 << "/";
  5097.     }
  5098.     s << err.insert2
  5099.             << "\" to a non-final local variable, \""
  5100.             << err.insert3
  5101.             << "\", declared in method \""
  5102.             << err.insert4
  5103.             << "\".";
  5104.  
  5105.     return s.Array();
  5106. }
  5107.  
  5108.  
  5109. wchar_t *SemanticError::PrintSTATIC_PROTECTED_FIELD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5110. {
  5111.     ErrorString s;
  5112.  
  5113.     s << "The field \""
  5114.             << err.insert1
  5115.             << "\" in type \"";
  5116.     if (NotDot(err.insert2))
  5117.     {
  5118.         s << err.insert2
  5119.                 << '/';
  5120.     }
  5121.     s << err.insert3
  5122.             << "\" is a protected field contained in a different package than this one. "
  5123.                "Therefore, even though it may be accessible here as a simple name (if it is not hidden), "
  5124.                "it is not accessible via a field access.";
  5125.  
  5126.     return s.Array();
  5127. }
  5128.  
  5129.  
  5130. wchar_t *SemanticError::PrintSTATIC_PROTECTED_METHOD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5131. {
  5132.     ErrorString s;
  5133.  
  5134.     s << "The method \""
  5135.             << err.insert1
  5136.             << "\" in type \"";
  5137.     if (NotDot(err.insert2))
  5138.     {
  5139.         s << err.insert2
  5140.                 << '/';
  5141.     }
  5142.     s << err.insert3
  5143.             << "\" is a protected method contained in a different package than this one. "
  5144.                "Therefore, even though it may be accessible here as a simple name (if it is not hidden), "
  5145.                "it is not accessible via a field access.";
  5146.  
  5147.     return s.Array();
  5148. }
  5149.  
  5150.  
  5151. wchar_t *SemanticError::PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5152. {
  5153.     ErrorString s;
  5154.  
  5155.     s << "Ambiguous reference to field \""
  5156.             << err.insert1
  5157.             << "\" declared in (or inherited from) type \"";
  5158.     if (NotDot(err.insert2))
  5159.     {
  5160.         s << err.insert2
  5161.                 << "/";
  5162.     }
  5163.     s << err.insert3
  5164.             << "\" but also declared in the enclosing method \""
  5165.             << err.insert4
  5166.             << "\". Explicit qualification is required.";
  5167.  
  5168.     return s.Array();
  5169. }
  5170.  
  5171. wchar_t *SemanticError::PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5172. {
  5173.     ErrorString s;
  5174.  
  5175.     s << "Ambiguous reference to member named \""
  5176.             << err.insert1
  5177.             << "\" inherited from type \"";
  5178.     if (NotDot(err.insert2))
  5179.     {
  5180.         s << err.insert2
  5181.                 << "/";
  5182.     }
  5183.     s << err.insert3
  5184.             << "\" but also declared or inherited in the enclosing type \"";
  5185.     if (NotDot(err.insert4))
  5186.     {
  5187.         s << err.insert4
  5188.                 << "/";
  5189.     }
  5190.     s << err.insert5
  5191.             << "\". Explicit qualification is required.";
  5192.  
  5193.     return s.Array();
  5194. }
  5195.  
  5196.  
  5197. wchar_t *SemanticError::PrintILLEGAL_THIS_FIELD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5198. {
  5199.     ErrorString s;
  5200.  
  5201.     s << "The type \"";
  5202.     if (NotDot(err.insert1))
  5203.     {
  5204.         s << err.insert1
  5205.                 << "/";
  5206.     }
  5207.     s << err.insert2
  5208.             << "\" is either not an outer type of type \"";
  5209.     if (NotDot(err.insert3))
  5210.     {
  5211.         s << err.insert3
  5212.                 << "/";
  5213.     }
  5214.     s << err.insert4
  5215.             << "\" or it is not accessible because this expression appears in a static region.";
  5216.  
  5217.     return s.Array();
  5218. }
  5219.  
  5220.  
  5221. wchar_t *SemanticError::PrintENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5222. {
  5223.     ErrorString s;
  5224.  
  5225.     s << "An instance of \"";
  5226.     if (NotDot(err.insert1))
  5227.     {
  5228.         s << err.insert1
  5229.                 << "/";
  5230.     }
  5231.     s << err.insert2
  5232.             << StringConstant::US__DO
  5233.             << StringConstant::US_this
  5234.             << "\" is not accessible from an explicit constructor invocation.";
  5235.  
  5236.     return s.Array();
  5237. }
  5238.  
  5239.  
  5240. wchar_t *SemanticError::PrintENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5241. {
  5242.     ErrorString s;
  5243.  
  5244.     s << "An instance of \"";
  5245.     if (NotDot(err.insert1))
  5246.     {
  5247.         s << err.insert1
  5248.                 << "/";
  5249.     }
  5250.     s << err.insert2
  5251.             << StringConstant::US__DO
  5252.             << StringConstant::US_this
  5253.             << "\" is not accessible here because it would have to cross a static region in the intervening type \"";
  5254.     if (NotDot(err.insert3))
  5255.     {
  5256.         s << err.insert3
  5257.                 << "/";
  5258.     }
  5259.     s << err.insert4
  5260.             << "\".";
  5261.  
  5262.     return s.Array();
  5263. }
  5264.  
  5265.  
  5266. wchar_t *SemanticError::PrintENCLOSING_INSTANCE_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5267. {
  5268.     ErrorString s;
  5269.  
  5270.     s << "An instance of \"";
  5271.     if (NotDot(err.insert1))
  5272.     {
  5273.         s << err.insert1
  5274.                 << "/";
  5275.     }
  5276.     s << err.insert2
  5277.             << StringConstant::US__DO
  5278.             << StringConstant::US_this
  5279.             << "\" is not accessible here"
  5280.             << ". In general, an enclosing instance is accessible only in the body of an instance method, "
  5281.                "constructor (after the explicit constructor invocation, if any), "
  5282.                "initializer block, or in the initializer expression of an instance variable.";
  5283.  
  5284.     return s.Array();
  5285. }
  5286.  
  5287.  
  5288. wchar_t *SemanticError::PrintZERO_DIVIDE_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5289. {
  5290.     ErrorString s;
  5291.     
  5292.     s << "Attempt to divide by zero.";
  5293.  
  5294.     return s.Array();
  5295. }
  5296.  
  5297.  
  5298. wchar_t *SemanticError::PrintZERO_DIVIDE_CAUTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5299. {
  5300.     ErrorString s;
  5301.     
  5302.     s << "Attempt to divide by zero.";
  5303.  
  5304.     return s.Array();
  5305. }
  5306.  
  5307.  
  5308. wchar_t *SemanticError::PrintVOID_TO_STRING(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5309. {
  5310.     ErrorString s;
  5311.     
  5312.     s << "Attempt to convert an expression of type void into a String.";
  5313.  
  5314.     return s.Array();
  5315. }
  5316.  
  5317.  
  5318. wchar_t *SemanticError::PrintINVALID_ENCLOSING_INSTANCE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5319. {
  5320.     ErrorString s;
  5321.  
  5322.     s << "The super type of this type, \"";
  5323.     if (NotDot(err.insert1))
  5324.     {
  5325.         s << err.insert1
  5326.                 << "/";
  5327.     }
  5328.     s << err.insert2
  5329.             << "\", is immediately enclosed in type \"";
  5330.     if (NotDot(err.insert3))
  5331.     {
  5332.         s << err.insert3
  5333.                 << "/";
  5334.     }
  5335.     s << err.insert4
  5336.             << "\" which does not match the type of this primary expression, \"";
  5337.     if (NotDot(err.insert5))
  5338.     {
  5339.         s << err.insert5
  5340.                 << "/";
  5341.     }
  5342.     s << err.insert6
  5343.             << "\".";
  5344.  
  5345.     return s.Array();
  5346. }
  5347.  
  5348.  
  5349. wchar_t *SemanticError::PrintCONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  5350. {
  5351.     ErrorString s;
  5352.     
  5353.     s << "An anonymous class cannot have a constructor.";
  5354.  
  5355.     return s.Array();
  5356. }
  5357.  
  5358. #ifdef    HAVE_JIKES_NAMESPACE
  5359. }            // Close namespace Jikes block
  5360. #endif
  5361.  
  5362.