diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-02-23 23:26:30 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-02-23 23:26:30 +0100 |
commit | 102e7eafb01e702412c318c6ff189e562be7924e (patch) | |
tree | 1e7b9496aaa8da631ea817050e595daefab0f6a8 /test/core/src/lombok/RunTestsViaEcj.java | |
parent | 0f861010989cb03d09003f91d936f100080b1a18 (diff) | |
download | lombok-102e7eafb01e702412c318c6ff189e562be7924e.tar.gz lombok-102e7eafb01e702412c318c6ff189e562be7924e.tar.bz2 lombok-102e7eafb01e702412c318c6ff189e562be7924e.zip |
Make the unittests for ecj work on windows
Diffstat (limited to 'test/core/src/lombok/RunTestsViaEcj.java')
-rw-r--r-- | test/core/src/lombok/RunTestsViaEcj.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 1d879a35..5c573efd 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -26,6 +26,7 @@ import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -92,18 +93,10 @@ public class RunTestsViaEcj extends AbstractRunTests { } }; - List<String> classpath = new ArrayList<String>(); - classpath.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator))); - classpath.add("dist/lombok.jar"); - classpath.add("lib/test/commons-logging.jar"); - classpath.add("lib/test/slf4j-api.jar"); - classpath.add("lib/test/log4j.jar"); - FileSystem fileAccess = new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8"); - String source = readFile(file); final CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), "UTF-8"); - Compiler ecjCompiler = new Compiler(fileAccess, ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) { + Compiler ecjCompiler = new Compiler(createFileSystem(file), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) { @Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) { if (inUnit == sourceUnit) compilationUnit_.set(parsedUnit); super.addCompilationUnit(inUnit, parsedUnit); @@ -123,4 +116,19 @@ public class RunTestsViaEcj extends AbstractRunTests { result.append(cud.toString()); } + + private FileSystem createFileSystem(File file) { + List<String> classpath = new ArrayList<String>(); + classpath.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator))); + for (Iterator<String> i = classpath.iterator(); i.hasNext();) { + if (FileSystem.getClasspath(i.next(), "UTF-8", null) == null) { + i.remove(); + } + } + classpath.add("dist/lombok.jar"); + classpath.add("lib/test/commons-logging.jar"); + classpath.add("lib/test/slf4j-api.jar"); + classpath.add("lib/test/log4j.jar"); + return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8"); + } } |