From 3d7754e269ec84604d43be97a684bb26b519c6b9 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 23 Mar 2021 06:01:50 +0100 Subject: [testing] wahey, ecj testing works again, and now we can test JDK16 features in it! --- test/core/src/lombok/RunTestsViaEcj.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/core/src/lombok') diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 1c2be160..2e89f99b 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -110,6 +110,11 @@ public class RunTestsViaEcj extends AbstractRunTests { }; } + private ICompilationUnit getSourceUnit(File file, String source) { + if (eclipseAvailable()) return new TestCompilationUnitEclipse(file.getName(), source); + return new TestCompilationUnitEcj(file.getName(), source); + } + @Override public boolean transformCode(Collection messages, StringWriter result, File file, String encoding, Map formatPreferences, int minVersion, boolean checkPositions) throws Throwable { final AtomicReference compilationResult_ = new AtomicReference(); @@ -124,11 +129,7 @@ public class RunTestsViaEcj extends AbstractRunTests { char[] sourceArray = source.toCharArray(); final ICompilationUnit sourceUnit; try { - if (eclipseAvailable()) { - sourceUnit = new TestCompilationUnitEclipse(file.getName(), source); - } else { - sourceUnit = new TestCompilationUnitEcj(file.getName(), source); - } + sourceUnit = getSourceUnit(file, source); } catch (Throwable t) { t.printStackTrace(); return false; -- cgit