aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/src/lombok')
-rw-r--r--test/core/src/lombok/DirectoryRunner.java3
-rw-r--r--test/core/src/lombok/LombokTestSource.java4
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java9
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java26
4 files changed, 28 insertions, 14 deletions
diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java
index b041c42e..53347e24 100644
--- a/test/core/src/lombok/DirectoryRunner.java
+++ b/test/core/src/lombok/DirectoryRunner.java
@@ -55,7 +55,8 @@ public class DirectoryRunner extends Runner {
},
ECJ {
@Override public int getVersion() {
- return Eclipse.getEcjCompilerVersion();
+ String javaVersionString = System.getProperty("compiler.compliance.level");
+ return javaVersionString != null ? Integer.parseInt(javaVersionString) : Eclipse.getEcjCompilerVersion();
}
};
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index 0326dee9..27ffc31a 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -161,6 +161,7 @@ public class LombokTestSource {
private static final Pattern UNCHANGED_PATTERN = Pattern.compile("^\\s*unchanged\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
private static final Pattern SKIP_COMPARE_CONTENT_PATTERN = Pattern.compile("^\\s*skip[- ]?compare[- ]?contents?\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
private static final Pattern SKIP_IDEMPOTENT_PATTERN = Pattern.compile("^\\s*skip[- ]?idempotent\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern ISSUE_REF_PATTERN = Pattern.compile("^\\s*issue #?\\d+(:?\\s+.*)?$", Pattern.CASE_INSENSITIVE);
private LombokTestSource(File file, String content, List<CompilerMessageMatcher> messages, List<String> directives) {
this.file = file;
@@ -200,6 +201,9 @@ public class LombokTestSource {
skipIdempotent = true;
continue;
}
+ if (ISSUE_REF_PATTERN.matcher(directive).matches()) {
+ continue;
+ }
if (lc.startsWith("platform ")) {
String platformDesc = lc.substring("platform ".length());
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 23a42c67..e4eb1a30 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -42,7 +42,6 @@ import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import com.sun.source.util.TreePath;
@@ -211,8 +210,8 @@ public class RunTestsViaDelombok extends AbstractRunTests {
}
@Override public void visitVarDef(JCVariableDecl tree) {
- // Skip non-field variables
- if (!(parent instanceof JCClassDecl)) return;
+ // Skip local variables
+ if (!(parent instanceof JCClassDecl || parent instanceof JCMethodDecl)) return;
validateSymbol(tree, tree.sym);
super.visitVarDef(tree);
@@ -222,8 +221,8 @@ public class RunTestsViaDelombok extends AbstractRunTests {
if (sym == null) {
fail("Missing symbol for " + tree);
}
- // Skip top level classes
- if (sym.owner.getKind() == ElementKind.PACKAGE) return;
+ // Only classes have enclosed elements, skip everything else
+ if (!sym.owner.getKind().isClass()) return;
if (!sym.owner.getEnclosedElements().contains(sym)) {
fail(tree + " not added to parent");
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index afba8c7f..6137de49 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -64,9 +64,22 @@ import org.osgi.framework.BundleContext;
public class RunTestsViaEcj extends AbstractRunTests {
protected CompilerOptions ecjCompilerOptions() {
CompilerOptions options = new CompilerOptions();
- options.complianceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
- options.sourceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
- options.targetJDK = Eclipse.getLatestEcjCompilerVersionConstant();
+ Map<String, String> warnings = new HashMap<String, String>();
+
+ String javaVersionString = System.getProperty("compiler.compliance.level");
+ long ecjCompilerVersionConstant = Eclipse.getLatestEcjCompilerVersionConstant();
+ long ecjCompilerVersion = Eclipse.getEcjCompilerVersion();
+ if (javaVersionString != null) {
+ long javaVersion = Long.parseLong(javaVersionString);
+ ecjCompilerVersionConstant = (javaVersion + 44) << 16;
+ ecjCompilerVersion = javaVersion;
+ } else {
+ // Preview features are only allowed if the maximum compiler version is equal to the source version
+ warnings.put("org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures", "enabled");
+ }
+ options.complianceLevel = ecjCompilerVersionConstant;
+ options.sourceLevel = ecjCompilerVersionConstant;
+ options.targetJDK = ecjCompilerVersionConstant;
options.docCommentSupport = false;
options.parseLiteralExpressionsAsConstants = true;
options.inlineJsrBytecode = true;
@@ -78,17 +91,14 @@ public class RunTestsViaEcj extends AbstractRunTests {
options.reportUnusedParameterWhenOverridingConcrete = false;
options.reportDeadCodeInTrivialIfStatement = false;
options.generateClassFiles = false;
- Map<String, String> warnings = new HashMap<String, String>();
warnings.put(CompilerOptions.OPTION_ReportUnusedLocal, "ignore");
warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore");
warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore");
warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore");
warnings.put(CompilerOptions.OPTION_ReportIndirectStaticAccess, "warning");
warnings.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, "warning");
- warnings.put("org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures", "enabled");
warnings.put("org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures", "ignore");
- int ecjVersion = Eclipse.getEcjCompilerVersion();
- warnings.put(CompilerOptions.OPTION_Source, (ecjVersion < 9 ? "1." : "") + ecjVersion);
+ warnings.put(CompilerOptions.OPTION_Source, (ecjCompilerVersion < 9 ? "1." : "") + ecjCompilerVersion);
options.set(warnings);
return options;
}
@@ -96,7 +106,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
protected IErrorHandlingPolicy ecjErrorHandlingPolicy() {
return new IErrorHandlingPolicy() {
public boolean stopOnFirstError() {
- return true;
+ return false;
}
public boolean proceedOnErrors() {