Skip to content

Commit 575d683

Browse files
authored
Add Jakarta Validation's Valid and constraints annotations (#2335 fixes #2334)
2 parents 22d9f3d + 649eb59 commit 575d683

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1414
* Bump default `ktlint` version to latest `1.3.0` -> `1.4.0`. ([#2314](https://github.com/diffplug/spotless/pull/2314))
1515
* Add _Sort Members_ feature based on [Eclipse JDT](plugin-gradle/README.md#eclipse-jdt) implementation. ([#2312](https://github.com/diffplug/spotless/pull/2312))
1616
* Bump default `jackson` version to latest `2.18.0` -> `2.18.1`. ([#2319](https://github.com/diffplug/spotless/pull/2319))
17-
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320)
17+
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320))
1818
### Fixed
1919
* You can now use `removeUnusedImports` and `googleJavaFormat` at the same time again. (fixes [#2159](https://github.com/diffplug/spotless/issues/2159))
20+
* The default list of type annotations used by `formatAnnotations` now includes Jakarta Validation's `Valid` and constraints validations (fixes [#2334](https://github.com/diffplug/spotless/issues/2334))
2021

2122
## [3.0.0.BETA4] - 2024-10-24
2223
### Added

lib/src/main/java/com/diffplug/spotless/java/FormatAnnotationsStep.java

+21
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public final class FormatAnnotationsStep implements Serializable {
7171
"ArrayLen",
7272
"ArrayLenRange",
7373
"ArrayWithoutPackage",
74+
"AssertFalse",
75+
"AssertTrue",
7476
"AwtAlphaCompositingRule",
7577
"AwtColorSpace",
7678
"AwtCursorType",
@@ -108,14 +110,18 @@ public final class FormatAnnotationsStep implements Serializable {
108110
"Critical",
109111
"Current",
110112
"D",
113+
"DecimalMax",
114+
"DecimalMin",
111115
"DefaultType",
112116
"degrees",
113117
"Det",
118+
"Digits",
114119
"DoesNotMatchRegex",
115120
"DotSeparatedIdentifiers",
116121
"DotSeparatedIdentifiersOrPrimitiveType",
117122
"DoubleVal",
118123
"E",
124+
"Email",
119125
"Encrypted",
120126
"EnhancedRegex",
121127
"EnumVal",
@@ -139,6 +145,8 @@ public final class FormatAnnotationsStep implements Serializable {
139145
"FqBinaryName",
140146
"Frequency",
141147
"FullyQualifiedName",
148+
"Future",
149+
"FutureOrPresent",
142150
"g",
143151
"GTENegativeOne",
144152
"GuardedBy",
@@ -213,6 +221,7 @@ public final class FormatAnnotationsStep implements Serializable {
213221
"m3",
214222
"Mass",
215223
"MatchesRegex",
224+
"Max",
216225
"MaybeAliased",
217226
"MaybeDerivedFromConstant",
218227
"MaybePresent",
@@ -221,6 +230,7 @@ public final class FormatAnnotationsStep implements Serializable {
221230
"MethodVal",
222231
"MethodValBottom",
223232
"min",
233+
"Min",
224234
"MinLen",
225235
"mm",
226236
"mm2",
@@ -235,7 +245,9 @@ public final class FormatAnnotationsStep implements Serializable {
235245
"MustCallAlias",
236246
"MustCallUnknown",
237247
"N",
248+
"Negative",
238249
"NegativeIndexFor",
250+
"NegativeOrZero",
239251
"NewObject",
240252
"NonConstant",
241253
"NonDet",
@@ -244,19 +256,25 @@ public final class FormatAnnotationsStep implements Serializable {
244256
"NonNull",
245257
"NonNullType",
246258
"NonRaw",
259+
"NotBlank",
247260
"NotCalledMethods",
261+
"NotEmpty",
248262
"NotNull",
249263
"NotQualifier",
250264
"NTDBottom",
251265
"NTDMiddle",
252266
"NTDSide",
253267
"NTDTop",
268+
"Null",
254269
"Nullable",
255270
"NullableType",
256271
"Odd",
257272
"OptionalBottom",
258273
"OrderNonDet",
259274
"Parent",
275+
"Past",
276+
"PastOrPresent",
277+
"Pattern",
260278
"PatternA",
261279
"PatternAB",
262280
"PatternAC",
@@ -297,6 +315,7 @@ public final class FormatAnnotationsStep implements Serializable {
297315
"PolyValue",
298316
"PolyVariableNameDefault",
299317
"Positive",
318+
"PositiveOrZero",
300319
"Present",
301320
"PrimitiveType",
302321
"PropertyKey",
@@ -326,6 +345,7 @@ public final class FormatAnnotationsStep implements Serializable {
326345
"SignednessGlb",
327346
"SignedPositive",
328347
"SignedPositiveFromUnsigned",
348+
"Size",
329349
"Speed",
330350
"StringVal",
331351
"SubQual",
@@ -381,6 +401,7 @@ public final class FormatAnnotationsStep implements Serializable {
381401
"UpperBoundBottom",
382402
"UpperBoundLiteral",
383403
"UpperBoundUnknown",
404+
"Valid",
384405
"ValueTypeAnno",
385406
"VariableNameDefaultBottom",
386407
"VariableNameDefaultMiddle",

plugin-gradle/CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
66
### Changed
77
* Bump default `ktlint` version to latest `1.3.0` -> `1.4.0`. ([#2314](https://github.com/diffplug/spotless/pull/2314))
88
* Bump default `jackson` version to latest `2.18.0` -> `2.18.1`. ([#2319](https://github.com/diffplug/spotless/pull/2319))
9-
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320)
9+
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320))
1010
### Fixed
1111
* You can now use `removeUnusedImports` and `googleJavaFormat` at the same time again. (fixes [#2159](https://github.com/diffplug/spotless/issues/2159))
12+
* The default list of type annotations used by `formatAnnotations` now includes Jakarta Validation's `Valid` and constraints validations (fixes [#2334](https://github.com/diffplug/spotless/issues/2334))
1213

1314
## [7.0.0.BETA4] - 2024-10-24
1415
### Added

plugin-maven/CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
66
### Changed
77
* Bump default `ktlint` version to latest `1.3.0` -> `1.4.0`. ([#2314](https://github.com/diffplug/spotless/pull/2314))
88
* Bump default `jackson` version to latest `2.18.0` -> `2.18.1`. ([#2319](https://github.com/diffplug/spotless/pull/2319))
9-
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320)
9+
* Bump default `ktfmt` version to latest `0.52` -> `0.53`. ([#2320](https://github.com/diffplug/spotless/pull/2320))
1010
### Fixed
1111
* You can now use `removeUnusedImports` and `googleJavaFormat` at the same time again. (fixes [#2159](https://github.com/diffplug/spotless/issues/2159))
12+
* The default list of type annotations used by `formatAnnotations` now includes Jakarta Validation's `Valid` and constraints validations (fixes [#2334](https://github.com/diffplug/spotless/issues/2334))
1213

1314
## [2.44.0.BETA4] - 2024-10-24
1415
### Added

0 commit comments

Comments
 (0)