From 7079271802176caea4404fc7c80b4656346a2402 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 4 May 2014 10:33:55 +0200 Subject: thoroughly updated the launch targets for testing lombok in eclipse; they should now be able to handle running JDK8 etc tests. CAREFUL: You MUST name your JDK8 'JavaSE-1.8' or it won't work. Also added a basic test for JDK8 features. --- build.xml | 10 +++++- buildScripts/eclipse-run-tests.template | 41 +++++++++++++--------- test/core/src/lombok/RunTestsViaEcj.java | 11 +++--- .../after-delombok/ValInTryWithResources.java | 1 - .../resource/before/ValInTryWithResources.java | 2 +- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/build.xml b/build.xml index 12f19ccb..6b477403 100644 --- a/build.xml +++ b/build.xml @@ -431,9 +431,12 @@ ${sourceWarning} overwrite="true"> + + + WARNING: If you wish to test JDK8 features in eclipse, there must be a JDK8 installation configured in your eclipse, and it must be called 'JavaSE-1.8'. @@ -445,6 +448,7 @@ ${sourceWarning} + Tests will now run against OpenJDK6 @@ -459,6 +463,7 @@ ${sourceWarning} + Tests will now run against OpenJDK7 @@ -473,6 +478,7 @@ ${sourceWarning} + Tests will now run against Oracle JDK7 @@ -487,12 +493,13 @@ ${sourceWarning} + Tests will now run against Oracle JDK8 - + ERROR: No test environment set up. You need to set up a test environment, which consists of a version of javac, and a JRE runtime classpath ('rt.jar'). @@ -513,6 +520,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The * test.location.ecj = /path/to/ecj6.jar * test.location.bootclasspath = /path/to/rt.jar * test.location.name = RandomUsefulNameToIdentifyThisSetup +* test.javaversion = 6 diff --git a/buildScripts/eclipse-run-tests.template b/buildScripts/eclipse-run-tests.template index 1e23baa0..b7bc8b0d 100644 --- a/buildScripts/eclipse-run-tests.template +++ b/buildScripts/eclipse-run-tests.template @@ -1,19 +1,28 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 8d1a8278..e23ebc4c 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -70,22 +70,22 @@ public class RunTestsViaEcj extends AbstractRunTests { warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore"); - warnings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); + warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion()); options.set(warnings); return options; } protected IErrorHandlingPolicy ecjErrorHandlingPolicy() { return new IErrorHandlingPolicy() { - @Override public boolean stopOnFirstError() { + public boolean stopOnFirstError() { return true; } - @Override public boolean proceedOnErrors() { + public boolean proceedOnErrors() { return false; } - @Override public boolean ignoreAllErrors() { + public boolean ignoreAllErrors() { return false; } }; @@ -124,7 +124,8 @@ public class RunTestsViaEcj extends AbstractRunTests { CompilationUnitDeclaration cud = compilationUnit_.get(); - result.append(cud.toString()); + if (cud == null) result.append("---- NO CompilationUnit provided by ecj ----"); + else result.append(cud.toString()); } private FileSystem createFileSystem(File file) { diff --git a/test/transform/resource/after-delombok/ValInTryWithResources.java b/test/transform/resource/after-delombok/ValInTryWithResources.java index 9aae99a2..42bd3193 100644 --- a/test/transform/resource/after-delombok/ValInTryWithResources.java +++ b/test/transform/resource/after-delombok/ValInTryWithResources.java @@ -1,4 +1,3 @@ -//version 7 import java.io.IOException; public class ValInTryWithResources { public void whyTryInsteadOfCleanup() throws IOException { diff --git a/test/transform/resource/before/ValInTryWithResources.java b/test/transform/resource/before/ValInTryWithResources.java index 780e1c71..a7820062 100644 --- a/test/transform/resource/before/ValInTryWithResources.java +++ b/test/transform/resource/before/ValInTryWithResources.java @@ -1,4 +1,4 @@ -//version 7 +//version 7: import lombok.val; import java.io.IOException; -- cgit