Second paragraph contains an asterisk in a code element: {@code *}.
+ * @since 1.0
+ */
+ public void test() {
+ }
+
+}
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMethodHasEarlierSince.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMethodHasEarlierSince.java
new file mode 100644
index 00000000..d23d74ee
--- /dev/null
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMethodHasEarlierSince.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Javadoc with an earlier since tag on a method.
+ *
+ * @author Andy Wilkinson
+ * @since 2.0.0
+ */
+public class JavadocMethodHasEarlierSince {
+
+ /**
+ * Some method.
+ * @since 1.2.3
+ */
+ public void someMethod() {
+
+ }
+
+}
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMissingSince.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMissingSince.java
index 9f22ace8..c9afd407 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMissingSince.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocMissingSince.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonJavadocComment.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonJavadocComment.java
index 8f4b66d2..047b2a05 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonJavadocComment.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonJavadocComment.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2020 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSince.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSince.java
index 58e914d3..4f0f2fde 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSince.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSince.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ class JavadocNonPublicSince {
/**
* Inner class.
*
- * @since 1.2.3
+ * @since 1.2.4
*/
private static class Inner {
diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/FormatterOption.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideAnnotation.java
similarity index 72%
rename from spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/FormatterOption.java
rename to spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideAnnotation.java
index 5b2504ef..b79a5a85 100644
--- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/FormatterOption.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideAnnotation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,18 +14,23 @@
* limitations under the License.
*/
-package io.spring.javaformat.formatter;
-
/**
- * Options that can be used to configure a {@link Formatter}.
+ * Javadoc with a good since tag.
*
* @author Phillip Webb
+ * @since 1.2.3
*/
-public enum FormatterOption {
+public @interface JavadocNonPublicSinceInsideAnnotation {
/**
- * Show Eclipse NLS warnings.
+ * Inner enum.
+ *
+ * @since 1.2.4
*/
- SHOW_NLS_WARNINGS
+ enum Inner {
+
+ FOO
+
+ }
}
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideInterface.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideInterface.java
index a8fa5f47..c0e4b412 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideInterface.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocNonPublicSinceInsideInterface.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ public interface JavadocNonPublicSinceInsideInterface {
/**
* Inner enum.
*
- * @since 1.2.3
+ * @since 1.2.4
*/
enum Inner {
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocSoundtrack.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocSoundtrack.java
index ea598898..846bf48d 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocSoundtrack.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocSoundtrack.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2020 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocValid.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocValid.java
index 21d30add..6584ef36 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocValid.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JavadocValid.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,4 +46,34 @@ public void test2(String something) {
public String test3(String something) throws RuntimeException {
}
+ /**
+ * Class with a numeric date since.
+ * @since 28.12.2003
+ */
+ public class NumericDateSince {
+
+ /**
+ * Method with version-based since.
+ * @since 1.3.0
+ */
+ public void versionSince() {
+ }
+
+ }
+
+ /**
+ * Class with an alphanumeric date since.
+ * @since 16 April 2001
+ */
+ public class AlphanumericDateSince {
+
+ /**
+ * Method with version-based since.
+ * @since 1.3.0
+ */
+ public void versionSince() {
+ }
+
+ }
+
}
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaExtraParens.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaExtraParens.java
index c4f17b30..5e82a117 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaExtraParens.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaExtraParens.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaMissingParens.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaMissingParens.java
index 4e621d28..9ab33a37 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaMissingParens.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaMissingParens.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryBlock.java
index 86807333..cfb42294 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryEmptyBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryEmptyBlock.java
index d1f83089..b8246fee 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryEmptyBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryEmptyBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfBlock.java
index 4208b212..5468bb48 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfElseBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfElseBlock.java
index 059bb564..473fa096 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfElseBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryIfElseBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryThrowBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryThrowBlock.java
index 24f4da47..61350fe8 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryThrowBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryThrowBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryTryBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryTryBlock.java
index d2f5cde9..2c874d0d 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryTryBlock.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryTryBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryVoidCallable.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryVoidCallable.java
index c9cab5fa..54864d72 100644
--- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryVoidCallable.java
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaNecessaryVoidCallable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 the original author or authors.
+ * Copyright 2017-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaSwitch.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaSwitch.java
new file mode 100644
index 00000000..55640621
--- /dev/null
+++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LambdaSwitch.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.function.Function;
+
+/**
+ * Lambda in a switch statement.
+ *
+ * @author Josef Reichardt
+ */
+public class LambdaSwitch {
+
+ private void sayHello(String[] args) {
+ Function
+ * Consider creating a special no-op marker class or interface in each package that
+ * serves no purpose other than being referenced by this attribute.
+ * @return base packages to scan
+ * @since 1.3.0
+ */
+ @AliasFor(annotation = ComponentScan.class, attribute = "basePackageClasses")
+ Class>[] scanBasePackageClasses() default {};
+
+}
diff --git a/spring-javaformat/spring-javaformat-formatter/src/test/resources/expected/static-initializer.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/static-initializer.txt
similarity index 100%
rename from spring-javaformat/spring-javaformat-formatter/src/test/resources/expected/static-initializer.txt
rename to spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/static-initializer.txt
diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/switch.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/switch.txt
new file mode 100644
index 00000000..87ae995d
--- /dev/null
+++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/switch.txt
@@ -0,0 +1,14 @@
+public class SwitchExample {
+
+ protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
+ switch (getErrorProperties().getIncludeBindingErrors()) {
+ case ALWAYS:
+ return true;
+ case ON_PARAM:
+ return getErrorsParameter(request);
+ default:
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/spring-javaformat/spring-javaformat-formatter/src/test/resources/expected/typical.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/typical.txt
similarity index 98%
rename from spring-javaformat/spring-javaformat-formatter/src/test/resources/expected/typical.txt
rename to spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/typical.txt
index b88780c1..e370bf0e 100644
--- a/spring-javaformat/spring-javaformat-formatter/src/test/resources/expected/typical.txt
+++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/typical.txt
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/v17/record-with-generic.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/v17/record-with-generic.txt
new file mode 100644
index 00000000..45528043
--- /dev/null
+++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/v17/record-with-generic.txt
@@ -0,0 +1,11 @@
+package simple;
+
+/**
+ * Record with generic.
+ *
+ * @author Andy Wilkinson
+ * @since 1.0.0
+ */
+public record SomeRecord
+ * Consider creating a special no-op marker class or interface in each package that
+ * serves no purpose other than being referenced by this attribute.
+ * @return base packages to scan
+ * @since 1.3.0
+ */
+ @AliasFor(annotation = ComponentScan.class, attribute = "basePackageClasses")
+ Class>[] scanBasePackageClasses() default {};
+
+}
diff --git a/spring-javaformat/spring-javaformat-formatter/src/test/resources/source/static-initializer.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/static-initializer.txt
similarity index 100%
rename from spring-javaformat/spring-javaformat-formatter/src/test/resources/source/static-initializer.txt
rename to spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/static-initializer.txt
diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/switch.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/switch.txt
new file mode 100644
index 00000000..2f58321f
--- /dev/null
+++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/switch.txt
@@ -0,0 +1,12 @@
+public class SwitchExample {
+ protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
+ switch (getErrorProperties().getIncludeBindingErrors()) {
+ case ALWAYS:
+ return true;
+ case ON_PARAM:
+ return getErrorsParameter(request);
+ default:
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-javaformat/spring-javaformat-formatter/src/test/resources/source/typical.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/typical.txt
similarity index 98%
rename from spring-javaformat/spring-javaformat-formatter/src/test/resources/source/typical.txt
rename to spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/typical.txt
index b88780c1..e370bf0e 100644
--- a/spring-javaformat/spring-javaformat-formatter/src/test/resources/source/typical.txt
+++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/typical.txt
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml
index 9cc901b1..d4642459 100644
--- a/spring-javaformat/spring-javaformat-formatter/pom.xml
+++ b/spring-javaformat/spring-javaformat-formatter/pom.xml
@@ -6,7 +6,7 @@