From e387c23b608434c10fd46a758958186dcc3c4c6a Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 28 Jan 2020 15:16:41 +0100 Subject: [PATCH] Slightly simplify error message rebuilding This removes some duplicate code for with and without column number by building the column number string separately first. --- arduino-core/src/cc/arduino/Compiler.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java index 1663bbd9f..608bf23b0 100644 --- a/arduino-core/src/cc/arduino/Compiler.java +++ b/arduino-core/src/cc/arduino/Compiler.java @@ -582,11 +582,8 @@ public class Compiler implements MessageConsumer { String fileName = ex.getCodeFile().getPrettyName(); int lineNum = ex.getCodeLine() + 1; int colNum = ex.getCodeColumn(); - if (colNum != -1) { - s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg; - } else { - s = fileName + ":" + lineNum + ": error: " + error + msg; - } + String column = (colNum != -1) ? (":" + colNum) : ""; + s = fileName + ":" + lineNum + column + ": error: " + error + msg; } if (ex != null) {