MCPcopy
hub / github.com/arduino/Arduino / message

Method message

arduino-core/src/cc/arduino/Compiler.java:505–611  ·  view source on GitHub ↗

Part of the MessageConsumer interface, this is called whenever a piece (usually a line) of error message is spewed out from the compiler. The errors are parsed for their contents and line number, which is then reported back to Editor.

(String s)

Source from the content-addressed store, hash-verified

503 * and line number, which is then reported back to Editor.
504 */
505 @Override
506 public void message(String s) {
507 int i;
508
509 if (!verbose) {
510 while ((i = s.indexOf(buildPath + File.separator)) != -1) {
511 s = s.substring(0, i) + s.substring(i + (buildPath + File.separator).length());
512 }
513 }
514
515 String[] pieces = PApplet.match(s, ERROR_FORMAT);
516
517 if (pieces != null) {
518 String msg = "";
519 String filename = pieces[1];
520 int line = PApplet.parseInt(pieces[2]);
521 int col = -1;
522 if (pieces[3] != null) {
523 col = PApplet.parseInt(pieces[3].substring(1));
524 }
525 String errorPrefix = pieces[4];
526 String error = pieces[6];
527
528 if (error.trim().equals("SPI.h: No such file or directory")) {
529 error = tr("Please import the SPI library from the Sketch > Import Library menu.");
530 msg = tr("\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
531 "\nYou appear to be using it or another library that depends on the SPI library.\n\n");
532 }
533
534 if (error.trim().equals("'BYTE' was not declared in this scope")) {
535 error = tr("The 'BYTE' keyword is no longer supported.");
536 msg = tr("\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
537 "\nPlease use Serial.write() instead.\n\n");
538 }
539
540 if (error.trim().equals("no matching function for call to 'Server::Server(int)'")) {
541 error = tr("The Server class has been renamed EthernetServer.");
542 msg = tr("\nAs of Arduino 1.0, the Server class in the Ethernet library " +
543 "has been renamed to EthernetServer.\n\n");
544 }
545
546 if (error.trim().equals("no matching function for call to 'Client::Client(byte [4], int)'")) {
547 error = tr("The Client class has been renamed EthernetClient.");
548 msg = tr("\nAs of Arduino 1.0, the Client class in the Ethernet library " +
549 "has been renamed to EthernetClient.\n\n");
550 }
551
552 if (error.trim().equals("'Udp' was not declared in this scope")) {
553 error = tr("The Udp class has been renamed EthernetUdp.");
554 msg = tr("\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
555 "has been renamed to EthernetUdp.\n\n");
556 }
557
558 if (error.trim().equals("'class TwoWire' has no member named 'send'")) {
559 error = tr("Wire.send() has been renamed Wire.write().");
560 msg = tr("\nAs of Arduino 1.0, the Wire.send() function was renamed " +
561 "to Wire.write() for consistency with other libraries.\n\n");
562 }

Callers

nothing calls this directly

Calls 12

matchMethod · 0.95
parseIntMethod · 0.95
placeExceptionMethod · 0.95
getCodeFileMethod · 0.95
getCodeLineMethod · 0.95
getCodeColumnMethod · 0.95
getMessageMethod · 0.95
trMethod · 0.80
getPrettyNameMethod · 0.80
hideStackTraceMethod · 0.80
equalsMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected