aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java4
-rw-r--r--test/core/src/lombok/LombokTestSource.java4
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java2
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java11
4 files changed, 14 insertions, 7 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index d223ae03..6d2b6312 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -91,7 +91,7 @@ public abstract class AbstractRunTests {
}
});
- boolean changed = transformCode(messages, writer, file, sourceDirectives_.getSpecifiedEncoding(), sourceDirectives_.getFormatPreferences());
+ boolean changed = transformCode(messages, writer, file, sourceDirectives_.getSpecifiedEncoding(), sourceDirectives_.getFormatPreferences(), sourceDirectives_.minVersion());
boolean forceUnchanged = sourceDirectives_.forceUnchanged() || sourceDirectives_.isSkipCompareContent();
if (params.expectChanges() && !forceUnchanged && !changed) messages.add(new CompilerMessage(-1, -1, true, "not flagged modified"));
if (!params.expectChanges() && changed) messages.add(new CompilerMessage(-1, -1, true, "unexpected modification"));
@@ -101,7 +101,7 @@ public abstract class AbstractRunTests {
};
}
- protected abstract boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences) throws Throwable;
+ protected abstract boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences, int minVersion) throws Throwable;
protected String readFile(File file) throws IOException {
BufferedReader reader;
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index b04f0ba0..57a32333 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -358,4 +358,8 @@ public class LombokTestSource {
if (specifiedEncoding == null || specifiedEncoding.equalsIgnoreCase(encoding)) return source;
return read0(sourceFolder, messagesFolder, fileName, specifiedEncoding);
}
+
+ public int minVersion() {
+ return Math.max(6, versionLowerLimit);
+ }
}
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index b766e7a4..4260f2da 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -41,7 +41,7 @@ public class RunTestsViaDelombok extends AbstractRunTests {
private static AtomicBoolean compilerVersionReported = new AtomicBoolean();
@Override
- public boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, final File file, String encoding, Map<String, String> formatPreferences) throws Throwable {
+ public boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, final File file, String encoding, Map<String, String> formatPreferences, int version) throws Throwable {
if (!compilerVersionReported.getAndSet(true)) System.out.println("Javac version: " + Javac.getJavaCompilerVersion());
delombok.setVerbose(true);
ChangedChecker cc = new ChangedChecker();
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 77d1b75e..ab28cb0c 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -93,7 +93,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
@Override
- public boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences) throws Throwable {
+ public boolean transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences, int minVersion) throws Throwable {
final AtomicReference<CompilationResult> compilationResult_ = new AtomicReference<CompilationResult>();
final AtomicReference<CompilationUnitDeclaration> compilationUnit_ = new AtomicReference<CompilationUnitDeclaration>();
ICompilerRequestor bitbucketRequestor = new ICompilerRequestor() {
@@ -105,7 +105,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
String source = readFile(file);
final CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), encoding == null ? "UTF-8" : encoding);
- Compiler ecjCompiler = new Compiler(createFileSystem(file), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
+ Compiler ecjCompiler = new Compiler(createFileSystem(file, minVersion), 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);
@@ -129,7 +129,9 @@ public class RunTestsViaEcj extends AbstractRunTests {
return true;
}
- private FileSystem createFileSystem(File file) {
+ private static final String bootRuntimePath = System.getProperty("delombok.bootclasspath");
+
+ private FileSystem createFileSystem(File file, int minVersion) {
List<String> classpath = new ArrayList<String>();
for (Iterator<String> i = classpath.iterator(); i.hasNext();) {
if (FileSystem.getClasspath(i.next(), "UTF-8", null) == null) {
@@ -138,7 +140,8 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
if (new File("bin").exists()) classpath.add("bin");
classpath.add("dist/lombok.jar");
- classpath.add("lib/openjdk6_rt.jar");
+ if (bootRuntimePath == null || bootRuntimePath.isEmpty()) throw new IllegalStateException("System property delombok.bootclasspath is not set; set it to the rt of java6 or java8");
+ classpath.add(bootRuntimePath);
for (File f : new File("lib/test").listFiles()) {
String fn = f.getName();
if (fn.length() < 4) continue;