From bad93ae677622c79883f658a53484d455e36ce9a Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 19 Aug 2013 23:50:57 +0200 Subject: Only look at the line number for errors and warnings. --- test/core/src/lombok/CompilerMessageMatcher.java | 14 +++++--------- test/core/src/lombok/RunTestsViaEcj.java | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'test/core') diff --git a/test/core/src/lombok/CompilerMessageMatcher.java b/test/core/src/lombok/CompilerMessageMatcher.java index af12e199..db288749 100644 --- a/test/core/src/lombok/CompilerMessageMatcher.java +++ b/test/core/src/lombok/CompilerMessageMatcher.java @@ -38,30 +38,26 @@ public class CompilerMessageMatcher { /** Line Number (starting at 1) */ private final long line; - /** Position is either column number, OR position in file starting from the first byte. */ - private final long position; private final Collection messageParts; - public CompilerMessageMatcher(long line, long position, String message) { + public CompilerMessageMatcher(long line, String message) { this.line = line; - this.position = position; this.messageParts = Arrays.asList(message.split("\\s+")); } public static CompilerMessageMatcher asCompilerMessageMatcher(CompilerMessage message) { - return new CompilerMessageMatcher(message.getLine(), message.getColumnOrPosition(), message.getMessage()); + return new CompilerMessageMatcher(message.getLine(), message.getMessage()); } @Override public String toString() { StringBuilder parts = new StringBuilder(); for (String part : messageParts) parts.append(part).append(" "); if (parts.length() > 0) parts.setLength(parts.length() - 1); - return String.format("%d:%d %s", line, position, parts); + return String.format("%d %s", line, parts); } public boolean matches(CompilerMessage message) { if (message.getLine() != this.line) return false; - if (message.getColumnOrPosition() != this.position) return false; for (String token : messageParts) { if (!message.getMessage().contains(token)) return false; } @@ -78,12 +74,12 @@ public class CompilerMessageMatcher { return out; } - private static final Pattern PATTERN = Pattern.compile("^(\\d+):(\\d+) (.*)$"); + private static final Pattern PATTERN = Pattern.compile("^(\\d+) (.*)$"); private static CompilerMessageMatcher read(String line) { line = line.trim(); if (line.isEmpty()) return null; Matcher m = PATTERN.matcher(line); if (!m.matches()) throw new IllegalArgumentException("Typo in test file: " + line); - return new CompilerMessageMatcher(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)), m.group(3)); + return new CompilerMessageMatcher(Integer.parseInt(m.group(1)), m.group(2)); } } diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index f7294f1f..586c124a 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -112,7 +112,7 @@ public class RunTestsViaEcj extends AbstractRunTests { CategorizedProblem[] problems = compilationResult.getAllProblems(); if (problems != null) for (CategorizedProblem p : problems) { - messages.add(new CompilerMessage(p.getSourceLineNumber(), p.getSourceStart(), p.getSourceStart(), p.isError(), p.getMessage())); + messages.add(new CompilerMessage(p.getSourceLineNumber(), p.getSourceStart(), p.isError(), p.getMessage())); } CompilationUnitDeclaration cud = compilationUnit_.get(); -- cgit