diff options
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/src/lombok/AbstractRunTests.java | 4 | ||||
-rw-r--r-- | test/core/src/lombok/RunTestsViaDelombok.java | 9 | ||||
-rw-r--r-- | test/core/src/lombok/RunTestsViaEcj.java | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java index ad9c45af..4241646b 100644 --- a/test/core/src/lombok/AbstractRunTests.java +++ b/test/core/src/lombok/AbstractRunTests.java @@ -83,6 +83,10 @@ public abstract class AbstractRunTests { System.out.println(expectedFile); System.out.println("**** Actual ******"); System.out.println(actualFile); + if (actualMessages != null && !actualMessages.isEmpty()) { + System.out.println("**** Actual Errors *****"); + System.out.println(actualMessages); + } System.out.println("*******************"); } throw e; diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java index 7f99b99e..50fad33e 100644 --- a/test/core/src/lombok/RunTestsViaDelombok.java +++ b/test/core/src/lombok/RunTestsViaDelombok.java @@ -24,6 +24,8 @@ package lombok; import java.io.File; import java.io.StringWriter; import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.tools.Diagnostic; import javax.tools.DiagnosticListener; @@ -35,14 +37,17 @@ public class RunTestsViaDelombok extends AbstractRunTests { private Delombok delombok = new Delombok(); @Override - public void transformCode(final StringBuilder messages, StringWriter result, File file) throws Throwable { + public void transformCode(final StringBuilder messages, StringWriter result, final File file) throws Throwable { delombok.setVerbose(false); delombok.setForceProcess(true); delombok.setCharset("UTF-8"); delombok.setDiagnosticsListener(new DiagnosticListener<JavaFileObject>() { @Override public void report(Diagnostic<? extends JavaFileObject> d) { - messages.append(String.format("%d:%d %s %s\n", d.getLineNumber(), d.getColumnNumber(), d.getKind(), d.getMessage(Locale.ENGLISH))); + String msg = d.getMessage(Locale.ENGLISH); + Matcher m = Pattern.compile("^" + Pattern.quote(file.getAbsolutePath()) + "\\s*:\\s*\\d+\\s*:\\s*(?:warning:\\s*)?(.*)$").matcher(msg); + if (m.matches()) msg = m.group(1); + messages.append(String.format("%d:%d %s %s\n", d.getLineNumber(), d.getColumnNumber(), d.getKind(), msg)); } }); diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 3f7d6e81..fa1501bc 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -47,8 +47,10 @@ public class RunTestsViaEcj extends AbstractRunTests { TransformEclipseAST.transform(parser, cud); - for (CategorizedProblem p : compilationResult.getErrors()) { - messages.append(p.toString()).append("\n"); + CategorizedProblem[] problems = compilationResult.getAllProblems(); + + if (problems != null) for (CategorizedProblem p : problems) { + messages.append(String.format("%d %s %s\n", p.getSourceLineNumber(), p.isError() ? "error" : p.isWarning() ? "warning" : "unknown", p.getMessage())); } result.append(cud.toString()); |