aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/configuration/resource/configurationRoot/d1/d11/d111/f1.txt0
-rw-r--r--test/configuration/resource/configurationRoot/d1/d11/d111/lombok.config2
-rw-r--r--test/configuration/resource/configurationRoot/d1/d11/lombok.config5
-rw-r--r--test/configuration/resource/configurationRoot/d1/d12/lombok.config3
-rw-r--r--test/configuration/resource/configurationRoot/d1/lombok.config3
-rw-r--r--test/configuration/resource/configurationRoot/err.txt0
-rw-r--r--test/configuration/resource/configurationRoot/out.txt90
-rw-r--r--test/configuration/src/lombok/core/configuration/RunConfigurationTests.java31
-rw-r--r--test/configuration/src/lombok/core/configuration/TestConfiguration.java95
-rw-r--r--test/core/src/lombok/AbstractRunTests.java95
-rw-r--r--test/core/src/lombok/DirectoryRunner.java59
-rw-r--r--test/core/src/lombok/LombokTestSource.java239
-rw-r--r--test/core/src/lombok/RunAllTests.java4
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java2
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java2
-rw-r--r--test/transform/resource/after-delombok/AccessorsConfiguration.java26
-rw-r--r--test/transform/resource/after-delombok/LoggerConfig.java4
-rw-r--r--test/transform/resource/after-delombok/ToStringConfiguration.java32
-rw-r--r--test/transform/resource/after-ecj/AccessorsConfiguration.java31
-rw-r--r--test/transform/resource/after-ecj/LoggerConfig.java6
-rw-r--r--test/transform/resource/after-ecj/ToStringConfiguration.java35
-rw-r--r--test/transform/resource/before/AccessorsConfiguration.java20
-rw-r--r--test/transform/resource/before/BuilderInvalidUse.java1
-rw-r--r--test/transform/resource/before/DelegateOnStatic.java1
-rw-r--r--test/transform/resource/before/FlagUsages.java11
-rw-r--r--test/transform/resource/before/LoggerConfig.java5
-rw-r--r--test/transform/resource/before/ToStringConfiguration.java13
-rw-r--r--test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages4
-rw-r--r--test/transform/resource/messages-delombok/DelegateOnStatic.java.messages4
-rw-r--r--test/transform/resource/messages-delombok/FlagUsages.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages4
-rw-r--r--test/transform/resource/messages-ecj/DelegateOnStatic.java.messages4
-rw-r--r--test/transform/resource/messages-ecj/FlagUsages.java.messages2
33 files changed, 717 insertions, 118 deletions
diff --git a/test/configuration/resource/configurationRoot/d1/d11/d111/f1.txt b/test/configuration/resource/configurationRoot/d1/d11/d111/f1.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/d1/d11/d111/f1.txt
diff --git a/test/configuration/resource/configurationRoot/d1/d11/d111/lombok.config b/test/configuration/resource/configurationRoot/d1/d11/d111/lombok.config
new file mode 100644
index 00000000..bcea2a72
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/d1/d11/d111/lombok.config
@@ -0,0 +1,2 @@
+clear lombok.Accessors.chain
+lombok.Accessors.prefix += m_ \ No newline at end of file
diff --git a/test/configuration/resource/configurationRoot/d1/d11/lombok.config b/test/configuration/resource/configurationRoot/d1/d11/lombok.config
new file mode 100644
index 00000000..fcdc4823
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/d1/d11/lombok.config
@@ -0,0 +1,5 @@
+stop-bubbling=true
+
+lombok.Accessors.chain = false
+lombok.Accessors.flagUsage = ERROR
+lombok.Accessors.prefix += f \ No newline at end of file
diff --git a/test/configuration/resource/configurationRoot/d1/d12/lombok.config b/test/configuration/resource/configurationRoot/d1/d12/lombok.config
new file mode 100644
index 00000000..a18a4756
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/d1/d12/lombok.config
@@ -0,0 +1,3 @@
+stop-bubbling=true
+
+lombok.Accessors.chain = true \ No newline at end of file
diff --git a/test/configuration/resource/configurationRoot/d1/lombok.config b/test/configuration/resource/configurationRoot/d1/lombok.config
new file mode 100644
index 00000000..dec482e6
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/d1/lombok.config
@@ -0,0 +1,3 @@
+stop-bubbling=true
+# this file shouldn't be read
+no error expected \ No newline at end of file
diff --git a/test/configuration/resource/configurationRoot/err.txt b/test/configuration/resource/configurationRoot/err.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/err.txt
diff --git a/test/configuration/resource/configurationRoot/out.txt b/test/configuration/resource/configurationRoot/out.txt
new file mode 100644
index 00000000..54e91094
--- /dev/null
+++ b/test/configuration/resource/configurationRoot/out.txt
@@ -0,0 +1,90 @@
+Configuration for 'BASE/d1/d11'.
+
+# Emit a warning or error if @Accessors is used.
+lombok.Accessors.flagUsage = ERROR
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.flagUsage' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 3: lombok.Accessors.flagUsage = ERROR
+
+# Generate setters that return 'this' instead of 'void'.
+lombok.Accessors.chain = false
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.chain' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 2: lombok.Accessors.chain = false
+
+# Strip this field prefix, like 'f' or 'm_', from the names of generated getters and setters.
+lombok.Accessors.prefix += f
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.prefix' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 4: lombok.Accessors.prefix += f
+
+# Use this name for the generated logger fields (default: 'log')
+clear lombok.log.fieldName
+
+
+Configuration for:
+- BASE/d1/d11/d111
+- BASE/d1/d11/d111/f1.txt
+
+# Emit a warning or error if @Accessors is used.
+lombok.Accessors.flagUsage = ERROR
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.flagUsage' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 3: lombok.Accessors.flagUsage = ERROR
+#
+# BASE/d1/d11/d111/lombok.config:
+# <'lombok.Accessors.flagUsage' not mentioned>
+
+# Generate setters that return 'this' instead of 'void'.
+clear lombok.Accessors.chain
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.chain' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 2: lombok.Accessors.chain = false
+#
+# BASE/d1/d11/d111/lombok.config:
+# 1: clear lombok.Accessors.chain
+
+# Strip this field prefix, like 'f' or 'm_', from the names of generated getters and setters.
+lombok.Accessors.prefix += f
+lombok.Accessors.prefix += m_
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.prefix' not mentioned>
+#
+# BASE/d1/d11/lombok.config:
+# 4: lombok.Accessors.prefix += f
+#
+# BASE/d1/d11/d111/lombok.config:
+# 2: lombok.Accessors.prefix += m_
+
+# Use this name for the generated logger fields (default: 'log')
+clear lombok.log.fieldName
+
+
+Configuration for 'BASE/d1/d12'.
+
+# Emit a warning or error if @Accessors is used.
+clear lombok.Accessors.flagUsage
+
+# Generate setters that return 'this' instead of 'void'.
+lombok.Accessors.chain = true
+# BASE/d1/lombok.config:
+# <'lombok.Accessors.chain' not mentioned>
+#
+# BASE/d1/d12/lombok.config:
+# 2: lombok.Accessors.chain = true
+
+# Strip this field prefix, like 'f' or 'm_', from the names of generated getters and setters.
+clear lombok.Accessors.prefix
+
+# Use this name for the generated logger fields (default: 'log')
+clear lombok.log.fieldName \ No newline at end of file
diff --git a/test/configuration/src/lombok/core/configuration/RunConfigurationTests.java b/test/configuration/src/lombok/core/configuration/RunConfigurationTests.java
new file mode 100644
index 00000000..40e0a7f4
--- /dev/null
+++ b/test/configuration/src/lombok/core/configuration/RunConfigurationTests.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok.core.configuration;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({TestConfiguration.class})
+public class RunConfigurationTests {
+}
diff --git a/test/configuration/src/lombok/core/configuration/TestConfiguration.java b/test/configuration/src/lombok/core/configuration/TestConfiguration.java
new file mode 100644
index 00000000..d2599334
--- /dev/null
+++ b/test/configuration/src/lombok/core/configuration/TestConfiguration.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2014 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok.core.configuration;
+
+import static lombok.ConfigurationKeys.*;
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.regex.Pattern;
+
+import org.junit.Test;
+
+public class TestConfiguration {
+
+ @Test
+ public void testDisplayVerbose() throws Exception {
+
+ @SuppressWarnings("unchecked")
+ Collection<ConfigurationKey<?>> keys = Arrays.asList(ACCESSORS_FLAG_USAGE, ACCESSORS_CHAIN, ACCESSORS_PREFIX, LOG_ANY_FIELD_NAME);
+
+ String baseName = "test/configuration/resource/configurationRoot/";
+ File directory = new File(baseName);
+ String normalizedName = new File(directory.getAbsoluteFile().toURI().normalize()).toString().replace('\\', '/') + "/";
+ Collection<String> paths = Arrays.asList(normalizedName + "d1/d11", normalizedName + "d1/d12", normalizedName + "d1/d11/d111", normalizedName + "d1/d11/d111/f1.txt");
+
+ ByteArrayOutputStream rawOut = new ByteArrayOutputStream();
+ ByteArrayOutputStream rawErr = new ByteArrayOutputStream();
+ PrintStream outStream = new PrintStream(rawOut);
+ PrintStream errStream = new PrintStream(rawErr);
+
+ int result = new ConfigurationApp().redirectOutput(outStream, errStream).display(keys, true, paths, true);
+
+ outStream.flush();
+ errStream.flush();
+
+ String out = new String(rawOut.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
+ String err = new String(rawErr.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
+
+ checkContent(directory, out, "out");
+ checkContent(directory, err, "err");
+ assertEquals(0, result);
+ }
+
+ private void checkContent(File dir, String actual, String type) throws Exception {
+ String expected = fileToString(new File(dir, type + ".txt")).trim();
+ if (!expected.equals(actual)) {
+ System.out.printf("**** Expected %s:\n", type);
+ System.out.println(expected);
+ System.out.printf("**** Actual %s:\n", type);
+ System.out.println(actual);
+ System.out.println("****");
+ }
+ assertEquals(expected, actual);
+ }
+
+ static String fileToString(File configFile) throws Exception {
+ byte[] b = new byte[65536];
+ FileInputStream fis = new FileInputStream(configFile);
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ while (true) {
+ int r = fis.read(b);
+ if (r == -1) break;
+ out.write(b, 0, r);
+ }
+ return new String(out.toByteArray(), "UTF-8");
+ } finally {
+ fis.close();
+ }
+ }
+}
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index e84aec0d..34f6cbf4 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2013 The Project Lombok Authors.
+ * Copyright (C) 2009-2014 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
@@ -25,21 +25,25 @@ import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
+import org.junit.Assert;
+
+import lombok.core.AST;
+import lombok.core.LombokConfiguration;
+import lombok.core.LombokImmutableList;
+import lombok.core.configuration.ConfigurationKeysLoader;
+import lombok.core.configuration.ConfigurationResolver;
+import lombok.core.configuration.ConfigurationResolverFactory;
import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
public abstract class AbstractRunTests {
@@ -50,39 +54,27 @@ public abstract class AbstractRunTests {
}
public boolean compareFile(DirectoryRunner.TestParams params, File file) throws Throwable {
+ ConfigurationKeysLoader.LoaderLoader.loadAllConfigurationKeys();
+ final LombokTestSource sourceDirectives = LombokTestSource.readDirectives(file);
+ if (sourceDirectives.isIgnore() || !sourceDirectives.versionWithinLimit(params.getVersion())) return false;
+
+ String fileName = file.getName();
+ LombokTestSource expected = LombokTestSource.read(params.getAfterDirectory(), params.getMessagesDirectory(), fileName);
+
+ if (expected.isIgnore() || !expected.versionWithinLimit(params.getVersion())) return false;
+
LinkedHashSet<CompilerMessage> messages = new LinkedHashSet<CompilerMessage>();
StringWriter writer = new StringWriter();
- transformCode(messages, writer, file);
- String expectedFile = readFile(params.getAfterDirectory(), file, false);
- List<CompilerMessageMatcher> expectedMessages = Collections.emptyList();
- if (params.getMessagesDirectory() != null) {
- try {
- InputStream in = new FileInputStream(new File(params.getMessagesDirectory(), file.getName() + ".messages"));
- try {
- expectedMessages = CompilerMessageMatcher.readAll(in);
- } finally {
- in.close();
- }
- } catch (FileNotFoundException ex) {
- // That's okay - then we expect no messages, and expectedMessages already gets initialized to the empty list.
- }
- }
- if (expectedFile != null) {
- StringReader r = new StringReader(expectedFile);
- BufferedReader br = new BufferedReader(r);
- String firstLine = br.readLine();
- if (firstLine != null && (firstLine.startsWith("//ignore") || params.shouldIgnoreBasedOnVersion(firstLine))) return false;
- }
+ LombokConfiguration.overrideConfigurationResolverFactory(new ConfigurationResolverFactory() {
+ @Override public ConfigurationResolver createResolver(AST<?, ?, ?> ast) {
+ return sourceDirectives.getConfiguration();
+ }
+ });
- compare(
- file.getName(),
- expectedFile,
- writer.toString(),
- expectedMessages,
- messages,
- params.printErrors());
+ transformCode(messages, writer, file);
+ compare(file.getName(), expected, writer.toString(), messages, params.printErrors(), sourceDirectives.isSkipCompareContent() || expected.isSkipCompareContent());
return true;
}
@@ -105,11 +97,6 @@ public abstract class AbstractRunTests {
return result.toString();
}
- private String readFile(File dir, File file, boolean messages) throws IOException {
- if (dir == null) return null;
- return readFile(new File(dir, file.getName() + (messages ? ".messages" : "")));
- }
-
private static File findPlaceToDumpActualFiles() {
String location = System.getProperty("lombok.tests.dump_actual_files");
if (location != null) {
@@ -141,17 +128,15 @@ public abstract class AbstractRunTests {
}
}
- private void compare(String name, String expectedFile, String actualFile, List<CompilerMessageMatcher> expectedMessages, LinkedHashSet<CompilerMessage> actualMessages, boolean printErrors) throws Throwable {
- if (expectedFile == null && expectedMessages.isEmpty()) expectedFile = "";
-
- if (expectedFile != null) try {
- compareContent(name, expectedFile, actualFile);
+ private void compare(String name, LombokTestSource expected, String actualFile, LinkedHashSet<CompilerMessage> actualMessages, boolean printErrors, boolean skipCompareContent) throws Throwable {
+ if (!skipCompareContent) try {
+ compareContent(name, expected.getContent(), actualFile);
} catch (Throwable e) {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
- System.out.println(expectedFile);
+ System.out.println(expected.getContent());
System.out.println("**** Actual ******");
System.out.println(actualFile);
if (actualMessages != null && !actualMessages.isEmpty()) {
@@ -169,13 +154,13 @@ public abstract class AbstractRunTests {
}
try {
- compareMessages(name, expectedMessages, actualMessages);
+ compareMessages(name, expected.getMessages(), actualMessages);
} catch (Throwable e) {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
- for (CompilerMessageMatcher expectedMessage : expectedMessages) {
+ for (CompilerMessageMatcher expectedMessage : expected.getMessages()) {
System.out.println(expectedMessage);
}
System.out.println("**** Actual ******");
@@ -191,7 +176,7 @@ public abstract class AbstractRunTests {
}
}
- private static void compareMessages(String name, List<CompilerMessageMatcher> expected, LinkedHashSet<CompilerMessage> actual) {
+ private static void compareMessages(String name, LombokImmutableList<CompilerMessageMatcher> expected, LinkedHashSet<CompilerMessage> actual) {
Iterator<CompilerMessageMatcher> expectedIterator = expected.iterator();
Iterator<CompilerMessage> actualIterator = actual.iterator();
@@ -215,15 +200,23 @@ public abstract class AbstractRunTests {
private static void compareContent(String name, String expectedFile, String actualFile) {
String[] expectedLines = expectedFile.split("(\\r?\\n)");
String[] actualLines = actualFile.split("(\\r?\\n)");
- if (expectedLines[0].startsWith("// Generated by delombok at ")) {
- expectedLines[0] = "";
+
+ for (int i = 0; i < expectedLines.length; i++) {
+ if (expectedLines[i].isEmpty() || expectedLines[i].startsWith("//")) expectedLines[i] = "";
+ else break;
}
- if (actualLines[0].startsWith("// Generated by delombok at ")) {
- actualLines[0] = "";
+ for (int i = 0; i < actualLines.length; i++) {
+ if (actualLines[i].isEmpty() || actualLines[i].startsWith("//")) actualLines[i] = "";
+ else break;
}
expectedLines = removeBlanks(expectedLines);
actualLines = removeBlanks(actualLines);
+
int size = Math.min(expectedLines.length, actualLines.length);
+ if (size == 0 && expectedLines.length + actualLines.length > 0) {
+ Assert.fail("Missing / empty expected file.");
+ }
+
for (int i = 0; i < size; i++) {
String expected = trimRight(expectedLines[i]);
String actual = trimRight(actualLines[i]);
diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java
index 5325c1e3..9062f523 100644
--- a/test/core/src/lombok/DirectoryRunner.java
+++ b/test/core/src/lombok/DirectoryRunner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2013 The Project Lombok Authors.
+ * Copyright (C) 2009-2014 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
@@ -21,16 +21,10 @@
*/
package lombok;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import lombok.eclipse.Eclipse;
import lombok.javac.Javac;
@@ -75,46 +69,8 @@ public class DirectoryRunner extends Runner {
public boolean accept(File file) {
return true;
}
-
- private static final Pattern P1 = Pattern.compile("^(\\d+)$");
- private static final Pattern P2 = Pattern.compile("^\\:(\\d+)$");
- private static final Pattern P3 = Pattern.compile("^(\\d+):$");
- private static final Pattern P4 = Pattern.compile("^(\\d+):(\\d+)$");
-
- public boolean shouldIgnoreBasedOnVersion(String firstLine) {
- int thisVersion = getVersion();
- if (!firstLine.startsWith("//version ")) return false;
-
- String spec = firstLine.substring("//version ".length());
-
- /* Single version: '5' */ {
- Matcher m = P1.matcher(spec);
- if (m.matches()) return Integer.parseInt(m.group(1)) != thisVersion;
- }
-
- /* Upper bound: ':5' (inclusive) */ {
- Matcher m = P2.matcher(spec);
- if (m.matches()) return Integer.parseInt(m.group(1)) < thisVersion;
- }
-
- /* Lower bound '5:' (inclusive) */ {
- Matcher m = P3.matcher(spec);
- if (m.matches()) return Integer.parseInt(m.group(1)) > thisVersion;
- }
-
- /* Range '7:8' (inclusive) */ {
- Matcher m = P4.matcher(spec);
- if (m.matches()) {
- if (Integer.parseInt(m.group(1)) < thisVersion) return true;
- if (Integer.parseInt(m.group(2)) > thisVersion) return true;
- return false;
- }
- }
-
- throw new IllegalArgumentException("Version validity spec not valid: " + spec);
- }
}
-
+
private static final FileFilter JAVA_FILE_FILTER = new FileFilter() {
@Override public boolean accept(File file) {
return file.isFile() && file.getName().endsWith(".java");
@@ -180,9 +136,7 @@ public class DirectoryRunner extends Runner {
private boolean runTest(String fileName) throws Throwable {
File file = new File(params.getBeforeDirectory(), fileName);
- if (mustIgnore(file)) {
- return false;
- }
+
switch (params.getCompiler()) {
case DELOMBOK:
return new RunTestsViaDelombok().compareFile(params, file);
@@ -193,11 +147,4 @@ public class DirectoryRunner extends Runner {
throw new UnsupportedOperationException();
}
}
-
- private boolean mustIgnore(File file) throws FileNotFoundException, IOException {
- BufferedReader reader = new BufferedReader(new FileReader(file));
- String line = reader.readLine();
- reader.close();
- return line != null && (line.startsWith("//ignore") || params.shouldIgnoreBasedOnVersion(line));
- }
}
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
new file mode 100644
index 00000000..318c5885
--- /dev/null
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2014 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.Assert;
+
+import lombok.core.LombokImmutableList;
+import lombok.core.configuration.BubblingConfigurationResolver;
+import lombok.core.configuration.ConfigurationProblemReporter;
+import lombok.core.configuration.ConfigurationResolver;
+import lombok.core.configuration.StringConfigurationSource;
+
+public class LombokTestSource {
+ private final File file;
+ private final String content;
+ private final LombokImmutableList<CompilerMessageMatcher> messages;
+ private final boolean ignore;
+ private final boolean skipCompareContent;
+ private final int versionLowerLimit, versionUpperLimit;
+ private final ConfigurationResolver configuration;
+
+ public boolean versionWithinLimit(int version) {
+ return version >= versionLowerLimit && version <= versionUpperLimit;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public LombokImmutableList<CompilerMessageMatcher> getMessages() {
+ return messages;
+ }
+
+ public boolean isIgnore() {
+ return ignore;
+ }
+
+ public boolean isSkipCompareContent() {
+ return skipCompareContent;
+ }
+
+ public ConfigurationResolver getConfiguration() {
+ return configuration;
+ }
+
+ private static final Pattern VERSION_STYLE_1 = Pattern.compile("^(\\d+)$");
+ private static final Pattern VERSION_STYLE_2 = Pattern.compile("^\\:(\\d+)$");
+ private static final Pattern VERSION_STYLE_3 = Pattern.compile("^(\\d+):$");
+ private static final Pattern VERSION_STYLE_4 = Pattern.compile("^(\\d+):(\\d+)$");
+
+ private int[] parseVersionLimit(String spec) {
+ /* Single version: '5' */ {
+ Matcher m = VERSION_STYLE_1.matcher(spec);
+ if (m.matches()) {
+ int v = Integer.parseInt(m.group(1));
+ return new int[] {v, v};
+ }
+ }
+
+ /* Upper bound: ':5' (inclusive) */ {
+ Matcher m = VERSION_STYLE_2.matcher(spec);
+ if (m.matches()) return new int[] {0, Integer.parseInt(m.group(1))};
+ }
+
+ /* Lower bound '5:' (inclusive) */ {
+ Matcher m = VERSION_STYLE_3.matcher(spec);
+ if (m.matches()) return new int[] {Integer.parseInt(m.group(1)), 0};
+ }
+
+ /* Range '7:8' (inclusive) */ {
+ Matcher m = VERSION_STYLE_4.matcher(spec);
+ if (m.matches()) return new int[] {Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2))};
+ }
+
+ return null;
+ }
+
+ private static final Pattern IGNORE_PATTERN = Pattern.compile("^\\s*ignore\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern SKIP_COMPARE_CONTENT_PATTERN = Pattern.compile("^\\s*skip[- ]?compare[- ]?content\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
+
+ private LombokTestSource(File file, String content, List<CompilerMessageMatcher> messages, List<String> directives) {
+ this.file = file;
+ this.content = content;
+ this.messages = messages == null ? LombokImmutableList.<CompilerMessageMatcher>of() : LombokImmutableList.copyOf(messages);
+
+ StringBuilder conf = new StringBuilder();
+ int versionLower = 0;
+ int versionUpper = Integer.MAX_VALUE;
+ boolean ignore = false;
+ boolean skipCompareContent = false;
+
+ for (String directive : directives) {
+ directive = directive.trim();
+ String lc = directive.toLowerCase();
+ if (IGNORE_PATTERN.matcher(directive).matches()) {
+ ignore = true;
+ continue;
+ }
+
+ if (SKIP_COMPARE_CONTENT_PATTERN.matcher(directive).matches()) {
+ skipCompareContent = true;
+ continue;
+ }
+
+ if (lc.startsWith("version ")) {
+ int[] limits = parseVersionLimit(lc.substring(7).trim());
+ if (limits == null) {
+ Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: version must be followed by a single integer.");
+ throw new RuntimeException();
+ }
+ versionLower = limits[0];
+ versionUpper = limits[1];
+ continue;
+ }
+
+ if (lc.startsWith("conf:")) {
+ String confLine = directive.substring(5).trim();
+ conf.append(confLine).append("\n");
+ continue;
+ }
+
+ Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: unrecognized directive.");
+ throw new RuntimeException();
+ }
+
+ this.versionLowerLimit = versionLower;
+ this.versionUpperLimit = versionUpper;
+ this.ignore = ignore;
+ this.skipCompareContent = skipCompareContent;
+ ConfigurationProblemReporter reporter = new ConfigurationProblemReporter() {
+ @Override public void report(String sourceDescription, String problem, int lineNumber, CharSequence line) {
+ Assert.fail("Problem on directive line: " + problem + " at conf line #" + lineNumber + " (" + line + ")");
+ }
+ };
+
+ this.configuration = new BubblingConfigurationResolver(Collections.singleton(StringConfigurationSource.forString(conf, reporter, file.getAbsolutePath())));
+ }
+
+ public static LombokTestSource readDirectives(File file) throws IOException {
+ List<String> directives = new ArrayList<String>();
+
+ {
+ @Cleanup val rawIn = new FileInputStream(file);
+ BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8"));
+ for (String i = in.readLine(); i != null; i = in.readLine()) {
+ if (i.isEmpty()) continue;
+
+ if (i.startsWith("//")) {
+ directives.add(i.substring(2));
+ } else {
+ break;
+ }
+ }
+ in.close();
+ rawIn.close();
+ }
+
+ return new LombokTestSource(file, "", null, directives);
+ }
+
+ public static LombokTestSource read(File sourceFolder, File messagesFolder, String fileName) throws IOException {
+ StringBuilder content = null;
+ List<String> directives = new ArrayList<String>();
+
+ File sourceFile = new File(sourceFolder, fileName);
+ if (sourceFile.exists()) {
+ @Cleanup val rawIn = new FileInputStream(sourceFile);
+ BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8"));
+ for (String i = in.readLine(); i != null; i = in.readLine()) {
+ if (content != null) {
+ content.append(i).append("\n");
+ continue;
+ }
+
+ if (i.isEmpty()) continue;
+
+ if (i.startsWith("//")) {
+ directives.add(i.substring(2));
+ } else {
+ content = new StringBuilder();
+ content.append(i).append("\n");
+ }
+ }
+ in.close();
+ rawIn.close();
+ }
+
+ if (content == null) content = new StringBuilder();
+
+ List<CompilerMessageMatcher> messages = null;
+ if (messagesFolder != null) {
+ File messagesFile = new File(messagesFolder, fileName + ".messages");
+ try {
+ @Cleanup val rawIn = new FileInputStream(messagesFile);
+ messages = CompilerMessageMatcher.readAll(rawIn);
+ rawIn.close();
+ } catch (FileNotFoundException e) {
+ messages = null;
+ }
+ }
+
+ return new LombokTestSource(sourceFile, content.toString(), messages, directives);
+ }
+}
diff --git a/test/core/src/lombok/RunAllTests.java b/test/core/src/lombok/RunAllTests.java
index 0076e662..9f56b45b 100644
--- a/test/core/src/lombok/RunAllTests.java
+++ b/test/core/src/lombok/RunAllTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Project Lombok Authors.
+ * Copyright (C) 2011-2014 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
@@ -26,6 +26,6 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({lombok.transform.RunTransformTests.class, lombok.bytecode.RunBytecodeTests.class})
+@SuiteClasses({lombok.transform.RunTransformTests.class, lombok.bytecode.RunBytecodeTests.class, lombok.core.configuration.RunConfigurationTests.class})
public class RunAllTests {
}
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 17665173..6a08642b 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2013 The Project Lombok Authors.
+ * Copyright (C) 2009-2014 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
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 4f3e2794..2734eb43 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -107,6 +107,8 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
};
+ // TODO: Create a configuration based on confLines and set this up so that this compile run will use them.
+
ecjCompiler.compile(new ICompilationUnit[] {sourceUnit});
CompilationResult compilationResult = compilationResult_.get();
diff --git a/test/transform/resource/after-delombok/AccessorsConfiguration.java b/test/transform/resource/after-delombok/AccessorsConfiguration.java
new file mode 100644
index 00000000..fd60b152
--- /dev/null
+++ b/test/transform/resource/after-delombok/AccessorsConfiguration.java
@@ -0,0 +1,26 @@
+class AccessorsConfiguration {
+ private String m_FieldName = "";
+ @java.lang.SuppressWarnings("all")
+ public String fieldName() {
+ return this.m_FieldName;
+ }
+ @java.lang.SuppressWarnings("all")
+ public void fieldName(final String m_FieldName) {
+ this.m_FieldName = m_FieldName;
+ }
+}
+class AccessorsConfiguration2 {
+ private String m_FieldName = "";
+ @java.lang.SuppressWarnings("all")
+ public void setM_FieldName(final String m_FieldName) {
+ this.m_FieldName = m_FieldName;
+ }
+}
+class AccessorsConfiguration3 {
+ private String fFieldName = "";
+ @java.lang.SuppressWarnings("all")
+ public AccessorsConfiguration3 setFieldName(final String fFieldName) {
+ this.fFieldName = fFieldName;
+ return this;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/LoggerConfig.java b/test/transform/resource/after-delombok/LoggerConfig.java
new file mode 100644
index 00000000..ba955638
--- /dev/null
+++ b/test/transform/resource/after-delombok/LoggerConfig.java
@@ -0,0 +1,4 @@
+class LoggerWithConfig {
+ @java.lang.SuppressWarnings("all")
+ private final org.slf4j.Logger myLogger = org.slf4j.LoggerFactory.getLogger(LoggerWithConfig.class);
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ToStringConfiguration.java b/test/transform/resource/after-delombok/ToStringConfiguration.java
new file mode 100644
index 00000000..035ecdb2
--- /dev/null
+++ b/test/transform/resource/after-delombok/ToStringConfiguration.java
@@ -0,0 +1,32 @@
+class ToStringConfiguration {
+ int x;
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "ToStringConfiguration(" + this.x + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getX() {
+ return this.x;
+ }
+}
+class ToStringConfiguration2 {
+ int x;
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "ToStringConfiguration2(x=" + this.x + ")";
+ }
+}
+class ToStringConfiguration3 {
+ int x;
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "ToStringConfiguration3(" + this.getX() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getX() {
+ return this.x;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/AccessorsConfiguration.java b/test/transform/resource/after-ecj/AccessorsConfiguration.java
new file mode 100644
index 00000000..6678e020
--- /dev/null
+++ b/test/transform/resource/after-ecj/AccessorsConfiguration.java
@@ -0,0 +1,31 @@
+class AccessorsConfiguration {
+ private @lombok.Getter @lombok.Setter @lombok.experimental.Accessors(fluent = true) String m_FieldName = "";
+ AccessorsConfiguration() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") String fieldName() {
+ return this.m_FieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void fieldName(final String m_FieldName) {
+ this.m_FieldName = m_FieldName;
+ }
+}
+@lombok.experimental.Accessors(prefix = {}) class AccessorsConfiguration2 {
+ private @lombok.Setter String m_FieldName = "";
+ AccessorsConfiguration2() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") void setM_FieldName(final String m_FieldName) {
+ this.m_FieldName = m_FieldName;
+ }
+}
+@lombok.experimental.Accessors(chain = true) class AccessorsConfiguration3 {
+ private @lombok.Setter String fFieldName = "";
+ AccessorsConfiguration3() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") AccessorsConfiguration3 setFieldName(final String fFieldName) {
+ this.fFieldName = fFieldName;
+ return this;
+ }
+}
diff --git a/test/transform/resource/after-ecj/LoggerConfig.java b/test/transform/resource/after-ecj/LoggerConfig.java
new file mode 100644
index 00000000..907a7167
--- /dev/null
+++ b/test/transform/resource/after-ecj/LoggerConfig.java
@@ -0,0 +1,6 @@
+@lombok.extern.slf4j.Slf4j class LoggerWithConfig {
+ private final org.slf4j.Logger myLogger = org.slf4j.LoggerFactory.getLogger(LoggerWithConfig.class);
+ LoggerWithConfig() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ToStringConfiguration.java b/test/transform/resource/after-ecj/ToStringConfiguration.java
new file mode 100644
index 00000000..8bb99146
--- /dev/null
+++ b/test/transform/resource/after-ecj/ToStringConfiguration.java
@@ -0,0 +1,35 @@
+import lombok.ToString;
+import lombok.Getter;
+@ToString @Getter class ToStringConfiguration {
+ int x;
+ ToStringConfiguration() {
+ super();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("ToStringConfiguration(" + this.x) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+}
+@ToString(includeFieldNames = true) class ToStringConfiguration2 {
+ int x;
+ ToStringConfiguration2() {
+ super();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("ToStringConfiguration2(x=" + this.x) + ")");
+ }
+}
+@ToString(doNotUseGetters = false) @Getter class ToStringConfiguration3 {
+ int x;
+ ToStringConfiguration3() {
+ super();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("ToStringConfiguration3(" + this.getX()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/AccessorsConfiguration.java b/test/transform/resource/before/AccessorsConfiguration.java
new file mode 100644
index 00000000..187fd393
--- /dev/null
+++ b/test/transform/resource/before/AccessorsConfiguration.java
@@ -0,0 +1,20 @@
+//CONF: lombok.Accessors.prefix += m_
+//CONF: lombok.Accessors.prefix += f
+//CONF: lombok.Accessors.chain = false
+
+class AccessorsConfiguration {
+ @lombok.Getter @lombok.Setter @lombok.experimental.Accessors(fluent=true)
+ private String m_FieldName = "";
+}
+
+@lombok.experimental.Accessors(prefix = {})
+class AccessorsConfiguration2 {
+ @lombok.Setter
+ private String m_FieldName = "";
+}
+
+@lombok.experimental.Accessors(chain = true)
+class AccessorsConfiguration3 {
+ @lombok.Setter
+ private String fFieldName = "";
+}
diff --git a/test/transform/resource/before/BuilderInvalidUse.java b/test/transform/resource/before/BuilderInvalidUse.java
index 07f37d3d..d7052e1e 100644
--- a/test/transform/resource/before/BuilderInvalidUse.java
+++ b/test/transform/resource/before/BuilderInvalidUse.java
@@ -1,3 +1,4 @@
+//skip compare content
@lombok.experimental.Builder
class BuilderInvalidUse {
private int something;
diff --git a/test/transform/resource/before/DelegateOnStatic.java b/test/transform/resource/before/DelegateOnStatic.java
index ef56ef54..84d99636 100644
--- a/test/transform/resource/before/DelegateOnStatic.java
+++ b/test/transform/resource/before/DelegateOnStatic.java
@@ -1,3 +1,4 @@
+//skip compare content
import lombok.Delegate;
import lombok.Getter;
diff --git a/test/transform/resource/before/FlagUsages.java b/test/transform/resource/before/FlagUsages.java
new file mode 100644
index 00000000..6631224f
--- /dev/null
+++ b/test/transform/resource/before/FlagUsages.java
@@ -0,0 +1,11 @@
+//skip compare content
+//CONF: lombok.Getter.flagUsage = WARNING
+//CONF: lombok.experimental.flagUsage = ERROR
+public class FlagUsages {
+ @lombok.Getter String x;
+
+ @lombok.experimental.Wither String z;
+
+ public FlagUsages(String x, String y) {
+ }
+}
diff --git a/test/transform/resource/before/LoggerConfig.java b/test/transform/resource/before/LoggerConfig.java
new file mode 100644
index 00000000..14195e03
--- /dev/null
+++ b/test/transform/resource/before/LoggerConfig.java
@@ -0,0 +1,5 @@
+//CONF: lombok.log.fieldName = myLogger
+//CONF: lombok.log.fieldIsStatic = false
+@lombok.extern.slf4j.Slf4j
+class LoggerWithConfig {
+}
diff --git a/test/transform/resource/before/ToStringConfiguration.java b/test/transform/resource/before/ToStringConfiguration.java
new file mode 100644
index 00000000..7630cda5
--- /dev/null
+++ b/test/transform/resource/before/ToStringConfiguration.java
@@ -0,0 +1,13 @@
+//CONF: lombok.ToString.includeFieldNames = false
+//CONF: lombok.ToString.doNotUseGetters = true
+import lombok.ToString;
+import lombok.Getter;
+@ToString @Getter class ToStringConfiguration {
+ int x;
+}
+@ToString(includeFieldNames=true) class ToStringConfiguration2 {
+ int x;
+}
+@ToString(doNotUseGetters=false) @Getter class ToStringConfiguration3 {
+ int x;
+}
diff --git a/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages b/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages
index a04b4f9b..506a3426 100644
--- a/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages
+++ b/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages
@@ -1,2 +1,2 @@
-1 @Getter, @Setter, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
-12 @Value is not allowed on builder classes. \ No newline at end of file
+2 @Getter, @Setter, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
+13 @Value is not allowed on builder classes. \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/DelegateOnStatic.java.messages b/test/transform/resource/messages-delombok/DelegateOnStatic.java.messages
index b807b155..51dcf501 100644
--- a/test/transform/resource/messages-delombok/DelegateOnStatic.java.messages
+++ b/test/transform/resource/messages-delombok/DelegateOnStatic.java.messages
@@ -1,2 +1,2 @@
-5 @Delegate is legal only on instance fields or no-argument instance methods.
-9 @Delegate is legal only on instance fields or no-argument instance methods. \ No newline at end of file
+6 @Delegate is legal only on instance fields or no-argument instance methods.
+10 @Delegate is legal only on instance fields or no-argument instance methods. \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/FlagUsages.java.messages b/test/transform/resource/messages-delombok/FlagUsages.java.messages
new file mode 100644
index 00000000..13a148b1
--- /dev/null
+++ b/test/transform/resource/messages-delombok/FlagUsages.java.messages
@@ -0,0 +1,2 @@
+5 Use of @Getter is flagged according to lombok configuration.
+7 Use of any lombok.experimental feature is flagged according to lombok configuration.
diff --git a/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages b/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages
index 84942101..c5571b92 100644
--- a/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages
+++ b/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages
@@ -1,2 +1,2 @@
-1 @Getter, @Setter, @FieldDefaults, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
-12 @Value is not allowed on builder classes. \ No newline at end of file
+2 @Getter, @Setter, @FieldDefaults, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
+13 @Value is not allowed on builder classes. \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/DelegateOnStatic.java.messages b/test/transform/resource/messages-ecj/DelegateOnStatic.java.messages
index b807b155..51dcf501 100644
--- a/test/transform/resource/messages-ecj/DelegateOnStatic.java.messages
+++ b/test/transform/resource/messages-ecj/DelegateOnStatic.java.messages
@@ -1,2 +1,2 @@
-5 @Delegate is legal only on instance fields or no-argument instance methods.
-9 @Delegate is legal only on instance fields or no-argument instance methods. \ No newline at end of file
+6 @Delegate is legal only on instance fields or no-argument instance methods.
+10 @Delegate is legal only on instance fields or no-argument instance methods. \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/FlagUsages.java.messages b/test/transform/resource/messages-ecj/FlagUsages.java.messages
new file mode 100644
index 00000000..13a148b1
--- /dev/null
+++ b/test/transform/resource/messages-ecj/FlagUsages.java.messages
@@ -0,0 +1,2 @@
+5 Use of @Getter is flagged according to lombok configuration.
+7 Use of any lombok.experimental feature is flagged according to lombok configuration.