aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java2
-rw-r--r--test/core/src/lombok/CompilerMessageMatcher.java2
-rw-r--r--test/core/src/lombok/DirectoryRunner.java5
-rw-r--r--test/core/src/lombok/LombokTestSource.java15
-rw-r--r--test/manual/knownIssue-1976_2138-valPlusDelegateVsEclipseErrors/about.txt35
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkBasic.java72
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkBuilder.java106
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java202
-rw-r--r--test/transform/resource/after-delombok/SetterAndWithMethodJavadoc.java (renamed from test/transform/resource/after-delombok/SetterAndWitherJavadoc.java)12
-rw-r--r--test/transform/resource/after-delombok/WithAlreadyExists.java71
-rw-r--r--test/transform/resource/after-delombok/WithAndAllArgsConstructor.java22
-rw-r--r--test/transform/resource/after-delombok/WithMethodAbstract.java5
-rw-r--r--test/transform/resource/after-delombok/WithMethodMarkedDeprecated.java23
-rw-r--r--test/transform/resource/after-delombok/WithOnClass.java54
-rw-r--r--test/transform/resource/after-delombok/WithOnStatic.java (renamed from test/transform/resource/after-delombok/WitherOnStatic.java)2
-rw-r--r--test/transform/resource/after-delombok/WithPlain.java16
-rw-r--r--test/transform/resource/after-delombok/WithWithDollar.java3
-rw-r--r--test/transform/resource/after-delombok/WithWithGenerics.java20
-rw-r--r--test/transform/resource/after-delombok/WithWithTypeAnnos.java (renamed from test/transform/resource/after-delombok/WitherTypeAnnos.java)8
-rw-r--r--test/transform/resource/after-delombok/WitherAlreadyExists.java71
-rw-r--r--test/transform/resource/after-delombok/WitherAndAllArgsConstructor.java22
-rw-r--r--test/transform/resource/after-delombok/WitherDeprecated.java23
-rw-r--r--test/transform/resource/after-delombok/WitherOnClass.java54
-rw-r--r--test/transform/resource/after-delombok/WitherPlain.java16
-rw-r--r--test/transform/resource/after-delombok/WitherWithAbstract.java5
-rw-r--r--test/transform/resource/after-delombok/WitherWithDollar.java3
-rw-r--r--test/transform/resource/after-delombok/WitherWithGenerics.java20
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkBasic.java59
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkBuilder.java79
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java142
-rw-r--r--test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java22
-rw-r--r--test/transform/resource/after-ecj/SetterAndWitherJavadoc.java22
-rw-r--r--test/transform/resource/after-ecj/WithAlreadyExists.java78
-rw-r--r--test/transform/resource/after-ecj/WithAndAllArgsConstructor.java20
-rw-r--r--test/transform/resource/after-ecj/WithMethodAbstract.java7
-rw-r--r--test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java14
-rw-r--r--test/transform/resource/after-ecj/WithOnClass.java52
-rw-r--r--test/transform/resource/after-ecj/WithOnStatic.java9
-rw-r--r--test/transform/resource/after-ecj/WithPlain.java16
-rw-r--r--test/transform/resource/after-ecj/WithWithDollar.java6
-rw-r--r--test/transform/resource/after-ecj/WithWithGenerics.java18
-rw-r--r--test/transform/resource/after-ecj/WithWithTypeAnnos.java (renamed from test/transform/resource/after-ecj/WitherTypeAnnos.java)12
-rw-r--r--test/transform/resource/after-ecj/WitherAlreadyExists.java78
-rw-r--r--test/transform/resource/after-ecj/WitherAndAllArgsConstructor.java20
-rw-r--r--test/transform/resource/after-ecj/WitherDeprecated.java14
-rw-r--r--test/transform/resource/after-ecj/WitherOnClass.java52
-rw-r--r--test/transform/resource/after-ecj/WitherOnStatic.java9
-rw-r--r--test/transform/resource/after-ecj/WitherPlain.java16
-rw-r--r--test/transform/resource/after-ecj/WitherWithAbstract.java7
-rw-r--r--test/transform/resource/after-ecj/WitherWithDollar.java6
-rw-r--r--test/transform/resource/after-ecj/WitherWithGenerics.java18
-rw-r--r--test/transform/resource/before/BuilderInvalidUse.java2
-rw-r--r--test/transform/resource/before/CheckerFrameworkBasic.java11
-rw-r--r--test/transform/resource/before/CheckerFrameworkBuilder.java12
-rw-r--r--test/transform/resource/before/CheckerFrameworkSuperBuilder.java19
-rw-r--r--test/transform/resource/before/FlagUsages.java3
-rw-r--r--test/transform/resource/before/SetterAndWithMethodJavadoc.java (renamed from test/transform/resource/before/SetterAndWitherJavadoc.java)12
-rw-r--r--test/transform/resource/before/WithAlreadyExists.java89
-rw-r--r--test/transform/resource/before/WithAndAllArgsConstructor.java12
-rw-r--r--test/transform/resource/before/WithMethodAbstract.java3
-rw-r--r--test/transform/resource/before/WithMethodMarkedDeprecated.java15
-rw-r--r--test/transform/resource/before/WithOnClass.java45
-rw-r--r--test/transform/resource/before/WithOnStatic.java4
-rw-r--r--test/transform/resource/before/WithPlain.java10
-rw-r--r--test/transform/resource/before/WithWithDollar.java3
-rw-r--r--test/transform/resource/before/WithWithGenerics.java9
-rw-r--r--test/transform/resource/before/WithWithTypeAnnos.java (renamed from test/transform/resource/before/WitherTypeAnnos.java)8
-rw-r--r--test/transform/resource/before/WitherAlreadyExists.java89
-rw-r--r--test/transform/resource/before/WitherAndAllArgsConstructor.java12
-rw-r--r--test/transform/resource/before/WitherDeprecated.java15
-rw-r--r--test/transform/resource/before/WitherOnClass.java45
-rw-r--r--test/transform/resource/before/WitherOnStatic.java4
-rw-r--r--test/transform/resource/before/WitherPlain.java10
-rw-r--r--test/transform/resource/before/WitherWithAbstract.java3
-rw-r--r--test/transform/resource/before/WitherWithDollar.java3
-rw-r--r--test/transform/resource/before/WitherWithGenerics.java9
-rw-r--r--test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages2
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages4
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages3
-rw-r--r--test/transform/resource/messages-delombok/FlagUsages.java.messages4
-rw-r--r--test/transform/resource/messages-delombok/WithAlreadyExists.java.messages (renamed from test/transform/resource/messages-delombok/WitherAlreadyExists.java.messages)0
-rw-r--r--test/transform/resource/messages-delombok/WithOnStatic.java.messages2
-rw-r--r--test/transform/resource/messages-delombok/WithWithDollar.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/WitherOnStatic.java.messages2
-rw-r--r--test/transform/resource/messages-delombok/WitherWithDollar.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/FlagUsages.java.messages4
-rw-r--r--test/transform/resource/messages-ecj/WithAlreadyExists.java.messages (renamed from test/transform/resource/messages-ecj/WitherAlreadyExists.java.messages)0
-rw-r--r--test/transform/resource/messages-ecj/WithOnStatic.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/WithWithDollar.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/WitherAccessLevel.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/WitherOnStatic.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/WitherWithDollar.java.messages1
-rw-r--r--test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages10
98 files changed, 1467 insertions, 691 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index fc05aea2..d223ae03 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -47,6 +47,7 @@ import lombok.core.configuration.ConfigurationKeysLoader;
import lombok.core.configuration.ConfigurationResolver;
import lombok.core.configuration.ConfigurationResolverFactory;
import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
+import lombok.transform.TestLombokFilesIdempotent;
public abstract class AbstractRunTests {
private final File dumpActualFilesHere;
@@ -74,6 +75,7 @@ public abstract class AbstractRunTests {
if (expected.isIgnore()) return null;
if (!expected.versionWithinLimit(params.getVersion())) return null;
if (!expected.versionWithinLimit(version)) return null;
+ if (expected.isSkipIdempotent() && params instanceof TestLombokFilesIdempotent) return null;
final LombokTestSource sourceDirectives_ = sourceDirectives;
final AssertionError directiveFailure_ = directiveFailure;
diff --git a/test/core/src/lombok/CompilerMessageMatcher.java b/test/core/src/lombok/CompilerMessageMatcher.java
index 49c81b70..c00263f4 100644
--- a/test/core/src/lombok/CompilerMessageMatcher.java
+++ b/test/core/src/lombok/CompilerMessageMatcher.java
@@ -88,7 +88,7 @@ public class CompilerMessageMatcher {
return out;
}
- private static final Pattern PATTERN = Pattern.compile("^(\\d+) (.*)$");
+ private static final Pattern PATTERN = Pattern.compile("^(-?\\d+) (.*)$");
private static CompilerMessageMatcher read(String line) {
line = line.trim();
diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java
index 9410b4c7..ffadba8f 100644
--- a/test/core/src/lombok/DirectoryRunner.java
+++ b/test/core/src/lombok/DirectoryRunner.java
@@ -36,7 +36,8 @@ import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;
public class DirectoryRunner extends Runner {
- private static final String DEBUG_FOCUS_ON_FILE = null;
+ /** Fill in a file name (or multiple, space separated) to reduce the testset to just the named file(s). */
+ private static final String DEBUG_FOCUS_ON_FILE = "";
public enum Compiler {
DELOMBOK {
@@ -79,7 +80,7 @@ public class DirectoryRunner extends Runner {
private static final FileFilter JAVA_FILE_FILTER = new FileFilter() {
@Override public boolean accept(File file) {
return file.isFile() && file.getName().endsWith(".java") &&
- (DEBUG_FOCUS_ON_FILE == null || file.getName().equals(DEBUG_FOCUS_ON_FILE));
+ (DEBUG_FOCUS_ON_FILE.isEmpty() || (" " + DEBUG_FOCUS_ON_FILE + " ").contains(" " + file.getName() + " "));
}
};
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index 31f7db3e..ba0aa972 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2015 The Project Lombok Authors.
+ * Copyright (C) 2014-2019 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -52,6 +52,7 @@ public class LombokTestSource {
private final Map<String, String> formatPreferences;
private final boolean ignore;
private final boolean skipCompareContent;
+ private final boolean skipIdempotent;
private final boolean unchanged;
private final int versionLowerLimit, versionUpperLimit;
private final ConfigurationResolver configuration;
@@ -92,6 +93,10 @@ public class LombokTestSource {
return skipCompareContent;
}
+ public boolean isSkipIdempotent() {
+ return skipIdempotent;
+ }
+
public String getSpecifiedEncoding() {
return specifiedEncoding;
}
@@ -139,6 +144,7 @@ public class LombokTestSource {
private static final Pattern IGNORE_PATTERN = Pattern.compile("^\\s*ignore\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
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 LombokTestSource(File file, String content, List<CompilerMessageMatcher> messages, List<String> directives) {
this.file = file;
@@ -150,6 +156,7 @@ public class LombokTestSource {
int versionUpper = Integer.MAX_VALUE;
boolean ignore = false;
boolean skipCompareContent = false;
+ boolean skipIdempotent = false;
boolean unchanged = false;
String encoding = null;
Map<String, String> formats = new HashMap<String, String>();
@@ -173,6 +180,11 @@ public class LombokTestSource {
continue;
}
+ if (SKIP_IDEMPOTENT_PATTERN.matcher(directive).matches()) {
+ skipIdempotent = true;
+ continue;
+ }
+
if (lc.startsWith("platform ")) {
String platformDesc = lc.substring("platform ".length());
int idx = platformDesc.indexOf(':');
@@ -223,6 +235,7 @@ public class LombokTestSource {
this.versionUpperLimit = versionUpper;
this.ignore = ignore;
this.skipCompareContent = skipCompareContent;
+ this.skipIdempotent = skipIdempotent;
this.unchanged = unchanged;
this.platforms = platformLimit == null ? null : Arrays.asList(platformLimit);
ConfigurationProblemReporter reporter = new ConfigurationProblemReporter() {
diff --git a/test/manual/knownIssue-1976_2138-valPlusDelegateVsEclipseErrors/about.txt b/test/manual/knownIssue-1976_2138-valPlusDelegateVsEclipseErrors/about.txt
new file mode 100644
index 00000000..58b3df3b
--- /dev/null
+++ b/test/manual/knownIssue-1976_2138-valPlusDelegateVsEclipseErrors/about.txt
@@ -0,0 +1,35 @@
+PullRequest https://github.com/rzwitserloot/lombok/pull/2114 tries to fix issue https://github.com/rzwitserloot/lombok/issues/1976 but causes problems.
+
+The problem is that the fail-fast resolver applied by PR 2114 causes the following issue:
+
+Given:
+
+A.java:
+
+ public class A {
+ interface Inner {
+ default void example() {
+ lombok.val v = doesNotExist();
+ }
+ }
+ B b = new B();
+ }
+
+B.java:
+
+ import com.foo.pkg.A.Inner;
+
+ public class B implements Inner {
+ void foo() {
+ lombok.val v = doesNotExist();
+ }
+ }
+
+will cause A.java to be parsed such that nothing in it exists, in turn causing B to consider A.Inner to not exist at all,
+even though the error on the 'implements Inner' line offers 'import Inner' as a quickfix. This quickfix won't, obviously, fix it.
+
+In addition, enough 'A refers to B refers to A' loops with errors like this and eclipse 2019-06 will eventually run out of heap and crash.
+
+The key commit that attempts to fix 1976 but causes the above issue is commit 089f2ec5f45567c8c12e9d13bf9be8fa5c107c18.
+
+The commit that undoes this, re-introducing 1976 but avoiding the problem above, is commit 877a169727a4c8078c43a4465929247c3390c897.
diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java
new file mode 100644
index 00000000..b9d4e0fa
--- /dev/null
+++ b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java
@@ -0,0 +1,72 @@
+class CheckerFrameworkBasic {
+ private final int x;
+ private final int y;