Skip to content

Commit e454acb

Browse files
committed
Remove obsolete compilation error interpretations
The Arduino IDE attempts to provide some additional guidance to users based on matches against compilation error messages. This practice was established during a time when some significant breaking changes were made to the common APIs in order to ease the transition. Since that time, the practice has mostly been discontinued. The interpretations are only valid for very old code that is unlikely to be used by the target users now. So their benefit is negligible. The patterns used are inexact, meaning that the interpretations may be printed inappropriately, which is more and more likely as the cases where the matches would be valid become increasingly rare. When the maintenance burden is taken into consideration, it is clear that the harm is far more than any benefits from these. So they are removed. Notes for specific interpretations: > Please import the SPI library from the Sketch > Import Library menu. > As of Arduino 0019, the Ethernet library depends on the SPI library. > You appear to be using it or another library that depends on the SPI library. The target error was more common prior to Arduino IDE 1.6.6 (released ~6.5 years ago), when it was necessary for the sketch to contain `#include` directives for transitive in addition to direct library dependencies (SPI is a common transitive dependency). Due to the nature of the SPI library, it is not often used directly, and when it is used directly it is done by more advanced users who are unlikely to forget the `#include` directive and would have no need for this interpretation even if they did. It is far more likely for the user to forget an `#include` for a popular library, yet Arduino rightly does not attempt to maintain interpretations for those. The "Sketch > Import Library" menu path was renamed to "Sketch > Include Library" ~7 years ago. Arduino IDE 0019 was released ~12 years ago. We can safely assume the migration to the new Ethernet API is complete. > The 'BYTE' keyword is no longer supported. > As of Arduino 1.0, the 'BYTE' keyword is no longer supported. > Please use Serial.write() instead. Arduino IDE 1.0 was released ~10.5 years ago. We can safely assume the migration to the new Serial API is complete. This compilation error pattern is now far more likely to occur due to incorrect usage of a completely unrelated occurrence of the common `BYTE` name in the user's code. > The Server class has been renamed EthernetServer. > As of Arduino 1.0, the Server class in the Ethernet library has been renamed to EthernetServer. > The Client class has been renamed EthernetClient. > As of Arduino 1.0, the Client class in the Ethernet library has been renamed to EthernetClient. > The Udp class has been renamed EthernetUdp. > As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp. Arduino IDE 1.0 was released ~10.5 years ago. We can safely assume the migration to the new Ethernet API is complete. The compilation error patterns are in no way specific to the Ethernet library so is prone to false positives. > Wire.send() has been renamed Wire.write(). > As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries. > Wire.receive() has been renamed Wire.read(). > As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries. Arduino IDE 1.0 was released ~10.5 years ago. We can safely assume the migration to the new Wire API is complete. Due to the nature of the Wire library, it is not often used directly, and when it is used directly it is done by more advanced users who have less need for an interpretation of the compiler error. > 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'? > 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'? I left these in because they are the most "recent" (added due to a breaking change made 7 years ago). However, I also feel that these are harmful and should either be removed or changed. The problem is that there is a false match when the user attempts to compile the Keyboard or Mouse libraries for a board which does not have native USB support (e.g., Uno, Mega), even when their sketch does contain the `#include` directives that are recommended by the interpretation. That cause of the compilation error matching the pattern is more common than the case where the user is compiling old code or forgot the `#include` directive, for which the interpretation is valid.
1 parent 75abb70 commit e454acb

File tree

2 files changed

+1
-85
lines changed

2 files changed

+1
-85
lines changed

Diff for: arduino-ide-extension/src/node/cli-error-parser.ts

-70
Original file line numberDiff line numberDiff line change
@@ -149,76 +149,6 @@ function remapErrorMessages(result: ParseResult): ParseResult {
149149

150150
// Based on the Java IDE: https://github.com/arduino/Arduino/blob/43b0818f7fa8073301db1b80ac832b7b7596b828/arduino-core/src/cc/arduino/Compiler.java#L528-L578
151151
const KnownErrors: Record<string, { error: string; message?: string }> = {
152-
'SPI.h: No such file or directory': {
153-
error: nls.localize(
154-
'arduino/cli-error-parser/spiError',
155-
'Please import the SPI library from the Sketch > Import Library menu.'
156-
),
157-
message: nls.localize(
158-
'arduino/cli-error-parser/spiMessage',
159-
'As of Arduino 0019, the Ethernet library depends on the SPI library.\nYou appear to be using it or another library that depends on the SPI library.'
160-
),
161-
},
162-
"'BYTE' was not declared in this scope": {
163-
error: nls.localize(
164-
'arduino/cli-error-parser/byteError',
165-
"The 'BYTE' keyword is no longer supported."
166-
),
167-
message: nls.localize(
168-
'arduino/cli-error-parser/byteMessage',
169-
"As of Arduino 1.0, the 'BYTE' keyword is no longer supported.\nPlease use Serial.write() instead."
170-
),
171-
},
172-
"no matching function for call to 'Server::Server(int)'": {
173-
error: nls.localize(
174-
'arduino/cli-error-parser/serverError',
175-
'The Server class has been renamed EthernetServer.'
176-
),
177-
message: nls.localize(
178-
'arduino/cli-error-parser/serverMessage',
179-
'As of Arduino 1.0, the Server class in the Ethernet library has been renamed to EthernetServer.'
180-
),
181-
},
182-
"no matching function for call to 'Client::Client(byte [4], int)'": {
183-
error: nls.localize(
184-
'arduino/cli-error-parser/clientError',
185-
'The Client class has been renamed EthernetClient.'
186-
),
187-
message: nls.localize(
188-
'arduino/cli-error-parser/clientMessage',
189-
'As of Arduino 1.0, the Client class in the Ethernet library has been renamed to EthernetClient.'
190-
),
191-
},
192-
"'Udp' was not declared in this scope": {
193-
error: nls.localize(
194-
'arduino/cli-error-parser/udpError',
195-
'The Udp class has been renamed EthernetUdp.'
196-
),
197-
message: nls.localize(
198-
'arduino/cli-error-parser/udpMessage',
199-
'As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.'
200-
),
201-
},
202-
"'class TwoWire' has no member named 'send'": {
203-
error: nls.localize(
204-
'arduino/cli-error-parser/sendError',
205-
'Wire.send() has been renamed Wire.write().'
206-
),
207-
message: nls.localize(
208-
'arduino/cli-error-parser/sendMessage',
209-
'As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.'
210-
),
211-
},
212-
"'class TwoWire' has no member named 'receive'": {
213-
error: nls.localize(
214-
'arduino/cli-error-parser/receiveError',
215-
'Wire.receive() has been renamed Wire.read().'
216-
),
217-
message: nls.localize(
218-
'arduino/cli-error-parser/receiveMessage',
219-
'As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.'
220-
),
221-
},
222152
"'Mouse' was not declared in this scope": {
223153
error: nls.localize(
224154
'arduino/cli-error-parser/mouseError',

Diff for: i18n/en.json

+1-15
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,8 @@
5757
"uploadingCertificates": "Uploading certificates."
5858
},
5959
"cli-error-parser": {
60-
"byteError": "The 'BYTE' keyword is no longer supported.",
61-
"byteMessage": "As of Arduino 1.0, the 'BYTE' keyword is no longer supported.\nPlease use Serial.write() instead.",
62-
"clientError": "The Client class has been renamed EthernetClient.",
63-
"clientMessage": "As of Arduino 1.0, the Client class in the Ethernet library has been renamed to EthernetClient.",
6460
"keyboardError": "'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?",
65-
"mouseError": "'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?",
66-
"receiveError": "Wire.receive() has been renamed Wire.read().",
67-
"receiveMessage": "As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.",
68-
"sendError": "Wire.send() has been renamed Wire.write().",
69-
"sendMessage": "As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.",
70-
"serverError": "The Server class has been renamed EthernetServer.",
71-
"serverMessage": "As of Arduino 1.0, the Server class in the Ethernet library has been renamed to EthernetServer.",
72-
"spiError": "Please import the SPI library from the Sketch > Import Library menu.",
73-
"spiMessage": "As of Arduino 0019, the Ethernet library depends on the SPI library.\nYou appear to be using it or another library that depends on the SPI library.",
74-
"udpError": "The Udp class has been renamed EthernetUdp.",
75-
"udpMessage": "As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp."
61+
"mouseError": "'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?"
7662
},
7763
"cloud": {
7864
"account": "Account",

0 commit comments

Comments
 (0)