From 8495f2972c4f8d2bb229901382ea2cc5f7c2759a Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Sat, 8 Jun 2024 15:24:12 +0000 Subject: [PATCH 01/29] Next development version (v0.0.43-SNAPSHOT) --- README.adoc | 2 +- pom.xml | 2 +- samples/spring-javaformat-gradle-sample/build.gradle | 4 ++-- samples/spring-javaformat-maven-sample/pom.xml | 2 +- .../io.spring.javaformat.eclipse.feature/feature.xml | 4 ++-- .../io.spring.javaformat.eclipse.feature/pom.xml | 2 +- .../io.spring.javaformat.eclipse.site/category.xml | 2 +- .../io.spring.javaformat.eclipse.product | 2 +- .../io.spring.javaformat.eclipse.site/pom.xml | 2 +- .../io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse.tests/pom.xml | 2 +- .../io.spring.javaformat.eclipse/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse/pom.xml | 2 +- spring-javaformat-eclipse/pom.xml | 2 +- .../io.spring.javaformat.gradle.plugin/pom.xml | 2 +- spring-javaformat-gradle/pom.xml | 2 +- .../spring-javaformat-gradle-plugin/pom.xml | 2 +- spring-javaformat-intellij-idea/pom.xml | 2 +- .../spring-javaformat-intellij-idea-plugin/pom.xml | 2 +- .../spring-javaformat-intellij-idea-runtime/pom.xml | 2 +- spring-javaformat-maven/pom.xml | 2 +- .../spring-javaformat-maven-plugin/pom.xml | 2 +- spring-javaformat-vscode/pom.xml | 2 +- .../spring-javaformat-vscode-extension/package-lock.json | 4 ++-- .../spring-javaformat-vscode-extension/package.json | 2 +- .../spring-javaformat-vscode-extension/pom.xml | 2 +- spring-javaformat/pom.xml | 2 +- spring-javaformat/spring-javaformat-checkstyle/pom.xml | 2 +- spring-javaformat/spring-javaformat-config/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk17/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-rewriter/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-runtime/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shaded/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shader/pom.xml | 2 +- .../spring-javaformat-formatter-test-support/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter/pom.xml | 2 +- 42 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.adoc b/README.adoc index 72133a36..60e85607 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -:release-version: 0.0.41 +:release-version: 0.0.42 :checkstyle-version: 9.3 == Spring Java Format diff --git a/pom.xml b/pom.xml index 1ed8adf2..a619156b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT pom Spring JavaFormat Build Spring JavaFormat diff --git a/samples/spring-javaformat-gradle-sample/build.gradle b/samples/spring-javaformat-gradle-sample/build.gradle index 58e98809..b3bc0f41 100644 --- a/samples/spring-javaformat-gradle-sample/build.gradle +++ b/samples/spring-javaformat-gradle-sample/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.42-SNAPSHOT") + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.43-SNAPSHOT") } } @@ -25,5 +25,5 @@ checkstyle { } dependencies { - checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.42-SNAPSHOT") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.43-SNAPSHOT") } diff --git a/samples/spring-javaformat-maven-sample/pom.xml b/samples/spring-javaformat-maven-sample/pom.xml index 3fa9bfe5..cec0c38e 100644 --- a/samples/spring-javaformat-maven-sample/pom.xml +++ b/samples/spring-javaformat-maven-sample/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT UTF-8 - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml index 1eabec83..b50eb61c 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ @@ -22,7 +22,7 @@ id="io.spring.javaformat.eclipse" download-size="0" install-size="0" - version="0.0.42.qualifier" + version="0.0.43.qualifier" unpack="false"/> diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml index 84a96e0f..f0447048 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT io.spring.javaformat.eclipse.feature eclipse-feature diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml index 8a7fb79c..3bb9eaf8 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml @@ -3,7 +3,7 @@ Maven Integration for Eclipse (maven-eclipse-plugin support) - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product index eefcd0ae..511b7d62 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product @@ -1,7 +1,7 @@ - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml index 9cf30470..806bab83 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT io.spring.javaformat.eclipse.site eclipse-repository diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF index 6c3c7374..eed2c0de 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Tests Bundle-SymbolicName: io.spring.javaformat.eclipse.tests Automatic-Module-Name: io.spring.javaformat.eclipse.tests -Bundle-Version: 0.0.42.qualifier +Bundle-Version: 0.0.43.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., lib/assertj-core.jar, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml index 7452fede..29003f38 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT io.spring.javaformat.eclipse.tests eclipse-test-plugin diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF index b7e8245f..5bbf628e 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Bundle-SymbolicName: io.spring.javaformat.eclipse;singleton:=true Automatic-Module-Name: io.spring.javaformat.eclipse -Bundle-Version: 0.0.42.qualifier +Bundle-Version: 0.0.43.qualifier Bundle-Activator: io.spring.javaformat.eclipse.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml index d309137a..81e1a81b 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT io.spring.javaformat.eclipse eclipse-plugin diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml index fad27c8b..c1f85ed9 100644 --- a/spring-javaformat-eclipse/pom.xml +++ b/spring-javaformat-eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-eclipse pom diff --git a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml index eeef2201..650c586f 100644 --- a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml +++ b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT io.spring.javaformat io.spring.javaformat.gradle.plugin diff --git a/spring-javaformat-gradle/pom.xml b/spring-javaformat-gradle/pom.xml index f5fa9333..e0da30d0 100644 --- a/spring-javaformat-gradle/pom.xml +++ b/spring-javaformat-gradle/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-gradle pom diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml index 2f5858a2..c96c929e 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-gradle-plugin pom diff --git a/spring-javaformat-intellij-idea/pom.xml b/spring-javaformat-intellij-idea/pom.xml index 5d3c5117..3605f2a0 100644 --- a/spring-javaformat-intellij-idea/pom.xml +++ b/spring-javaformat-intellij-idea/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-intellij-idea pom diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml index bc99603f..46ee2658 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-intellij-idea-plugin Spring JavaFormat IntelliJ IDEA Plugin diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml index 66560bca..8575c456 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-intellij-idea-runtime pom diff --git a/spring-javaformat-maven/pom.xml b/spring-javaformat-maven/pom.xml index 6af1736a..299baf24 100644 --- a/spring-javaformat-maven/pom.xml +++ b/spring-javaformat-maven/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-maven pom diff --git a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml index d5c84fe5..3e2efc32 100644 --- a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml +++ b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-maven - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-maven-plugin maven-plugin diff --git a/spring-javaformat-vscode/pom.xml b/spring-javaformat-vscode/pom.xml index a2c5c8ce..703c3a3c 100644 --- a/spring-javaformat-vscode/pom.xml +++ b/spring-javaformat-vscode/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-vscode pom diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index 5a0626dc..9572cc6f 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-javaformat-vscode-extension", - "version": "0.0.42-SNAPSHOT", + "version": "0.0.43-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-javaformat-vscode-extension", - "version": "0.0.42-SNAPSHOT", + "version": "0.0.43-SNAPSHOT", "devDependencies": { "@types/glob": "^8.0.1", "@types/mocha": "^10.0.1", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index 639c5b16..cdb080b7 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "spring-javaformat-vscode-extension", "description": "Spring JavaFormat Visual Studio Code Extension", "displayName": "Spring JavaFormat", - "version": "0.0.42-SNAPSHOT", + "version": "0.0.43-SNAPSHOT", "publisher": "io.spring.javaformat", "engines": { "vscode": "^1.75.0" diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml index f2162ee6..cdac8ac0 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-vscode - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-vscode-extension Spring JavaFormat Visual Studio Code Extension diff --git a/spring-javaformat/pom.xml b/spring-javaformat/pom.xml index 697cc5d5..fc14a0f0 100644 --- a/spring-javaformat/pom.xml +++ b/spring-javaformat/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat pom diff --git a/spring-javaformat/spring-javaformat-checkstyle/pom.xml b/spring-javaformat/spring-javaformat-checkstyle/pom.xml index 64eb5db8..98a45e42 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/pom.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-checkstyle Spring JavaFormat CheckStyle diff --git a/spring-javaformat/spring-javaformat-config/pom.xml b/spring-javaformat/spring-javaformat-config/pom.xml index bc6f0d6f..39d27d20 100644 --- a/spring-javaformat/spring-javaformat-config/pom.xml +++ b/spring-javaformat/spring-javaformat-config/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-config Spring JavaFormat Config diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF index 68f6b967..e8f28aee 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse Runtime JDK17 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17 -Bundle-Version: 0.0.42.qualifier +Bundle-Version: 0.0.43.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml index 9608ea8a..cda64abf 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-jdk17 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF index 8577d79f..6ceab19d 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse JDK8 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk8 -Bundle-Version: 0.0.42.qualifier +Bundle-Version: 0.0.43.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml index c14b90c0..0016a013 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-jdk8 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml index ba028fab..3f8b1057 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk17 Spring JavaFormat Eclipse JDT JDK-17 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml index eb9e11fa..83f65fb9 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk8 Spring JavaFormat Eclipse JDT JDK-8 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml index 6f6e7cbb..44a54dbd 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-rewriter Spring JavaFormat Eclipse Rewriter diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml index fc24ebcf..12ae265c 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-eclipse-runtime Spring JavaFormat Eclipse Runtime diff --git a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml index 9b1ef323..72eb47c8 100644 --- a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-shaded Spring JavaFormat Formatter Shaded diff --git a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml index 76eadbc2..601f6dd7 100644 --- a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-shader Spring JavaFormat Formatter Shader diff --git a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml index 6b857a01..9f247485 100644 --- a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-test-support Spring JavaFormat Formatter Test Support diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index 8439c6e9..bc439188 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter-tests Spring JavaFormat Formatter Tests diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml index f6aef680..3a6c41c3 100644 --- a/spring-javaformat/spring-javaformat-formatter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.42-SNAPSHOT + 0.0.43-SNAPSHOT spring-javaformat-formatter Spring JavaFormat Formatter From 97a9a641a07214c5838d16de4dcc3e88b7dcfdef Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 4 Jun 2024 17:01:33 -0700 Subject: [PATCH 02/29] Migrate release process to GitHub Actions Complete migration to GitHub Actions. See gh-411 --- .../actions/create-github-release/action.yml | 21 +++++++ .../changelog-generator.yml | 2 + .../publish-eclipse-update-site/action.yml | 22 +++++++ ...blish-eclipse-update-site-pom-template.xml | 60 +++++++++++++++++++ .../publish-eclipse-update-site.sh | 51 ++++++++++++++++ .github/actions/stage-code/action.yml | 1 - .github/artifacts.spec | 23 +++++++ .github/workflows/promote.yml | 59 +++++++++++++++++- 8 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 .github/actions/create-github-release/action.yml create mode 100644 .github/actions/create-github-release/changelog-generator.yml create mode 100644 .github/actions/publish-eclipse-update-site/action.yml create mode 100755 .github/actions/publish-eclipse-update-site/publish-eclipse-update-site-pom-template.xml create mode 100644 .github/actions/publish-eclipse-update-site/publish-eclipse-update-site.sh create mode 100644 .github/artifacts.spec diff --git a/.github/actions/create-github-release/action.yml b/.github/actions/create-github-release/action.yml new file mode 100644 index 00000000..1d72cd3a --- /dev/null +++ b/.github/actions/create-github-release/action.yml @@ -0,0 +1,21 @@ +name: Create GitHub Release +description: Create the release on GitHub with a changelog +inputs: + milestone: + required: true + token: + required: true +runs: + using: composite + steps: + - name: Generate Changelog + uses: spring-io/github-changelog-generator@v0.0.10 + with: + milestone: ${{ inputs.milestone }} + token: ${{ inputs.token }} + config-file: .github/actions/create-github-release/changelog-generator.yml + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ inputs.token }} + shell: bash + run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md diff --git a/.github/actions/create-github-release/changelog-generator.yml b/.github/actions/create-github-release/changelog-generator.yml new file mode 100644 index 00000000..2ce74a09 --- /dev/null +++ b/.github/actions/create-github-release/changelog-generator.yml @@ -0,0 +1,2 @@ +changelog: + repository: spring-io/spring-javaformat diff --git a/.github/actions/publish-eclipse-update-site/action.yml b/.github/actions/publish-eclipse-update-site/action.yml new file mode 100644 index 00000000..4235c9e8 --- /dev/null +++ b/.github/actions/publish-eclipse-update-site/action.yml @@ -0,0 +1,22 @@ +name: 'Publish Eclipse Update Site ' +inputs: + version: + required: true + build-number: + required: true + artifactory-username: + required: true + artifactory-password: + required: true +runs: + using: composite + steps: + - name: Stage + id: stage + shell: bash + run: . ${{ github.action_path }}/publish-eclipse-update-site.sh; + env: + VERSION: "${{ inputs.version }}" + BUILD_NUMBER: "${{ inputs.build-number }}" + ARTIFACTORY_USERNAME: "${{ inputs.artifactory-username }}" + ARTIFACTORY_PASSWORD: "${{ inputs.artifactory-password }}" diff --git a/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site-pom-template.xml b/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site-pom-template.xml new file mode 100755 index 00000000..6ee635e0 --- /dev/null +++ b/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site-pom-template.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + org.eclipse.m2e.maveneclipse + m2eclipse-maveneclipse-publish + 0.0.0-SNAPSHOT + pom + + 1.1.0 + + + + + org.eclipse.tycho.extras + tycho-p2-extras-plugin + ${tycho-extras-version} + + + prepare-package + + mirror + + + + + +##repositories## + + ${project.build.directory}/repository + true + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + prepare-package + + mvn + + + + + + + + + + + run + + + + + + + diff --git a/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site.sh b/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site.sh new file mode 100644 index 00000000..9ddcee29 --- /dev/null +++ b/.github/actions/publish-eclipse-update-site/publish-eclipse-update-site.sh @@ -0,0 +1,51 @@ +buildInfo=$( jfrog rt curl api/build/spring-javaformat-${VERSION}/${BUILD_NUMBER} ) +groupId=$( echo ${buildInfo} | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) +version=$( echo ${buildInfo} | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) + +echo "Publishing ${buildName}/${buildNumber} (${groupId}:${version}) to Eclipse Update Site" + +jfrog rt dl --build spring-javaformat-${VERSION}/${BUILD_NUMBER} '**/io.spring.javaformat.eclipse.site*.zip' + +curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ + -f \ + -H "X-Explode-Archive: true" \ + -X PUT \ + -T "io/spring/javaformat/io.spring.javaformat.eclipse.site/${version}/io.spring.javaformat.eclipse.site-${version}.zip" \ + "https://repo.spring.io/javaformat-eclipse-update-site/${version}/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } + +releasedVersions=$( curl -s -f -X GET https://repo.spring.io/api/storage/javaformat-eclipse-update-site | jq -r '.children[] | .uri' | cut -c 2- | grep '[0-9].*' | sort -V ) + +repositories="" +while read -r releasedVersion; do + echo "Adding repository for ${releasedVersion}" + repositories="${repositories}https://repo.spring.io/javaformat-eclipse-update-site/${releasedVersion}p2" +done <<< "${releasedVersions}" + +sed "s|##repositories##|${repositories}|" ${GITHUB_ACTION_PATH}/publish-eclipse-update-site-pom-template.xml > publish-eclipse-update-site-pom.xml +./mvnw -f publish-eclipse-update-site-pom.xml clean package || { echo "Failed to publish" >&2; exit 1; } + +curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ + -f \ + -X PUT \ + -T "target/repository/content.jar" \ + "https://repo.spring.io/javaformat-eclipse-update-site/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } + +curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ + -f \ + -X PUT \ + -T "target/repository/artifacts.jar" \ + "https://repo.spring.io/javaformat-eclipse-update-site/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } + +echo "Publish complete" diff --git a/.github/actions/stage-code/action.yml b/.github/actions/stage-code/action.yml index a71086eb..1fc1f060 100644 --- a/.github/actions/stage-code/action.yml +++ b/.github/actions/stage-code/action.yml @@ -1,5 +1,4 @@ name: 'Stage ' -description: 'Stage Code' inputs: current-version: required: true diff --git a/.github/artifacts.spec b/.github/artifacts.spec new file mode 100644 index 00000000..0f6c3aac --- /dev/null +++ b/.github/artifacts.spec @@ -0,0 +1,23 @@ +{ + "files": [ + { + "aql": { + "items.find": { + "$and": [ + { + "@build.name": "${buildName}", + "@build.number": "${buildNumber}", + "name": { + "$nmatch": "*.zip" + }, + "name": { + "$nmatch": "*.zip.asc" + } + } + ] + } + }, + "target": "nexus/" + } + ] +} diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 968b265f..cad6e40b 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -33,5 +33,60 @@ jobs: name: Promote runs-on: ubuntu-latest steps: - - name: Promote - run: echo "Promote happens here" + - name: Check Out + uses: actions/checkout@v4 + - name: Set Up JFrog CLI + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 + env: + JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + - name: Check Maven Central Sync Status + id: check-sync-status + run: | + url=${{ format('https://repo.maven.apache.org/maven2/io/spring/javaformat/spring-javaformat/{0}/spring-javaformat-{0}.pom', inputs.version) }} + status_code=$( curl --write-out '%{http_code}' --head --silent --output /dev/null ${url} ) + if [ "${status_code}" != 200 ] && [ "${status_code}" != 404 ]; then + echo "Unexpected status code ${status_code}" + exit 1 + fi + echo "status-code=${status_code}" >> $GITHUB_OUTPUT + - name: Download Release Artifacts + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} + run: jf rt download --spec ./.github/artifacts.spec --spec-vars 'buildName=${{ format('spring-javaformat-{0}', inputs.version) }};buildNumber=${{ inputs.build-number }}' + - name: Sync to Maven Central + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} + uses: spring-io/nexus-sync-action@v0.0.1 + with: + username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + staging-profile-name: ${{ secrets.OSSRH_S01_STAGING_PROFILE }} + create: true + upload: true + close: true + release: true + generate-checksums: true + - name: Await Maven Central Sync + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} + run: | + url=${{ format('https://repo.maven.apache.org/maven2/io/spring/javaformat/spring-javaformat/{0}/spring-javaformat-{0}.pom', inputs.version) }} + echo "Waiting for $url" + until curl --fail --head --silent $url > /dev/null + do + echo "." + sleep 60 + done + echo "$url is available" + - name: Promote Build + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} + run: jfrog rt build-promote ${{ format('spring-javaformat-{0}', inputs.version)}} ${{ inputs.build-number }} libs-release-local + - name: Publish Eclipse Update Site + uses: ./.github/actions/publish-eclipse-update-site + with: + version: ${{ inputs.version }} + build-number: ${{ inputs.build-number }} + artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }} + artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }} + - name: Create GitHub Release + uses: ./.github/actions/create-github-release + with: + milestone: ${{ inputs.version }} + token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} From 66bf43f70d043452590330c68effdb18efe40e70 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 10 Jun 2024 09:28:28 -0700 Subject: [PATCH 03/29] Delete Concourse CI Closes gh-411 --- ci/README.adoc | 18 - ci/config/release-scripts.yml | 10 - ci/images/README.adoc | 21 -- ci/images/ci-image/Dockerfile | 11 - ci/images/docker-lib.sh | 112 ------- ci/images/get-docker-url.sh | 5 - ci/images/setup.sh | 38 --- ci/parameters.yml | 10 - ci/pipeline.yml | 316 ------------------ ci/scripts/build-project.sh | 9 - ci/scripts/common.sh | 9 - ci/scripts/generate-changelog.sh | 11 - ci/scripts/promote.sh | 18 - ...blish-eclipse-update-site-pom-template.xml | 60 ---- ci/scripts/publish-eclipse-update-site.sh | 57 ---- ci/scripts/stage.sh | 58 ---- ci/scripts/sync-to-maven-central.sh | 7 - ci/tasks/build-ci-image.yml | 28 -- ci/tasks/build-project.yml | 17 - ci/tasks/generate-changelog.yml | 16 - ci/tasks/promote.yml | 14 - ci/tasks/publish-eclipse-update-site.yml | 7 - ci/tasks/stage.yml | 16 - 23 files changed, 868 deletions(-) delete mode 100644 ci/README.adoc delete mode 100644 ci/config/release-scripts.yml delete mode 100644 ci/images/README.adoc delete mode 100644 ci/images/ci-image/Dockerfile delete mode 100755 ci/images/docker-lib.sh delete mode 100755 ci/images/get-docker-url.sh delete mode 100755 ci/images/setup.sh delete mode 100644 ci/parameters.yml delete mode 100644 ci/pipeline.yml delete mode 100755 ci/scripts/build-project.sh delete mode 100644 ci/scripts/common.sh delete mode 100755 ci/scripts/generate-changelog.sh delete mode 100755 ci/scripts/promote.sh delete mode 100755 ci/scripts/publish-eclipse-update-site-pom-template.xml delete mode 100755 ci/scripts/publish-eclipse-update-site.sh delete mode 100755 ci/scripts/stage.sh delete mode 100755 ci/scripts/sync-to-maven-central.sh delete mode 100644 ci/tasks/build-ci-image.yml delete mode 100644 ci/tasks/build-project.yml delete mode 100644 ci/tasks/generate-changelog.yml delete mode 100644 ci/tasks/promote.yml delete mode 100644 ci/tasks/publish-eclipse-update-site.yml delete mode 100644 ci/tasks/stage.yml diff --git a/ci/README.adoc b/ci/README.adoc deleted file mode 100644 index bdf75bd5..00000000 --- a/ci/README.adoc +++ /dev/null @@ -1,18 +0,0 @@ -== Concourse pipeline - -Ensure that you've setup the target and can login - -[source] ----- -$ fly -t spring-javaformat login -n spring-javaformat -c https://ci.spring.io ----- - -The pipeline can be deployed using the following command: - -[source] ----- -$ fly -t spring-javaformat set-pipeline -p spring-javaformat -c ci/pipeline.yml -l ci/parameters.yml ----- - -NOTE: This assumes that you have credhub integration configured with the appropriate -secrets. diff --git a/ci/config/release-scripts.yml b/ci/config/release-scripts.yml deleted file mode 100644 index d31f8cba..00000000 --- a/ci/config/release-scripts.yml +++ /dev/null @@ -1,10 +0,0 @@ -logging: - level: - io.spring.concourse: DEBUG -spring: - main: - banner-mode: off -sonatype: - exclude: - - 'build-info\.json' - - '.*\.zip' diff --git a/ci/images/README.adoc b/ci/images/README.adoc deleted file mode 100644 index 84eae160..00000000 --- a/ci/images/README.adoc +++ /dev/null @@ -1,21 +0,0 @@ -== CI Images - -These images are used by CI to run the actual builds. - -To build the image locally run the following from this directory: - ----- -$ docker build --no-cache -f /Dockerfile . ----- - -For example - ----- -$ docker build --no-cache -f spring-boot-ci-image/Dockerfile . ----- - -To test run: - ----- -$ docker run -it --entrypoint /bin/bash ✈ ----- diff --git a/ci/images/ci-image/Dockerfile b/ci/images/ci-image/Dockerfile deleted file mode 100644 index fbdbb4c0..00000000 --- a/ci/images/ci-image/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:focal-20210401 - -ADD setup.sh /setup.sh -ADD get-docker-url.sh /get-docker-url.sh -RUN ./setup.sh - -ENV JAVA_HOME /opt/openjdk -ENV PATH $JAVA_HOME/bin:$PATH -ADD docker-lib.sh /docker-lib.sh - -ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ] diff --git a/ci/images/docker-lib.sh b/ci/images/docker-lib.sh deleted file mode 100755 index 4c7b1d58..00000000 --- a/ci/images/docker-lib.sh +++ /dev/null @@ -1,112 +0,0 @@ -# Based on: https://github.com/concourse/docker-image-resource/blob/master/assets/common.sh - -DOCKER_LOG_FILE=${DOCKER_LOG_FILE:-/tmp/docker.log} -SKIP_PRIVILEGED=${SKIP_PRIVILEGED:-false} -STARTUP_TIMEOUT=${STARTUP_TIMEOUT:-120} - -sanitize_cgroups() { - mkdir -p /sys/fs/cgroup - mountpoint -q /sys/fs/cgroup || \ - mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup - - mount -o remount,rw /sys/fs/cgroup - - sed -e 1d /proc/cgroups | while read sys hierarchy num enabled; do - if [ "$enabled" != "1" ]; then - # subsystem disabled; skip - continue - fi - - grouping="$(cat /proc/self/cgroup | cut -d: -f2 | grep "\\<$sys\\>")" || true - if [ -z "$grouping" ]; then - # subsystem not mounted anywhere; mount it on its own - grouping="$sys" - fi - - mountpoint="/sys/fs/cgroup/$grouping" - - mkdir -p "$mountpoint" - - # clear out existing mount to make sure new one is read-write - if mountpoint -q "$mountpoint"; then - umount "$mountpoint" - fi - - mount -n -t cgroup -o "$grouping" cgroup "$mountpoint" - - if [ "$grouping" != "$sys" ]; then - if [ -L "/sys/fs/cgroup/$sys" ]; then - rm "/sys/fs/cgroup/$sys" - fi - - ln -s "$mountpoint" "/sys/fs/cgroup/$sys" - fi - done - - if ! test -e /sys/fs/cgroup/systemd ; then - mkdir /sys/fs/cgroup/systemd - mount -t cgroup -o none,name=systemd none /sys/fs/cgroup/systemd - fi -} - -start_docker() { - mkdir -p /var/log - mkdir -p /var/run - - if [ "$SKIP_PRIVILEGED" = "false" ]; then - sanitize_cgroups - - # check for /proc/sys being mounted readonly, as systemd does - if grep '/proc/sys\s\+\w\+\s\+ro,' /proc/mounts >/dev/null; then - mount -o remount,rw /proc/sys - fi - fi - - local mtu=$(cat /sys/class/net/$(ip route get 8.8.8.8|awk '{ print $5 }')/mtu) - local server_args="--mtu ${mtu}" - local registry="" - - server_args="${server_args}" - - for registry in $3; do - server_args="${server_args} --insecure-registry ${registry}" - done - - if [ -n "$4" ]; then - server_args="${server_args} --registry-mirror $4" - fi - - try_start() { - dockerd --data-root /scratch/docker ${server_args} >$DOCKER_LOG_FILE 2>&1 & - echo $! > /tmp/docker.pid - - sleep 1 - - echo waiting for docker to come up... - until docker info >/dev/null 2>&1; do - sleep 1 - if ! kill -0 "$(cat /tmp/docker.pid)" 2>/dev/null; then - return 1 - fi - done - } - - export server_args DOCKER_LOG_FILE - declare -fx try_start - trap stop_docker EXIT - - if ! timeout ${STARTUP_TIMEOUT} bash -ce 'while true; do try_start && break; done'; then - echo Docker failed to start within ${STARTUP_TIMEOUT} seconds. - return 1 - fi -} - -stop_docker() { - local pid=$(cat /tmp/docker.pid) - if [ -z "$pid" ]; then - return 0 - fi - - kill -TERM $pid -} - diff --git a/ci/images/get-docker-url.sh b/ci/images/get-docker-url.sh deleted file mode 100755 index 221b3462..00000000 --- a/ci/images/get-docker-url.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -version="20.10.6" -echo "https://download.docker.com/linux/static/stable/x86_64/docker-$version.tgz"; diff --git a/ci/images/setup.sh b/ci/images/setup.sh deleted file mode 100755 index 6c90192c..00000000 --- a/ci/images/setup.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -set -ex - -########################################################### -# UTILS -########################################################### -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get install --no-install-recommends -y tzdata ca-certificates net-tools libxml2-utils git curl libudev1 libxml2-utils iptables iproute2 jq fontconfig -ln -fs /usr/share/zoneinfo/UTC /etc/localtime -dpkg-reconfigure --frontend noninteractive tzdata -rm -rf /var/lib/apt/lists/* -curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/concourse-java.sh > /opt/concourse-java.sh - -########################################################### -# JAVA -########################################################### -JDK_URL=https://github.com/bell-sw/Liberica/releases/download/17.0.6+10/bellsoft-jdk17.0.6+10-linux-amd64.tar.gz - -mkdir -p /opt/openjdk -cd /opt/openjdk -curl -L ${JDK_URL} | tar zx --strip-components=1 -test -f /opt/openjdk/bin/java -test -f /opt/openjdk/bin/javac - -########################################################### -# DOCKER -########################################################### -cd / -DOCKER_URL=$( ./get-docker-url.sh ) -curl -L ${DOCKER_URL} | tar zx -mv /docker/* /bin/ -chmod +x /bin/docker* -export ENTRYKIT_VERSION=0.4.0 -curl -L https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz | tar zx -chmod +x entrykit && \ -mv entrykit /bin/entrykit && \ -entrykit --symlink \ No newline at end of file diff --git a/ci/parameters.yml b/ci/parameters.yml deleted file mode 100644 index d4564cd2..00000000 --- a/ci/parameters.yml +++ /dev/null @@ -1,10 +0,0 @@ -project: spring-javaformat -branch: main -milestone: 0.0.x -github-owner: spring-io -github-repository: spring-javaformat -docker-hub-ci-organization: springci -ci-image: spring-javaformat-ci -artifactory-server: https://repo.spring.io -build-name: spring-javaformat -task-timeout: 2h00m diff --git a/ci/pipeline.yml b/ci/pipeline.yml deleted file mode 100644 index 92027920..00000000 --- a/ci/pipeline.yml +++ /dev/null @@ -1,316 +0,0 @@ -anchors: - github-release-source: &github-release-source - owner: ((github-owner)) - repository: ((github-repository)) - access_token: ((github-ci-release-token)) - artifactory-repo-put-params: &artifactory-repo-put-params - signing_key: ((signing-key)) - signing_passphrase: ((signing-passphrase)) - repo: libs-snapshot-local - folder: distribution-repository - build_uri: https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} - build_number: ${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME} - disable_checksum_uploads: true - threads: 8 - sonatype-task-params: &sonatype-task-params - SONATYPE_USERNAME: ((sonatype-username)) - SONATYPE_PASSWORD: ((sonatype-password)) - SONATYPE_URL: ((sonatype-url)) - SONATYPE_STAGING_PROFILE_ID: ((sonatype-staging-profile-id)) - artifactory-task-params: &artifactory-task-params - ARTIFACTORY_SERVER: ((artifactory-server)) - ARTIFACTORY_USERNAME: ((artifactory-username)) - ARTIFACTORY_PASSWORD: ((artifactory-password)) - docker-hub-task-params: &docker-hub-task-params - DOCKER_HUB_USERNAME: ((docker-hub-username)) - DOCKER_HUB_PASSWORD: ((docker-hub-password)) - slack-fail-params: &slack-fail-params - text: > - :concourse-failed: - silent: true - icon_emoji: ":concourse:" - username: concourse-ci - slack-success-params: &slack-success-params - text: > - :concourse-succeeded: - silent: true - icon_emoji: ":concourse:" - username: concourse-ci -resource_types: -- name: artifactory-resource - type: registry-image - source: - repository: springio/artifactory-resource - tag: "0.0.18" - username: ((docker-hub-username)) - password: ((docker-hub-password)) -- name: slack-notification - type: registry-image - source: - repository: cfcommunity/slack-notification-resource - username: ((docker-hub-username)) - password: ((docker-hub-password)) -resources: -- name: git-repo - type: git - icon: github - source: - uri: https://github.com/((github-owner))/((github-repository)).git - username: ((github-username)) - password: ((github-ci-release-token)) - branch: ((branch)) -- name: github-pre-release - type: github-release - icon: briefcase-download-outline - source: - <<: *github-release-source - pre_release: true - release: false -- name: github-release - type: github-release - icon: briefcase-download - source: - <<: *github-release-source - pre_release: false - release: true -- name: ci-images-git-repo - type: git - icon: github - source: - uri: https://github.com/((github-owner))/((github-repository)).git - branch: ((branch)) - paths: ["ci/images/*"] -- name: ci-image - type: registry-image - icon: docker - source: - username: ((docker-hub-username)) - password: ((docker-hub-password)) - tag: ((milestone)) - repository: ((docker-hub-ci-organization))/((ci-image)) -- name: artifactory-repo - type: artifactory-resource - icon: package-variant - source: - uri: ((artifactory-server)) - username: ((artifactory-username)) - password: ((artifactory-password)) - build_name: ((build-name)) -- name: slack-alert - type: slack-notification - icon: slack - source: - url: ((slack-webhook-url)) -jobs: -- name: build-ci-images - plan: - - get: ci-images-git-repo - trigger: true - - get: git-repo - - task: build-ci-image - privileged: true - file: git-repo/ci/tasks/build-ci-image.yml - params: - DOCKER_HUB_AUTH: ((docker-hub-auth)) - output_mapping: - image: ci-image - - put: ci-image - params: - image: ci-image/image.tar -- name: build - serial: true - public: true - plan: - - get: ci-image - - get: git-repo - trigger: true - - do: - - task: build-project - image: ci-image - privileged: true - timeout: ((task-timeout)) - file: git-repo/ci/tasks/build-project.yml - params: - <<: *docker-hub-task-params - BRANCH: ((branch)) - on_failure: - do: - - put: slack-alert - params: - <<: *slack-fail-params - - put: slack-alert - params: - <<: *slack-success-params -- name: stage-milestone - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - task: stage - image: ci-image - file: git-repo/ci/tasks/stage.yml - params: - <<: *docker-hub-task-params - RELEASE_TYPE: M - - put: artifactory-repo - params: - <<: *artifactory-repo-put-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo -- name: stage-rc - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - task: stage - image: ci-image - file: git-repo/ci/tasks/stage.yml - params: - <<: *docker-hub-task-params - RELEASE_TYPE: RC - - put: artifactory-repo - params: - <<: *artifactory-repo-put-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo -- name: stage-release - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - task: stage - image: ci-image - file: git-repo/ci/tasks/stage.yml - params: - <<: *docker-hub-task-params - RELEASE_TYPE: RELEASE - - put: artifactory-repo - params: - <<: *artifactory-repo-put-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo -- name: promote-milestone - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - get: artifactory-repo - trigger: false - passed: [stage-milestone] - params: - download_artifacts: false - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - params: - RELEASE_TYPE: M - <<: *artifactory-task-params - - task: generate-changelog - file: git-repo/ci/tasks/generate-changelog.yml - params: - RELEASE_TYPE: M - GITHUB_USERNAME: ((github-username)) - GITHUB_TOKEN: ((github-ci-release-token)) - - put: github-pre-release - params: - name: generated-changelog/tag - tag: generated-changelog/tag - body: generated-changelog/changelog.md -- name: promote-rc - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - get: artifactory-repo - trigger: false - passed: [stage-rc] - params: - download_artifacts: false - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - params: - RELEASE_TYPE: RC - <<: *artifactory-task-params - - task: generate-changelog - file: git-repo/ci/tasks/generate-changelog.yml - params: - RELEASE_TYPE: RC - - put: github-pre-release - params: - name: generated-changelog/tag - tag: generated-changelog/tag - body: generated-changelog/changelog.md -- name: promote-release - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - get: artifactory-repo - trigger: false - passed: [stage-release] - params: - download_artifacts: true - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - params: - RELEASE_TYPE: RELEASE - <<: *artifactory-task-params - <<: *sonatype-task-params -- name: create-github-release - serial: true - plan: - - get: ci-image - - get: git-repo - - get: artifactory-repo - trigger: true - passed: [promote-release] - params: - download_artifacts: false - save_build_info: true - - task: generate-changelog - file: git-repo/ci/tasks/generate-changelog.yml - params: - RELEASE_TYPE: RELEASE - - put: github-release - params: - name: generated-changelog/tag - tag: generated-changelog/tag - body: generated-changelog/changelog.md -- name: publish-eclipse-update-site - serial: true - plan: - - get: ci-image - - get: git-repo - trigger: false - - get: artifactory-repo - trigger: false - passed: [promote-release] - params: - save_build_info: true - - task: publish-eclipse-update-site - image: ci-image - file: git-repo/ci/tasks/publish-eclipse-update-site.yml - params: - ARTIFACTORY_USERNAME: ((artifactory-username)) - ARTIFACTORY_PASSWORD: ((artifactory-password)) -groups: -- name: builds - jobs: [build] -- name: releases - jobs: [stage-milestone, stage-rc, stage-release, promote-milestone, promote-rc, promote-release, create-github-release, publish-eclipse-update-site] -- name: ci-images - jobs: [build-ci-images] diff --git a/ci/scripts/build-project.sh b/ci/scripts/build-project.sh deleted file mode 100755 index 476c837e..00000000 --- a/ci/scripts/build-project.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e - -source $(dirname $0)/common.sh -repository=$(pwd)/distribution-repository - -pushd git-repo > /dev/null -run_maven clean deploy -U -Dfull -DaltDeploymentRepository=distribution::file://${repository} -popd > /dev/null diff --git a/ci/scripts/common.sh b/ci/scripts/common.sh deleted file mode 100644 index 8eea3f79..00000000 --- a/ci/scripts/common.sh +++ /dev/null @@ -1,9 +0,0 @@ -source /opt/concourse-java.sh - -setup_symlinks - -if [[ -n $DOCKER_HUB_USERNAME ]]; then - docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD -fi - -cleanup_maven_repo "io.spring.javaformat" diff --git a/ci/scripts/generate-changelog.sh b/ci/scripts/generate-changelog.sh deleted file mode 100755 index 1e4b6e5b..00000000 --- a/ci/scripts/generate-changelog.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) - -java -jar /github-changelog-generator.jar \ - --changelog.repository=spring-io/spring-javaformat \ - ${version} generated-changelog/changelog.md - -echo ${version} > generated-changelog/version -echo v${version} > generated-changelog/tag diff --git a/ci/scripts/promote.sh b/ci/scripts/promote.sh deleted file mode 100755 index 4ce8285b..00000000 --- a/ci/scripts/promote.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -CONFIG_DIR=git-repo/ci/config - -version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) - -export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json - -java -jar /concourse-release-scripts.jar \ - --spring.config.location=${CONFIG_DIR}/release-scripts.yml \ - publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION artifactory-repo || { exit 1; } - -java -jar /concourse-release-scripts.jar \ - --spring.config.location=${CONFIG_DIR}/release-scripts.yml \ - promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; } - -echo "Promotion complete" diff --git a/ci/scripts/publish-eclipse-update-site-pom-template.xml b/ci/scripts/publish-eclipse-update-site-pom-template.xml deleted file mode 100755 index 6ee635e0..00000000 --- a/ci/scripts/publish-eclipse-update-site-pom-template.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - org.eclipse.m2e.maveneclipse - m2eclipse-maveneclipse-publish - 0.0.0-SNAPSHOT - pom - - 1.1.0 - - - - - org.eclipse.tycho.extras - tycho-p2-extras-plugin - ${tycho-extras-version} - - - prepare-package - - mirror - - - - - -##repositories## - - ${project.build.directory}/repository - true - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.8 - - - prepare-package - - mvn - - - - - - - - - - - run - - - - - - - diff --git a/ci/scripts/publish-eclipse-update-site.sh b/ci/scripts/publish-eclipse-update-site.sh deleted file mode 100755 index 761f74c3..00000000 --- a/ci/scripts/publish-eclipse-update-site.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -e - -source $(dirname $0)/common.sh - -buildName=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.name' ) -buildNumber=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.number' ) -groupId=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) -version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) - -echo "Publishing ${buildName}/${buildNumber} to Eclipse Update Site" -curl \ - -s \ - --connect-timeout 240 \ - --max-time 2700 \ - -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ - -f \ - -H "X-Explode-Archive: true" \ - -X PUT \ - -T "artifactory-repo/io/spring/javaformat/io.spring.javaformat.eclipse.site/${version}/io.spring.javaformat.eclipse.site-${version}.zip" \ - "https://repo.spring.io/javaformat-eclipse-update-site/${version}/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } - -releasedVersions=$( curl -s -f -X GET https://repo.spring.io/api/storage/javaformat-eclipse-update-site | jq -r '.children[] | .uri' | cut -c 2- | grep '[0-9].*' | sort -V ) - -repositories="" -while read -r releasedVersion; do - echo "Adding repository for ${releasedVersion}" - repositories="${repositories}https://repo.spring.io/javaformat-eclipse-update-site/${releasedVersion}p2" -done <<< "${releasedVersions}" - -pushd git-repo > /dev/null -sed "s|##repositories##|${repositories}|" ci/scripts/publish-eclipse-update-site-pom-template.xml > publish-eclipse-update-site-pom.xml -run_maven -f publish-eclipse-update-site-pom.xml clean package || { echo "Failed to publish" >&2; exit 1; } - -curl \ - -s \ - --connect-timeout 240 \ - --max-time 2700 \ - -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ - -f \ - -X PUT \ - -T "target/repository/content.jar" \ - "https://repo.spring.io/javaformat-eclipse-update-site/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } - -curl \ - -s \ - --connect-timeout 240 \ - --max-time 2700 \ - -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ - -f \ - -X PUT \ - -T "target/repository/artifacts.jar" \ - "https://repo.spring.io/javaformat-eclipse-update-site/" > /dev/null || { echo "Failed to publish" >&2; exit 1; } - -popd > /dev/null - -echo "Publish complete" diff --git a/ci/scripts/stage.sh b/ci/scripts/stage.sh deleted file mode 100755 index 5b36e8b4..00000000 --- a/ci/scripts/stage.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -set -e - -source $(dirname $0)/common.sh -repository=$(pwd)/distribution-repository - -pushd git-repo > /dev/null -git fetch --tags --all > /dev/null -popd > /dev/null - -git clone git-repo stage-git-repo > /dev/null - -pushd stage-git-repo > /dev/null - -snapshotVersion=$( xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml ) -if [[ $RELEASE_TYPE = "M" ]]; then - stageVersion=$( get_next_milestone_release $snapshotVersion) - nextVersion=$snapshotVersion -elif [[ $RELEASE_TYPE = "RC" ]]; then - stageVersion=$( get_next_rc_release $snapshotVersion) - nextVersion=$snapshotVersion -elif [[ $RELEASE_TYPE = "RELEASE" ]]; then - stageVersion=$( get_next_release $snapshotVersion) - nextVersion=$( bump_version_number $snapshotVersion) -else - echo "Unknown release type $RELEASE_TYPE" >&2; exit 1; -fi - -echo "Staging ${stageVersion} (next version will be ${nextVersion})" -run_maven versions:set -DnewVersion=${stageVersion} -DgenerateBackupPoms=false -run_maven org.eclipse.tycho:tycho-versions-plugin:update-eclipse-metadata -run_maven --projects io.spring.javaformat:spring-javaformat-vscode-extension -P '!formatter-dependencies' antrun:run@update-version frontend:install-node-and-npm frontend:npm@update-package-lock - -git config user.name "Spring Builds" > /dev/null -git config user.email "spring-builds@users.noreply.github.com" > /dev/null -git add pom.xml > /dev/null -git commit -m"Release v${stageVersion}" > /dev/null -git tag -a "v${stageVersion}" -m"Release v${stageVersion}" > /dev/null - -run_maven clean deploy -U -Dfull -DaltDeploymentRepository=distribution::default::file://${repository} - -git reset --hard HEAD^ > /dev/null -if [[ $nextVersion != $snapshotVersion ]]; then - echo "Setting next development version (v$nextVersion)" - run_maven versions:set -DnewVersion=$nextVersion -DgenerateBackupPoms=false - run_maven org.eclipse.tycho:tycho-versions-plugin:update-eclipse-metadata - run_maven --projects io.spring.javaformat:spring-javaformat-vscode-extension -P '!formatter-dependencies' antrun:run@update-version frontend:npm@update-package-lock - sed -i "s/:release-version:.*/:release-version: ${stageVersion}/g" README.adoc - sed -i "s/spring-javaformat-gradle-plugin:.*/spring-javaformat-gradle-plugin:${nextVersion}\"\)/g" samples/spring-javaformat-gradle-sample/build.gradle - sed -i "s/spring-javaformat-checkstyle:.*/spring-javaformat-checkstyle:${nextVersion}\"\)/g" samples/spring-javaformat-gradle-sample/build.gradle - sed -i "s|.*|${nextVersion}|" samples/spring-javaformat-maven-sample/pom.xml - git add -u . > /dev/null - git commit -m"Next development version (v${nextVersion})" > /dev/null -fi; - -popd > /dev/null - -echo "Staging Complete" diff --git a/ci/scripts/sync-to-maven-central.sh b/ci/scripts/sync-to-maven-central.sh deleted file mode 100755 index f691b9f9..00000000 --- a/ci/scripts/sync-to-maven-central.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json -version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) -java -jar /opt/concourse-release-scripts.jar syncToCentral "RELEASE" $BUILD_INFO_LOCATION || { exit 1; } - -echo "Sync complete" diff --git a/ci/tasks/build-ci-image.yml b/ci/tasks/build-ci-image.yml deleted file mode 100644 index 6f4de778..00000000 --- a/ci/tasks/build-ci-image.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -platform: linux -image_resource: - type: registry-image - source: - repository: concourse/oci-build-task - tag: 0.10.0 - username: ((docker-hub-username)) - password: ((docker-hub-password)) -inputs: -- name: ci-images-git-repo -outputs: -- name: image -caches: -- path: ci-image-cache -params: - CONTEXT: ci-images-git-repo/ci/images - DOCKERFILE: ci-images-git-repo/ci/images/ci-image/Dockerfile -run: - path: /bin/sh - args: - - "-c" - - | - mkdir -p /root/.docker - cat > /root/.docker/config.json < Date: Wed, 24 Jul 2024 14:24:03 +0100 Subject: [PATCH 04/29] Upgrade to Java 17.0.12 Closes gh-419 --- .sdkmanrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sdkmanrc b/.sdkmanrc index 14fdc133..828308d2 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,3 +1,3 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=17.0.6-librca +java=17.0.12-librca From 70373338ffdd0be298536a0a044eaf4bee6e9e2a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 24 Jul 2024 14:26:54 +0100 Subject: [PATCH 05/29] Report unnecessary and unsupported warning suppressions at info level Closes gh-418 --- .../eclipse/projectsettings/org.eclipse.jdt.core.prefs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs index 41401b15..09b98f97 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs @@ -82,7 +82,7 @@ org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -99,7 +99,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference= org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=info org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on From 2c8dbd91adc3323028d609e8088dcf969c16c334 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 24 Jul 2024 16:16:47 +0100 Subject: [PATCH 06/29] Only require test classes to have a name ending in Tests Previously, the check would apply to interfaces and annotations as well. This commit tightens up the check so that it only applies to classes. Closes gh-364 --- .../check/SpringTestFileNameCheck.java | 24 +++++++++++++++--- .../checkstyle/SpringChecksTests.java | 8 +++--- .../src/test/java/AnnotationEndingInTest.txt | 1 + .../src/test/java/InterfaceEndingInTest.txt | 1 + .../src/test/java/AnnotationEndingInTest.java | 25 +++++++++++++++++++ .../src/test/java/InterfaceEndingInTest.java | 25 +++++++++++++++++++ 6 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/AnnotationEndingInTest.txt create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/InterfaceEndingInTest.txt create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/AnnotationEndingInTest.java create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/InterfaceEndingInTest.java diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java index eeda7a05..da188129 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 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. @@ -18,14 +18,19 @@ import java.io.File; +import com.puppycrawl.tools.checkstyle.JavaParser; +import com.puppycrawl.tools.checkstyle.JavaParser.Options; import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileText; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** - * Checks that test filenames end {@literal Tests.java} and not {@literal Test.java}. + * Checks that test class filenames end {@literal Tests.java} and not {@literal Test.java}. * * @author Phillip Webb + * @author Andy Wilkinson */ public class SpringTestFileNameCheck extends AbstractFileSetCheck { @@ -33,8 +38,19 @@ public class SpringTestFileNameCheck extends AbstractFileSetCheck { protected void processFiltered(File file, FileText fileText) throws CheckstyleException { String path = file.getPath().replace('\\', '/'); if (path.contains("src/test/java") && file.getName().endsWith("Test.java")) { - log(1, "testfilename.wrongName"); + visitCompilationUnit(JavaParser.parseFileText(fileText, Options.WITHOUT_COMMENTS)); } } - + + private void visitCompilationUnit(DetailAST ast) { + DetailAST child = ast.getFirstChild(); + while (child != null) { + if (child.getType() == TokenTypes.CLASS_DEF) { + log(1, "testfilename.wrongName"); + return; + } + child = child.getNextSibling(); + } + } + } diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringChecksTests.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringChecksTests.java index 7d789a94..f3d31175 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringChecksTests.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringChecksTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 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. @@ -123,8 +123,10 @@ public static Collection paramaters() throws IOException { .map(Parameter::new) .collect(Collectors.toCollection(ArrayList::new)); parameters.add(new Parameter(new File(SOURCES_DIR, "nopackageinfo/NoPackageInfo.java"))); - parameters.add(new Parameter(new File(SOURCES_DIR, "src/test/java/NamedTest.java"))); - parameters.add(new Parameter(new File(SOURCES_DIR, "src/test/java/NamedTests.java"))); + Arrays.stream(new File(SOURCES_DIR, "src/test/java").listFiles(SpringChecksTests::sourceFile)) + .sorted() + .map(Parameter::new) + .forEach(parameters::add); return parameters; } diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/AnnotationEndingInTest.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/AnnotationEndingInTest.txt new file mode 100644 index 00000000..69174e4c --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/AnnotationEndingInTest.txt @@ -0,0 +1 @@ ++0 errors \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/InterfaceEndingInTest.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/InterfaceEndingInTest.txt new file mode 100644 index 00000000..69174e4c --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/src/test/java/InterfaceEndingInTest.txt @@ -0,0 +1 @@ ++0 errors \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/AnnotationEndingInTest.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/AnnotationEndingInTest.java new file mode 100644 index 00000000..7579aac2 --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/AnnotationEndingInTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2017-2024 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. + */ + +/** + * This is an annotation with a legal name. Only test classes must + * have a name that ends with {@code Tests}. + * + * @author Andy Wilkinson + */ +public @interface AnnotationEndingInTest { + +} diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/InterfaceEndingInTest.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/InterfaceEndingInTest.java new file mode 100644 index 00000000..b2aad5f9 --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/src/test/java/InterfaceEndingInTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2017-2024 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. + */ + +/** + * This is an interface with a legal name. Only test classes must + * have a name that ends with {@code Tests}. + * + * @author Andy Wilkinson + */ +public interface InterfaceEndingInTest { + +} From 096af47c74e0352849fda9053d45d03500198bc8 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 24 Jul 2024 17:54:50 +0100 Subject: [PATCH 07/29] Check that JUnit 5 test classes are package-private Closes gh-281 --- .../checkstyle/check/SpringJUnit5Check.java | 51 ++++++++++++++----- .../check/SpringTestFileNameCheck.java | 4 +- .../checkstyle/check/messages.properties | 3 ++ .../resources/check/JUnit5BadModifier.txt | 4 ++ .../resources/source/JUnit5BadModifier.java | 15 ++++++ .../test/resources/source/JUnit5Valid.java | 4 +- 6 files changed, 64 insertions(+), 17 deletions(-) diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java index db7cbbfd..59eb1bec 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java @@ -63,6 +63,8 @@ public class SpringJUnit5Check extends AbstractSpringCheck { LIFECYCLE_ANNOTATIONS = Collections.unmodifiableList(new ArrayList<>(annotations)); } + private static final Annotation NESTED_ANNOTATION = new Annotation("org.junit.jupiter.api", "Nested"); + private static final Set BANNED_IMPORTS; static { Set bannedImports = new LinkedHashSet<>(); @@ -84,9 +86,13 @@ public class SpringJUnit5Check extends AbstractSpringCheck { private final List lifecycleMethods = new ArrayList<>(); + private final List nestedTestClasses = new ArrayList<>(); + + private DetailAST testClass; + @Override public int[] getAcceptableTokens() { - return new int[] { TokenTypes.METHOD_DEF, TokenTypes.IMPORT }; + return new int[] { TokenTypes.METHOD_DEF, TokenTypes.IMPORT, TokenTypes.CLASS_DEF }; } @Override @@ -101,9 +107,13 @@ public void visitToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: visitMethodDef(ast); + break; case TokenTypes.IMPORT: visitImport(ast); break; + case TokenTypes.CLASS_DEF: + visitClassDefinition(ast); + break; } } @@ -140,6 +150,17 @@ private void visitImport(DetailAST ast) { this.imports.put(ident.getText(), ident); } + private void visitClassDefinition(DetailAST ast) { + if (ast.getParent().getType() == TokenTypes.COMPILATION_UNIT) { + this.testClass = ast; + } + else { + if (containsAnnotation(ast, Arrays.asList(NESTED_ANNOTATION))) { + this.nestedTestClasses.add(ast); + } + } + } + @Override public void finishTree(DetailAST rootAST) { if (shouldCheck()) { @@ -148,7 +169,7 @@ public void finishTree(DetailAST rootAST) { } private boolean shouldCheck() { - if (this.testMethods.isEmpty() && this.lifecycleMethods.isEmpty()) { + if (this.testMethods.isEmpty() && this.lifecycleMethods.isEmpty() && this.nestedTestClasses.isEmpty()) { return false; } for (String unlessImport : this.unlessImports) { @@ -160,6 +181,10 @@ private boolean shouldCheck() { } private void check() { + if (this.testClass != null) { + checkVisibility(Arrays.asList(this.testClass), "junit5.publicClass", null); + } + checkVisibility(this.nestedTestClasses, "junit5.publicNestedClass", "junit5.privateNestedClass"); for (String bannedImport : BANNED_IMPORTS) { FullIdent ident = this.imports.get(bannedImport); if (ident != null) { @@ -171,25 +196,25 @@ private void check() { log(testMethod, "junit5.bannedTestAnnotation"); } } - checkMethodVisibility(this.testMethods, "junit5.testPublicMethod", "junit5.testPrivateMethod"); - checkMethodVisibility(this.lifecycleMethods, "junit5.lifecyclePublicMethod", "junit5.lifecyclePrivateMethod"); + checkVisibility(this.testMethods, "junit5.testPublicMethod", "junit5.testPrivateMethod"); + checkVisibility(this.lifecycleMethods, "junit5.lifecyclePublicMethod", "junit5.lifecyclePrivateMethod"); } - private void checkMethodVisibility(List methods, String publicMessageKey, String privateMessageKey) { - for (DetailAST method : methods) { - DetailAST modifiers = method.findFirstToken(TokenTypes.MODIFIERS); + private void checkVisibility(List asts, String publicMessageKey, String privateMessageKey) { + for (DetailAST ast : asts) { + DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS); if (modifiers.findFirstToken(TokenTypes.LITERAL_PUBLIC) != null) { - log(method, publicMessageKey); + log(ast, publicMessageKey); } - if (modifiers.findFirstToken(TokenTypes.LITERAL_PRIVATE) != null) { - log(method, privateMessageKey); + if ((privateMessageKey != null) && (modifiers.findFirstToken(TokenTypes.LITERAL_PRIVATE) != null)) { + log(ast, privateMessageKey); } } } - private void log(DetailAST method, String key) { - String name = method.findFirstToken(TokenTypes.IDENT).getText(); - log(method.getLineNo(), method.getColumnNo(), key, name); + private void log(DetailAST ast, String key) { + String name = ast.findFirstToken(TokenTypes.IDENT).getText(); + log(ast.getLineNo(), ast.getColumnNo(), key, name); } public void setUnlessImports(String unlessImports) { diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java index da188129..b2041870 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java @@ -41,7 +41,7 @@ protected void processFiltered(File file, FileText fileText) throws CheckstyleEx visitCompilationUnit(JavaParser.parseFileText(fileText, Options.WITHOUT_COMMENTS)); } } - + private void visitCompilationUnit(DetailAST ast) { DetailAST child = ast.getFirstChild(); while (child != null) { @@ -52,5 +52,5 @@ private void visitCompilationUnit(DetailAST ast) { child = child.getNextSibling(); } } - + } diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties index 9982830e..a27f9263 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties @@ -16,6 +16,9 @@ junit5.bannedImport=Import ''{0}'' should not be used in a JUnit 5 test. junit5.bannedTestAnnotation=JUnit 4 @Test annotation should not be used in a JUnit 5 test. junit5.lifecyclePrivateMethod=Lifecycle method ''{0}'' should not be private. junit5.lifecyclePublicMethod=Lifecycle method ''{0}'' should not be public. +junit5.publicClass=Test class ''{0}'' should not be public. +junit5.publicNestedClass=Nested test class ''{0}'' should not be public. +junit5.privateNestedClass=Nested test class ''{0}'' should not be private. junit5.testPrivateMethod=Test method ''{0}'' should not be private. junit5.testPublicMethod=Test method ''{0}'' should not be public. lambda.missingParen=Lambda argument missing parentheses. diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5BadModifier.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5BadModifier.txt index 376aa13c..7ec1d4de 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5BadModifier.txt +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5BadModifier.txt @@ -1,7 +1,11 @@ ++Test class 'JUnit5BadModifier' should not be public ++Nested test class 'PublicNestedTests' should not be public ++Nested test class 'PrivateNestedTests' should not be private +Test method 'doSomethingWorks' should not be public +Test method 'doSomethingElseWorks' should not be private +Test method 'doSomethingWithTemplateWorks' should not be public +Test method 'doSomethingElseWithTemplateWorks' should not be private ++Test method 'nestedPublicTest' should not be public +Lifecycle method 'publicBeforeAll' should not be public +Lifecycle method 'publicBeforeEach' should not be public +Lifecycle method 'publicAfterAll' should not be public diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5BadModifier.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5BadModifier.java index e9b91697..9c59c587 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5BadModifier.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5BadModifier.java @@ -88,4 +88,19 @@ private void doSomethingElseWithTemplateWorks() { // test here } + @Nested + public static class PublicNestedTests { + + @Test + public void nestedPublicTest() { + + } + + } + + @Nested + private static class PrivateNestedTests { + + } + } diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5Valid.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5Valid.java index cc7b4cd0..bad7023d 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5Valid.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5Valid.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2024 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. @@ -21,7 +21,7 @@ * * @author Phillip Webb */ -public class JUnit5Valid { +class JUnit5Valid { @Test void doSomethingWorks() { From 1adc8b1c145dca113ae1c133f549ea827a1f7708 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 09:12:50 +0000 Subject: [PATCH 08/29] Bump xml2js to 0.5.0 and @vscode/vsce to 2.19.0 Bumps [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) to 0.5.0 and updates ancestor dependency [@vscode/vsce](https://github.com/Microsoft/vsce). These dependencies need to be updated together. Updates `xml2js` from 0.4.23 to 0.5.0 - [Commits](https://github.com/Leonidas-from-XIV/node-xml2js/commits/0.5.0) Updates `@vscode/vsce` from 2.17.0 to 2.19.0 - [Release notes](https://github.com/Microsoft/vsce/releases) - [Commits](https://github.com/Microsoft/vsce/compare/v2.17.0...v2.19.0) --- updated-dependencies: - dependency-name: xml2js dependency-type: indirect - dependency-name: "@vscode/vsce" dependency-type: direct:development ... Signed-off-by: dependabot[bot] See gh-375 --- .../package-lock.json | 23 ++++++++++++------- .../package.json | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index 9572cc6f..cf72087a 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -14,7 +14,7 @@ "@types/vscode": "^1.75.0", "@typescript-eslint/eslint-plugin": "^5.52.0", "@vscode/test-electron": "^2.2.2", - "@vscode/vsce": "^2.17.0", + "@vscode/vsce": "^2.19.0", "eslint": "^8.33.0", "glob": "8.1.0", "mocha": "10.2.0", @@ -376,9 +376,9 @@ } }, "node_modules/@vscode/vsce": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.17.0.tgz", - "integrity": "sha512-W4HN5MtTVj/mroQU1d82bUEeWM3dUykMFnMYZPtZ6jrMiHN1PUoN3RGcS896N0r2rIq8KpWDtufcQHgK8VfgpA==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.19.0.tgz", + "integrity": "sha512-dAlILxC5ggOutcvJY24jxz913wimGiUrHaPkk16Gm9/PGFbz1YezWtrXsTKUtJws4fIlpX2UIlVlVESWq8lkfQ==", "dev": true, "dependencies": { "azure-devops-node-api": "^11.0.1", @@ -387,6 +387,7 @@ "commander": "^6.1.0", "glob": "^7.0.6", "hosted-git-info": "^4.0.2", + "jsonc-parser": "^3.2.0", "leven": "^3.1.0", "markdown-it": "^12.3.2", "mime": "^1.3.4", @@ -397,7 +398,7 @@ "tmp": "^0.2.1", "typed-rest-client": "^1.8.4", "url-join": "^4.0.1", - "xml2js": "^0.4.23", + "xml2js": "^0.5.0", "yauzl": "^2.3.1", "yazl": "^2.2.2" }, @@ -2138,6 +2139,12 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/keytar": { "version": "7.9.0", "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", @@ -3636,9 +3643,9 @@ "dev": true }, "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "dev": true, "dependencies": { "sax": ">=0.6.0", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index cdb080b7..86a6b65b 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -33,7 +33,7 @@ "@types/vscode": "^1.75.0", "@typescript-eslint/eslint-plugin": "^5.52.0", "@vscode/test-electron": "^2.2.2", - "@vscode/vsce": "^2.17.0", + "@vscode/vsce": "^2.19.0", "eslint": "^8.33.0", "glob": "8.1.0", "mocha": "10.2.0", From 09679cce7e84ba756262006e6ae8ee36e1725c16 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 26 Jul 2024 13:53:23 +0100 Subject: [PATCH 09/29] Include MissingDeprecated in the default checks Closes gh-420 --- .../eclipse/projectsettings/org.eclipse.jdt.core.prefs | 2 +- .../spring/javaformat/checkstyle/spring-checkstyle.xml | 1 + .../checkstyle/SpringConfigurationLoaderTests.java | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs index 09b98f97..c08217ef 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs @@ -45,7 +45,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml index ba9026a6..a41c37bf 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml @@ -22,6 +22,7 @@ + ordinaryChecks = (Set) Extractors.byName("ordinaryChecks").extract(treeWalker); assertThat(ordinaryChecks).hasSize(61); + Set commentChecks = (Set) Extractors.byName("commentChecks").extract(treeWalker); + assertThat(commentChecks).hasSize(6); } @Test public void loadWithExcludeShouldExcludeChecks() { - Set excludes = Collections - .singleton("com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck"); + Set excludes = new HashSet(Arrays.asList("com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck", + "com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck")); Collection checks = load(excludes); assertThat(checks).hasSize(5); TreeWalker treeWalker = (TreeWalker) checks.toArray()[4]; Set ordinaryChecks = (Set) Extractors.byName("ordinaryChecks").extract(treeWalker); assertThat(ordinaryChecks).hasSize(60); + Set commentChecks = (Set) Extractors.byName("commentChecks").extract(treeWalker); + assertThat(commentChecks).hasSize(5); } @Test From ab2ecf7eb9c96bc07fe9ba75504c2d4de9450f9c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 26 Jul 2024 16:58:22 +0100 Subject: [PATCH 10/29] Polish "Check that JUnit 5 test classes are package-private" - Clear the new fields each time a new tree is begun. This prevents state from one tree affecting the checking of another. - Allow abstract test classes to be public Closes gh-281 --- .../checkstyle/check/SpringJUnit5Check.java | 9 +++++- .../check/JUnit5PublicAbstractIsValid.txt | 1 + .../source/JUnit5PublicAbstractIsValid.java | 32 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5PublicAbstractIsValid.txt create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5PublicAbstractIsValid.java diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java index 59eb1bec..e110eab7 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java @@ -97,9 +97,11 @@ public int[] getAcceptableTokens() { @Override public void beginTree(DetailAST rootAST) { + this.testClass = null; this.imports.clear(); this.testMethods.clear(); this.lifecycleMethods.clear(); + this.nestedTestClasses.clear(); } @Override @@ -181,7 +183,7 @@ private boolean shouldCheck() { } private void check() { - if (this.testClass != null) { + if (this.testClass != null && !isAbstract(this.testClass)) { checkVisibility(Arrays.asList(this.testClass), "junit5.publicClass", null); } checkVisibility(this.nestedTestClasses, "junit5.publicNestedClass", "junit5.privateNestedClass"); @@ -200,6 +202,11 @@ private void check() { checkVisibility(this.lifecycleMethods, "junit5.lifecyclePublicMethod", "junit5.lifecyclePrivateMethod"); } + private boolean isAbstract(DetailAST ast) { + DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS); + return modifiers.findFirstToken(TokenTypes.ABSTRACT) != null; + } + private void checkVisibility(List asts, String publicMessageKey, String privateMessageKey) { for (DetailAST ast : asts) { DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS); diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5PublicAbstractIsValid.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5PublicAbstractIsValid.txt new file mode 100644 index 00000000..69174e4c --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/JUnit5PublicAbstractIsValid.txt @@ -0,0 +1 @@ ++0 errors \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5PublicAbstractIsValid.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5PublicAbstractIsValid.java new file mode 100644 index 00000000..d56bbbd6 --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/JUnit5PublicAbstractIsValid.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017-2024 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 org.junit.jupiter.api.Test; + +/** + * This is a valid example. We allow abstract test classes to be + * public so that classes in other packages can extend them. + * + * @author Andy Wilkinson + */ +public abstract class JUnit5PublicAbstractIsValid { + + @Test + void doSomethingWorks() { + // test here + } + +} From 9eeeee17446836ae98ee1ee4fd3d5e1127081162 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 13 Aug 2024 11:19:45 +0100 Subject: [PATCH 11/29] Reformat code --- .../javaformat/checkstyle/check/SpringJUnit5Check.java | 9 +++++---- .../checkstyle/check/SpringTestFileNameCheck.java | 3 ++- .../checkstyle/SpringConfigurationLoaderTests.java | 5 +++-- .../jdk17/eclipse/JavadocLineBreakPreparator.java | 3 +-- .../jdk8/eclipse/JavadocLineBreakPreparator.java | 3 +-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java index e110eab7..cdd8efc4 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringJUnit5Check.java @@ -129,8 +129,9 @@ private void visitMethodDef(DetailAST ast) { } private boolean containsAnnotation(DetailAST ast, List annotations) { - List annotationNames = annotations.stream().flatMap((annotation) -> - Stream.of(annotation.simpleName, annotation.fullyQualifiedName())).collect(Collectors.toList()); + List annotationNames = annotations.stream() + .flatMap((annotation) -> Stream.of(annotation.simpleName, annotation.fullyQualifiedName())) + .collect(Collectors.toList()); try { return AnnotationUtil.containsAnnotation(ast, annotationNames); } @@ -138,8 +139,8 @@ private boolean containsAnnotation(DetailAST ast, List annotations) // Checkstyle >= 10.3 (https://github.com/checkstyle/checkstyle/issues/14134) Set annotationNamesSet = new HashSet<>(annotationNames); try { - return (boolean) AnnotationUtil.class.getMethod("containsAnnotation", DetailAST.class, Set.class) - .invoke(null, ast, annotationNamesSet); + return (boolean) AnnotationUtil.class.getMethod("containsAnnotation", DetailAST.class, Set.class) + .invoke(null, ast, annotationNamesSet); } catch (Exception ex2) { throw new RuntimeException("containsAnnotation failed", ex2); diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java index b2041870..01708750 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringTestFileNameCheck.java @@ -27,7 +27,8 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** - * Checks that test class filenames end {@literal Tests.java} and not {@literal Test.java}. + * Checks that test class filenames end {@literal Tests.java} and not + * {@literal Test.java}. * * @author Phillip Webb * @author Andy Wilkinson diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringConfigurationLoaderTests.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringConfigurationLoaderTests.java index 760d5ed2..33536e6b 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringConfigurationLoaderTests.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/SpringConfigurationLoaderTests.java @@ -57,8 +57,9 @@ public void loadShouldLoadChecks() { @Test public void loadWithExcludeShouldExcludeChecks() { - Set excludes = new HashSet(Arrays.asList("com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck", - "com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck")); + Set excludes = new HashSet( + Arrays.asList("com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck", + "com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck")); Collection checks = load(excludes); assertThat(checks).hasSize(5); TreeWalker treeWalker = (TreeWalker) checks.toArray()[4]; diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JavadocLineBreakPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JavadocLineBreakPreparator.java index e0dd5d8c..b66efa27 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JavadocLineBreakPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JavadocLineBreakPreparator.java @@ -94,8 +94,7 @@ public boolean visit(Javadoc node) { int commentIndex = this.tokenManager.firstIndexIn(node, TerminalTokens.TokenNameCOMMENT_JAVADOC); Token commentToken = this.tokenManager.get(commentIndex); this.commentTokenManager = (commentToken.getInternalStructure() != null) - ? new TokenManager(commentToken.getInternalStructure(), this.tokenManager) - : null; + ? new TokenManager(commentToken.getInternalStructure(), this.tokenManager) : null; this.declaration = node.getParent(); this.firstTagElement = true; this.hasText = false; diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JavadocLineBreakPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JavadocLineBreakPreparator.java index 4113bbf2..3a4a5f41 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JavadocLineBreakPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JavadocLineBreakPreparator.java @@ -94,8 +94,7 @@ public boolean visit(Javadoc node) { int commentIndex = this.tokenManager.firstIndexIn(node, TerminalTokens.TokenNameCOMMENT_JAVADOC); Token commentToken = this.tokenManager.get(commentIndex); this.commentTokenManager = (commentToken.getInternalStructure() != null) - ? new TokenManager(commentToken.getInternalStructure(), this.tokenManager) - : null; + ? new TokenManager(commentToken.getInternalStructure(), this.tokenManager) : null; this.declaration = node.getParent(); this.firstTagElement = true; this.hasText = false; From 30ce46901ff03f2205b347ea4b957e978472f9c3 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 13 Aug 2024 11:17:38 +0100 Subject: [PATCH 12/29] Skip SpringLeadingWhitespaceCheck in text blocks Closes gh-421 --- .../check/SpringLeadingWhitespaceCheck.java | 53 ++++++++++++++++++- .../LeadingWhitespaceTabsAndTextBlock.txt | 1 + .../LeadingWhitespaceTabsAndTextBlock.java | 33 ++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/LeadingWhitespaceTabsAndTextBlock.txt create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LeadingWhitespaceTabsAndTextBlock.java diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringLeadingWhitespaceCheck.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringLeadingWhitespaceCheck.java index 188e6781..8e3fa83f 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringLeadingWhitespaceCheck.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringLeadingWhitespaceCheck.java @@ -17,7 +17,9 @@ package io.spring.javaformat.checkstyle.check; import java.io.File; +import java.util.ArrayDeque; import java.util.Collections; +import java.util.Deque; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -26,6 +28,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.FileText; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; import io.spring.javaformat.config.IndentationStyle; import io.spring.javaformat.config.JavaFormatConfig; @@ -49,14 +52,32 @@ public class SpringLeadingWhitespaceCheck extends AbstractSpringCheck { private IndentationStyle indentationStyle; + private final Deque textBlockPairs = new ArrayDeque<>(); + @Override public int[] getAcceptableTokens() { - return NO_REQUIRED_TOKENS; + return new int[] { TokenTypes.TEXT_BLOCK_LITERAL_BEGIN, TokenTypes.TEXT_BLOCK_LITERAL_END }; + } + + @Override + public void visitToken(DetailAST ast) { + super.visitToken(ast); + if (ast.getType() == TokenTypes.TEXT_BLOCK_LITERAL_BEGIN) { + this.textBlockPairs.add(new TextBlockPair(ast)); + } + else if (ast.getType() == TokenTypes.TEXT_BLOCK_LITERAL_END) { + this.textBlockPairs.getLast().end(ast); + } } @Override public void beginTree(DetailAST rootAST) { super.beginTree(rootAST); + this.textBlockPairs.clear(); + } + + @Override + public void finishTree(DetailAST rootAST) { FileContents fileContents = getFileContents(); FileText fileText = fileContents.getText(); File file = fileText.getFile(); @@ -66,8 +87,11 @@ public void beginTree(DetailAST rootAST) { IndentationStyle indentationStyle = (this.indentationStyle != null) ? this.indentationStyle : JavaFormatConfig.findFrom(file.getParentFile()).getIndentationStyle(); for (int i = 0; i < fileText.size(); i++) { - String line = fileText.get(i); int lineNo = i + 1; + if (isInTextBlock(lineNo)) { + continue; + } + String line = fileText.get(i); Matcher matcher = PATTERN.matcher(line); boolean found = matcher.find(0); while (found @@ -78,6 +102,11 @@ public void beginTree(DetailAST rootAST) { log(lineNo, "leadingwhitespace.incorrect", indentationStyle.toString().toLowerCase()); } } + super.finishTree(rootAST); + } + + private boolean isInTextBlock(int lineNo) { + return this.textBlockPairs.stream().anyMatch((textBlockPair) -> textBlockPair.contains(lineNo)); } public void setIndentationStyle(String indentationStyle) { @@ -85,4 +114,24 @@ public void setIndentationStyle(String indentationStyle) { ? IndentationStyle.valueOf(indentationStyle.toUpperCase()) : null; } + private static class TextBlockPair { + + private final DetailAST begin; + + private DetailAST end; + + TextBlockPair(DetailAST begin) { + this.begin = begin; + } + + public boolean contains(int lineNo) { + return (lineNo > this.begin.getLineNo()) && (lineNo <= this.end.getLineNo()); + } + + void end(DetailAST end) { + this.end = end; + } + + } + } diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/LeadingWhitespaceTabsAndTextBlock.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/LeadingWhitespaceTabsAndTextBlock.txt new file mode 100644 index 00000000..23435c7a --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/LeadingWhitespaceTabsAndTextBlock.txt @@ -0,0 +1 @@ ++0 errors diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LeadingWhitespaceTabsAndTextBlock.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LeadingWhitespaceTabsAndTextBlock.java new file mode 100644 index 00000000..e9e27b7b --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/LeadingWhitespaceTabsAndTextBlock.java @@ -0,0 +1,33 @@ +/* + * Copyright 2017-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. + * 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. + */ + +/** + * Leading whitepace with a text block. + * + * @author Phillip Webb + */ +public class LeadingWhitespaceTabsAndTextBlock { + + /** + * Comments are ignored. + */ + public void hello() { + System.out.println("""" + Hello + World!"""); + } + +} From bbd8fa95abe07c2cf998443a0cb56dc12563d092 Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Tue, 13 Aug 2024 13:21:33 +0000 Subject: [PATCH 13/29] Next development version (v0.0.44-SNAPSHOT) --- README.adoc | 2 +- pom.xml | 2 +- samples/spring-javaformat-gradle-sample/build.gradle | 4 ++-- samples/spring-javaformat-maven-sample/pom.xml | 2 +- .../io.spring.javaformat.eclipse.feature/feature.xml | 4 ++-- .../io.spring.javaformat.eclipse.feature/pom.xml | 2 +- .../io.spring.javaformat.eclipse.site/category.xml | 2 +- .../io.spring.javaformat.eclipse.product | 2 +- .../io.spring.javaformat.eclipse.site/pom.xml | 2 +- .../io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse.tests/pom.xml | 2 +- .../io.spring.javaformat.eclipse/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse/pom.xml | 2 +- spring-javaformat-eclipse/pom.xml | 2 +- .../io.spring.javaformat.gradle.plugin/pom.xml | 2 +- spring-javaformat-gradle/pom.xml | 2 +- .../spring-javaformat-gradle-plugin/pom.xml | 2 +- spring-javaformat-intellij-idea/pom.xml | 2 +- .../spring-javaformat-intellij-idea-plugin/pom.xml | 2 +- .../spring-javaformat-intellij-idea-runtime/pom.xml | 2 +- spring-javaformat-maven/pom.xml | 2 +- .../spring-javaformat-maven-plugin/pom.xml | 2 +- spring-javaformat-vscode/pom.xml | 2 +- .../spring-javaformat-vscode-extension/package-lock.json | 4 ++-- .../spring-javaformat-vscode-extension/package.json | 2 +- .../spring-javaformat-vscode-extension/pom.xml | 2 +- spring-javaformat/pom.xml | 2 +- spring-javaformat/spring-javaformat-checkstyle/pom.xml | 2 +- spring-javaformat/spring-javaformat-config/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk17/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-rewriter/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-runtime/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shaded/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shader/pom.xml | 2 +- .../spring-javaformat-formatter-test-support/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter/pom.xml | 2 +- 42 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.adoc b/README.adoc index 60e85607..d8ed6e45 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -:release-version: 0.0.42 +:release-version: 0.0.43 :checkstyle-version: 9.3 == Spring Java Format diff --git a/pom.xml b/pom.xml index a619156b..c7e0ba80 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT pom Spring JavaFormat Build Spring JavaFormat diff --git a/samples/spring-javaformat-gradle-sample/build.gradle b/samples/spring-javaformat-gradle-sample/build.gradle index b3bc0f41..251a0478 100644 --- a/samples/spring-javaformat-gradle-sample/build.gradle +++ b/samples/spring-javaformat-gradle-sample/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.43-SNAPSHOT") + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.44-SNAPSHOT") } } @@ -25,5 +25,5 @@ checkstyle { } dependencies { - checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.43-SNAPSHOT") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.44-SNAPSHOT") } diff --git a/samples/spring-javaformat-maven-sample/pom.xml b/samples/spring-javaformat-maven-sample/pom.xml index cec0c38e..cf225184 100644 --- a/samples/spring-javaformat-maven-sample/pom.xml +++ b/samples/spring-javaformat-maven-sample/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT UTF-8 - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml index b50eb61c..9f08618a 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ @@ -22,7 +22,7 @@ id="io.spring.javaformat.eclipse" download-size="0" install-size="0" - version="0.0.43.qualifier" + version="0.0.44.qualifier" unpack="false"/> diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml index f0447048..0393db0c 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT io.spring.javaformat.eclipse.feature eclipse-feature diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml index 3bb9eaf8..e3ad51fd 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml @@ -3,7 +3,7 @@ Maven Integration for Eclipse (maven-eclipse-plugin support) - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product index 511b7d62..fc5cf2eb 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product @@ -1,7 +1,7 @@ - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml index 806bab83..7d8f71ce 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT io.spring.javaformat.eclipse.site eclipse-repository diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF index eed2c0de..4f9fbff4 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Tests Bundle-SymbolicName: io.spring.javaformat.eclipse.tests Automatic-Module-Name: io.spring.javaformat.eclipse.tests -Bundle-Version: 0.0.43.qualifier +Bundle-Version: 0.0.44.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., lib/assertj-core.jar, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml index 29003f38..bf8669b4 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT io.spring.javaformat.eclipse.tests eclipse-test-plugin diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF index 5bbf628e..46b89ccb 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Bundle-SymbolicName: io.spring.javaformat.eclipse;singleton:=true Automatic-Module-Name: io.spring.javaformat.eclipse -Bundle-Version: 0.0.43.qualifier +Bundle-Version: 0.0.44.qualifier Bundle-Activator: io.spring.javaformat.eclipse.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml index 81e1a81b..dec698d9 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT io.spring.javaformat.eclipse eclipse-plugin diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml index c1f85ed9..b0d1b674 100644 --- a/spring-javaformat-eclipse/pom.xml +++ b/spring-javaformat-eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-eclipse pom diff --git a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml index 650c586f..21ea0f9b 100644 --- a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml +++ b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT io.spring.javaformat io.spring.javaformat.gradle.plugin diff --git a/spring-javaformat-gradle/pom.xml b/spring-javaformat-gradle/pom.xml index e0da30d0..e3026aee 100644 --- a/spring-javaformat-gradle/pom.xml +++ b/spring-javaformat-gradle/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-gradle pom diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml index c96c929e..f6967ca0 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-gradle-plugin pom diff --git a/spring-javaformat-intellij-idea/pom.xml b/spring-javaformat-intellij-idea/pom.xml index 3605f2a0..1daa8cad 100644 --- a/spring-javaformat-intellij-idea/pom.xml +++ b/spring-javaformat-intellij-idea/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-intellij-idea pom diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml index 46ee2658..a1e09a0e 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-intellij-idea-plugin Spring JavaFormat IntelliJ IDEA Plugin diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml index 8575c456..3e577cbd 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-intellij-idea-runtime pom diff --git a/spring-javaformat-maven/pom.xml b/spring-javaformat-maven/pom.xml index 299baf24..896f87b8 100644 --- a/spring-javaformat-maven/pom.xml +++ b/spring-javaformat-maven/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-maven pom diff --git a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml index 3e2efc32..bdcb704c 100644 --- a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml +++ b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-maven - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-maven-plugin maven-plugin diff --git a/spring-javaformat-vscode/pom.xml b/spring-javaformat-vscode/pom.xml index 703c3a3c..e87f39f0 100644 --- a/spring-javaformat-vscode/pom.xml +++ b/spring-javaformat-vscode/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-vscode pom diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index cf72087a..f991a7ab 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-javaformat-vscode-extension", - "version": "0.0.43-SNAPSHOT", + "version": "0.0.44-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-javaformat-vscode-extension", - "version": "0.0.43-SNAPSHOT", + "version": "0.0.44-SNAPSHOT", "devDependencies": { "@types/glob": "^8.0.1", "@types/mocha": "^10.0.1", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index 86a6b65b..290ae51f 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "spring-javaformat-vscode-extension", "description": "Spring JavaFormat Visual Studio Code Extension", "displayName": "Spring JavaFormat", - "version": "0.0.43-SNAPSHOT", + "version": "0.0.44-SNAPSHOT", "publisher": "io.spring.javaformat", "engines": { "vscode": "^1.75.0" diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml index cdac8ac0..66239a95 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-vscode - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-vscode-extension Spring JavaFormat Visual Studio Code Extension diff --git a/spring-javaformat/pom.xml b/spring-javaformat/pom.xml index fc14a0f0..e5991b91 100644 --- a/spring-javaformat/pom.xml +++ b/spring-javaformat/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat pom diff --git a/spring-javaformat/spring-javaformat-checkstyle/pom.xml b/spring-javaformat/spring-javaformat-checkstyle/pom.xml index 98a45e42..3ea8357e 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/pom.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-checkstyle Spring JavaFormat CheckStyle diff --git a/spring-javaformat/spring-javaformat-config/pom.xml b/spring-javaformat/spring-javaformat-config/pom.xml index 39d27d20..cf59a073 100644 --- a/spring-javaformat/spring-javaformat-config/pom.xml +++ b/spring-javaformat/spring-javaformat-config/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-config Spring JavaFormat Config diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF index e8f28aee..abc2e727 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse Runtime JDK17 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17 -Bundle-Version: 0.0.43.qualifier +Bundle-Version: 0.0.44.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml index cda64abf..2eff5105 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-jdk17 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF index 6ceab19d..24f373c1 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse JDK8 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk8 -Bundle-Version: 0.0.43.qualifier +Bundle-Version: 0.0.44.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml index 0016a013..d2ce8030 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-jdk8 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml index 3f8b1057..5e64f7b4 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk17 Spring JavaFormat Eclipse JDT JDK-17 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml index 83f65fb9..88f90cfc 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk8 Spring JavaFormat Eclipse JDT JDK-8 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml index 44a54dbd..2a686bb6 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-rewriter Spring JavaFormat Eclipse Rewriter diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml index 12ae265c..9be91feb 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-eclipse-runtime Spring JavaFormat Eclipse Runtime diff --git a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml index 72eb47c8..d047564d 100644 --- a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-shaded Spring JavaFormat Formatter Shaded diff --git a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml index 601f6dd7..6485c73e 100644 --- a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-shader Spring JavaFormat Formatter Shader diff --git a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml index 9f247485..a2315b1f 100644 --- a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-test-support Spring JavaFormat Formatter Test Support diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index bc439188..41e52b05 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter-tests Spring JavaFormat Formatter Tests diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml index 3a6c41c3..c604551e 100644 --- a/spring-javaformat/spring-javaformat-formatter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.43-SNAPSHOT + 0.0.44-SNAPSHOT spring-javaformat-formatter Spring JavaFormat Formatter From def2b30c59589a7457a97da1df1ffe225d978ab1 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 15 Jan 2025 09:41:11 +0000 Subject: [PATCH 14/29] Switch from CLA to DCO --- .github/dco.yml | 2 ++ CONTRIBUTING.adoc | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .github/dco.yml diff --git a/.github/dco.yml b/.github/dco.yml new file mode 100644 index 00000000..0c4b142e --- /dev/null +++ b/.github/dco.yml @@ -0,0 +1,2 @@ +require: + members: false diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index c4378ac3..a7e07f62 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -12,10 +12,9 @@ Please report unacceptable behavior to spring-code-of-conduct@pivotal.io. -== Sign the Contributor License Agreement -Before we accept a non-trivial patch or pull request we will need you to https://cla.pivotal.io/sign/spring[sign the Contributor License Agreement]. -Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. -Active contributors might be asked to join the core team, and given the ability to merge pull requests. +== Include a Signed-off-by Trailer +All commits must include a __Signed-off-by__ trailer at the end of each commit message to indicate that the contributor agrees to the https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin[Developer Certificate of Origin (DCO)]. +For additional details, please refer to the blog post https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring[Hello DCO, Goodbye CLA: Simplifying Contributions to Spring]. From bdd396fef8a7fa34be2bc44eae19102373ff170e Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 23 Apr 2025 15:35:43 +0100 Subject: [PATCH 15/29] Upgrade to Java 17.0.14 --- .sdkmanrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sdkmanrc b/.sdkmanrc index 828308d2..83ec5a0a 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,3 +1,3 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=17.0.12-librca +java=17.0.14-librca From 601aa275b425d3b06ed32221725fc0cc8ad2cc0f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 23 Apr 2025 19:10:43 +0100 Subject: [PATCH 16/29] Tolerate breaking change in Checkstyle 10.22 In Checkstyle 10.22 the scope property on JavadocVariableCheck was renamed to accessModifiers. This commit tolerates this change by templating spring-checkstyle.xml and replacing the property name in the XML based on the name of the method that's available on JavadocVariableCheck. Closes gh-433 --- .../checkstyle/SpringConfigurationLoader.java | 44 ++++++++++++++++--- .../checkstyle/spring-checkstyle.xml | 2 +- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/SpringConfigurationLoader.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/SpringConfigurationLoader.java index 12bd56c7..42ca7311 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/SpringConfigurationLoader.java +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/SpringConfigurationLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2025 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. @@ -16,7 +16,11 @@ package io.spring.javaformat.checkstyle; +import java.io.IOException; import java.io.InputStream; +import java.io.StringReader; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collection; import java.util.stream.Collectors; @@ -30,6 +34,8 @@ import com.puppycrawl.tools.checkstyle.api.Context; import com.puppycrawl.tools.checkstyle.api.Contextualizable; import com.puppycrawl.tools.checkstyle.api.FileSetCheck; +import com.puppycrawl.tools.checkstyle.api.Scope; +import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck; import org.xml.sax.InputSource; /** @@ -50,17 +56,45 @@ class SpringConfigurationLoader { } public Collection load(PropertyResolver propertyResolver) { - Configuration config = loadConfiguration(getClass().getResourceAsStream("spring-checkstyle.xml"), - propertyResolver); + Configuration config = loadConfiguration(loadConfigurationSource(), propertyResolver); return Arrays.stream(config.getChildren()) .filter(this.moduleFactory::nonFiltered) .map(this::load) .collect(Collectors.toList()); } - private Configuration loadConfiguration(InputStream inputStream, PropertyResolver propertyResolver) { + private String loadConfigurationSource() { + try (InputStream stream = getClass().getResourceAsStream("spring-checkstyle.xml")) { + StringBuilder builder = new StringBuilder(); + byte[] buffer = new byte[4096]; + int read; + while ((read = stream.read(buffer)) > 0) { + builder.append(new String(buffer, 0, read, StandardCharsets.UTF_8)); + } + return preprocessConfigurationSource(builder.toString()); + } + catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + + private String preprocessConfigurationSource(String source) { + return source.replace("{{javadocVariableCheckScopeProperty}}", javadocVariableCheckScopeProperty()); + } + + private String javadocVariableCheckScopeProperty() { + try { + JavadocVariableCheck.class.getMethod("setScope", Scope.class); + return "scope"; + } + catch (NoSuchMethodException ex) { + return "accessModifiers"; + } + } + + private Configuration loadConfiguration(String source, PropertyResolver propertyResolver) { try { - InputSource inputSource = new InputSource(inputStream); + InputSource inputSource = new InputSource(new StringReader(source)); return ConfigurationLoader.loadConfiguration(inputSource, propertyResolver, IgnoredModulesOptions.EXECUTE); } catch (CheckstyleException ex) { diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml index a41c37bf..fa6f8a64 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml @@ -90,7 +90,7 @@ - + From 35984352460298190f8ae9e45d5dd35a74b30518 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sat, 21 Sep 2024 21:25:25 +0900 Subject: [PATCH 17/29] Polish sample in README See gh-423 --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index d8ed6e45..cb549f97 100644 --- a/README.adoc +++ b/README.adoc @@ -391,7 +391,7 @@ For example: [source,java,indent=0,subs="normal"] ---- -class Name { +public class Name { private final String first; From f923fae0f490126f6eabb51dcb7b690ccc10717c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 28 Apr 2025 13:53:11 +0100 Subject: [PATCH 18/29] Fix copy-paste error in build-pull-request workflow --- .github/workflows/build-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index 0965a8c3..9e085b69 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -6,7 +6,7 @@ jobs: build: name: Build Pull Request runs-on: ubuntu-latest - if: ${{ github.repository == 'spring-projects/spring-boot' }} + if: ${{ github.repository == 'spring-io/spring-javaformat' }} steps: - name: Check Out uses: actions/checkout@v4 From 61466c2e234865f3b83344497b3b7df53df2f242 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 27 Apr 2025 22:44:29 +0900 Subject: [PATCH 19/29] Throw VerificationException for build verification failures See gh-436 Signed-off-by: Johnny Lim --- .../java/io/spring/javaformat/gradle/tasks/CheckFormat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/src/main/java/io/spring/javaformat/gradle/tasks/CheckFormat.java b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/src/main/java/io/spring/javaformat/gradle/tasks/CheckFormat.java index 096e1109..7e531d42 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/src/main/java/io/spring/javaformat/gradle/tasks/CheckFormat.java +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/src/main/java/io/spring/javaformat/gradle/tasks/CheckFormat.java @@ -24,10 +24,10 @@ import java.util.List; import java.util.stream.Collectors; -import org.gradle.api.GradleException; import org.gradle.api.tasks.CacheableTask; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import org.gradle.api.tasks.VerificationException; import io.spring.javaformat.formatter.FileEdit; @@ -63,7 +63,7 @@ public void checkFormatting() throws IOException, InterruptedException { message.append("\nRun `format` to fix."); Files.write(this.reportLocation.toPath(), Collections.singletonList(message.toString()), StandardOpenOption.CREATE); - throw new GradleException(message.toString()); + throw new VerificationException(message.toString()); } else { this.reportLocation.createNewFile(); From 79d64af8ddf0c847abd6bd113b5577dff58f41dc Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 2 May 2025 19:45:48 -0700 Subject: [PATCH 20/29] Upgrade tests to use Java 17 --- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index 41e52b05..6a0da60a 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -12,7 +12,7 @@ Spring JavaFormat Formatter Tests ${basedir}/../.. - 11 + 17 From 355abdc953839b4318af7b67cb4a8337dc5ddf1d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 2 May 2025 19:45:57 -0700 Subject: [PATCH 21/29] Add JSpecifyPreparator to consistently format `@Nullable` Fixes gh-435 --- .../projectsettings/org.eclipse.jdt.ui.prefs | 1 + .../formatter/AbstractFormatterTests.java | 2 +- .../src/test/resources/expected/nullable.txt | 21 +++++ .../src/test/resources/source/nullable.txt | 20 ++++ .../eclipse/EclipseJdk17CodeFormatter.java | 3 +- .../jdk17/eclipse/JSpecifyPreparator.java | 94 +++++++++++++++++++ .../eclipse/EclipseJdk8CodeFormatter.java | 3 +- .../jdk8/eclipse/JSpecifyPreparator.java | 94 +++++++++++++++++++ 8 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt create mode 100644 spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java create mode 100644 spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs index af9117f9..23d79e64 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,4 @@ +cleanup.add_all=false cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java b/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java index bf873dd2..c01324c2 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2025 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/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt new file mode 100644 index 00000000..b077cb5d --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt @@ -0,0 +1,21 @@ +package example; + +import org.jspecify.annotations.Nullable; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override + @Nullable String myMethod(String param); + + @Override + public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String @Nullable [] array, @Nullable String @Nullable ... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt new file mode 100644 index 00000000..b2952241 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt @@ -0,0 +1,20 @@ +package example; + +import org.jspecify.annotations.Nullable; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override @Nullable String myMethod(String param); + + @Override public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String @Nullable [] array, @Nullable + String @Nullable ... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/EclipseJdk17CodeFormatter.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/EclipseJdk17CodeFormatter.java index 45103159..b902e3f3 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/EclipseJdk17CodeFormatter.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/EclipseJdk17CodeFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 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. @@ -43,6 +43,7 @@ public EclipseJdk17CodeFormatter(JavaFormatConfig javaFormatConfig) { this.appliedOptions = options; addPreparator(new JavadocLineBreakPreparator()); addPreparator(new CodeLineBreakPreparator()); + addPreparator(new JSpecifyPreparator()); } @Override diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java new file mode 100644 index 00000000..7d017570 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java @@ -0,0 +1,94 @@ +/* + * Copyright 2017-2025 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. + */ + +package io.spring.javaformat.formatter.jdk17.eclipse; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ASTNode; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ASTVisitor; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.Annotation; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.IExtendedModifier; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.MethodDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.SingleVariableDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk17.core.formatter.CodeFormatter; +import io.spring.javaformat.eclipse.jdt.jdk17.internal.formatter.Preparator; +import io.spring.javaformat.eclipse.jdt.jdk17.internal.formatter.TokenManager; + +public class JSpecifyPreparator implements Preparator { + + private static final Set ANNOTATION_NAMES = new HashSet<>( + Arrays.asList("NonNull", "Nullable", "NullMarked", "NullUnmarked")); + + @Override + public void apply(int kind, TokenManager tokenManager, ASTNode astRoot) { + if ((kind & CodeFormatter.K_COMPILATION_UNIT) != 0) { + ASTVisitor visitor = new Vistor(tokenManager); + astRoot.accept(visitor); + } + } + + private static class Vistor extends ASTVisitor { + + private final TokenManager tokenManager; + + Vistor(TokenManager tokenManager) { + this.tokenManager = tokenManager; + } + + @Override + @SuppressWarnings("unchecked") + public boolean visit(MethodDeclaration node) { + Annotation lastAnnotation = getLastAnnotation((List) node.modifiers()); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); + } + return true; + } + + @Override + @SuppressWarnings("unchecked") + public void endVisit(SingleVariableDeclaration node) { + if (node.isVarargs()) { + List annotations = node.varargsAnnotations(); + Annotation lastAnnotation = getLastAnnotation(annotations); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).spaceAfter(); + } + } + } + + private Annotation getLastAnnotation(List modifiers) { + Annotation annotation = null; + for (IExtendedModifier modifier : modifiers) { + if (!modifier.isAnnotation()) { + return annotation; + } + annotation = (Annotation) modifier; + } + return annotation; + } + + private boolean isJSpecifyAnnotation(Annotation annotation) { + return (annotation != null) && ANNOTATION_NAMES.contains(annotation.getTypeName().toString()); + } + + } + +} diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/EclipseJdk8CodeFormatter.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/EclipseJdk8CodeFormatter.java index 5038538f..fa365db4 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/EclipseJdk8CodeFormatter.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/EclipseJdk8CodeFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 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. @@ -43,6 +43,7 @@ public EclipseJdk8CodeFormatter(JavaFormatConfig javaFormatConfig) { this.appliedOptions = options; addPreparator(new JavadocLineBreakPreparator()); addPreparator(new CodeLineBreakPreparator()); + addPreparator(new JSpecifyPreparator()); } @Override diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java new file mode 100644 index 00000000..620b462f --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java @@ -0,0 +1,94 @@ +/* + * Copyright 2017-2025 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. + */ + +package io.spring.javaformat.formatter.jdk8.eclipse; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ASTNode; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ASTVisitor; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.Annotation; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.IExtendedModifier; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.MethodDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.SingleVariableDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk8.core.formatter.CodeFormatter; +import io.spring.javaformat.eclipse.jdt.jdk8.internal.formatter.Preparator; +import io.spring.javaformat.eclipse.jdt.jdk8.internal.formatter.TokenManager; + +public class JSpecifyPreparator implements Preparator { + + private static final Set ANNOTATION_NAMES = new HashSet<>( + Arrays.asList("NonNull", "Nullable", "NullMarked", "NullUnmarked")); + + @Override + public void apply(int kind, TokenManager tokenManager, ASTNode astRoot) { + if ((kind & CodeFormatter.K_COMPILATION_UNIT) != 0) { + ASTVisitor visitor = new Vistor(tokenManager); + astRoot.accept(visitor); + } + } + + private static class Vistor extends ASTVisitor { + + private final TokenManager tokenManager; + + Vistor(TokenManager tokenManager) { + this.tokenManager = tokenManager; + } + + @Override + @SuppressWarnings("unchecked") + public boolean visit(MethodDeclaration node) { + Annotation lastAnnotation = getLastAnnotation((List) node.modifiers()); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); + } + return true; + } + + @Override + @SuppressWarnings("unchecked") + public void endVisit(SingleVariableDeclaration node) { + if (node.isVarargs()) { + List annotations = node.varargsAnnotations(); + Annotation lastAnnotation = getLastAnnotation(annotations); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).spaceAfter(); + } + } + } + + private Annotation getLastAnnotation(List modifiers) { + Annotation annotation = null; + for (IExtendedModifier modifier : modifiers) { + if (!modifier.isAnnotation()) { + return annotation; + } + annotation = (Annotation) modifier; + } + return annotation; + } + + private boolean isJSpecifyAnnotation(Annotation annotation) { + return (annotation != null) && ANNOTATION_NAMES.contains(annotation.getTypeName().toString()); + } + + } + +} From c497b86370b2a62c1c5aff34969251c110263c08 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 14 May 2025 11:53:32 -0700 Subject: [PATCH 22/29] Attempt to fix apt-get install problem --- .github/actions/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 7f8bc0e2..c1d38d98 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -4,7 +4,7 @@ runs: steps: - name: Set Up Utilities shell: bash - run: sudo apt-get -y install libxml2-utils + run: sudo apt-get update && sudo apt-get -y install libxml2-utils - name: Set Up Java uses: actions/setup-java@v4 with: From 2ffeb8ef2bb96d588bcc7c13e6041c77755947f9 Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Wed, 14 May 2025 19:13:53 +0000 Subject: [PATCH 23/29] Next development version (v0.0.45-SNAPSHOT) --- README.adoc | 2 +- pom.xml | 2 +- samples/spring-javaformat-gradle-sample/build.gradle | 4 ++-- samples/spring-javaformat-maven-sample/pom.xml | 2 +- .../io.spring.javaformat.eclipse.feature/feature.xml | 4 ++-- .../io.spring.javaformat.eclipse.feature/pom.xml | 2 +- .../io.spring.javaformat.eclipse.site/category.xml | 2 +- .../io.spring.javaformat.eclipse.product | 2 +- .../io.spring.javaformat.eclipse.site/pom.xml | 2 +- .../io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse.tests/pom.xml | 2 +- .../io.spring.javaformat.eclipse/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse/pom.xml | 2 +- spring-javaformat-eclipse/pom.xml | 2 +- .../io.spring.javaformat.gradle.plugin/pom.xml | 2 +- spring-javaformat-gradle/pom.xml | 2 +- .../spring-javaformat-gradle-plugin/pom.xml | 2 +- spring-javaformat-intellij-idea/pom.xml | 2 +- .../spring-javaformat-intellij-idea-plugin/pom.xml | 2 +- .../spring-javaformat-intellij-idea-runtime/pom.xml | 2 +- spring-javaformat-maven/pom.xml | 2 +- .../spring-javaformat-maven-plugin/pom.xml | 2 +- spring-javaformat-vscode/pom.xml | 2 +- .../spring-javaformat-vscode-extension/package-lock.json | 4 ++-- .../spring-javaformat-vscode-extension/package.json | 2 +- .../spring-javaformat-vscode-extension/pom.xml | 2 +- spring-javaformat/pom.xml | 2 +- spring-javaformat/spring-javaformat-checkstyle/pom.xml | 2 +- spring-javaformat/spring-javaformat-config/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk17/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-rewriter/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-runtime/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shaded/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shader/pom.xml | 2 +- .../spring-javaformat-formatter-test-support/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter/pom.xml | 2 +- 42 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.adoc b/README.adoc index cb549f97..6ebfec9a 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -:release-version: 0.0.43 +:release-version: 0.0.44 :checkstyle-version: 9.3 == Spring Java Format diff --git a/pom.xml b/pom.xml index c7e0ba80..ff0d2732 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT pom Spring JavaFormat Build Spring JavaFormat diff --git a/samples/spring-javaformat-gradle-sample/build.gradle b/samples/spring-javaformat-gradle-sample/build.gradle index 251a0478..cebfcad0 100644 --- a/samples/spring-javaformat-gradle-sample/build.gradle +++ b/samples/spring-javaformat-gradle-sample/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.44-SNAPSHOT") + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.45-SNAPSHOT") } } @@ -25,5 +25,5 @@ checkstyle { } dependencies { - checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.44-SNAPSHOT") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.45-SNAPSHOT") } diff --git a/samples/spring-javaformat-maven-sample/pom.xml b/samples/spring-javaformat-maven-sample/pom.xml index cf225184..e7492a31 100644 --- a/samples/spring-javaformat-maven-sample/pom.xml +++ b/samples/spring-javaformat-maven-sample/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT UTF-8 - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml index 9f08618a..bbd37c1f 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ @@ -22,7 +22,7 @@ id="io.spring.javaformat.eclipse" download-size="0" install-size="0" - version="0.0.44.qualifier" + version="0.0.45.qualifier" unpack="false"/> diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml index 0393db0c..80811b23 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT io.spring.javaformat.eclipse.feature eclipse-feature diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml index e3ad51fd..b1a0200a 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml @@ -3,7 +3,7 @@ Maven Integration for Eclipse (maven-eclipse-plugin support) - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product index fc5cf2eb..0b2c41b6 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product @@ -1,7 +1,7 @@ - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml index 7d8f71ce..6272fb89 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT io.spring.javaformat.eclipse.site eclipse-repository diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF index 4f9fbff4..f9dc324d 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Tests Bundle-SymbolicName: io.spring.javaformat.eclipse.tests Automatic-Module-Name: io.spring.javaformat.eclipse.tests -Bundle-Version: 0.0.44.qualifier +Bundle-Version: 0.0.45.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., lib/assertj-core.jar, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml index bf8669b4..68810401 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT io.spring.javaformat.eclipse.tests eclipse-test-plugin diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF index 46b89ccb..30ff2e88 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Bundle-SymbolicName: io.spring.javaformat.eclipse;singleton:=true Automatic-Module-Name: io.spring.javaformat.eclipse -Bundle-Version: 0.0.44.qualifier +Bundle-Version: 0.0.45.qualifier Bundle-Activator: io.spring.javaformat.eclipse.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml index dec698d9..9f05ae23 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT io.spring.javaformat.eclipse eclipse-plugin diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml index b0d1b674..22815dd0 100644 --- a/spring-javaformat-eclipse/pom.xml +++ b/spring-javaformat-eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-eclipse pom diff --git a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml index 21ea0f9b..e9925fbb 100644 --- a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml +++ b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT io.spring.javaformat io.spring.javaformat.gradle.plugin diff --git a/spring-javaformat-gradle/pom.xml b/spring-javaformat-gradle/pom.xml index e3026aee..5ad6e456 100644 --- a/spring-javaformat-gradle/pom.xml +++ b/spring-javaformat-gradle/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-gradle pom diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml index f6967ca0..233242b6 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-gradle-plugin pom diff --git a/spring-javaformat-intellij-idea/pom.xml b/spring-javaformat-intellij-idea/pom.xml index 1daa8cad..2a7bdf51 100644 --- a/spring-javaformat-intellij-idea/pom.xml +++ b/spring-javaformat-intellij-idea/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-intellij-idea pom diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml index a1e09a0e..6c454f53 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-intellij-idea-plugin Spring JavaFormat IntelliJ IDEA Plugin diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml index 3e577cbd..e46a0764 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-intellij-idea-runtime pom diff --git a/spring-javaformat-maven/pom.xml b/spring-javaformat-maven/pom.xml index 896f87b8..b014b693 100644 --- a/spring-javaformat-maven/pom.xml +++ b/spring-javaformat-maven/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-maven pom diff --git a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml index bdcb704c..9ea0fc98 100644 --- a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml +++ b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-maven - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-maven-plugin maven-plugin diff --git a/spring-javaformat-vscode/pom.xml b/spring-javaformat-vscode/pom.xml index e87f39f0..5d2cc25d 100644 --- a/spring-javaformat-vscode/pom.xml +++ b/spring-javaformat-vscode/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-vscode pom diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index f991a7ab..8390499b 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-javaformat-vscode-extension", - "version": "0.0.44-SNAPSHOT", + "version": "0.0.45-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-javaformat-vscode-extension", - "version": "0.0.44-SNAPSHOT", + "version": "0.0.45-SNAPSHOT", "devDependencies": { "@types/glob": "^8.0.1", "@types/mocha": "^10.0.1", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index 290ae51f..b6be66c5 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "spring-javaformat-vscode-extension", "description": "Spring JavaFormat Visual Studio Code Extension", "displayName": "Spring JavaFormat", - "version": "0.0.44-SNAPSHOT", + "version": "0.0.45-SNAPSHOT", "publisher": "io.spring.javaformat", "engines": { "vscode": "^1.75.0" diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml index 66239a95..446a2c54 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-vscode - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-vscode-extension Spring JavaFormat Visual Studio Code Extension diff --git a/spring-javaformat/pom.xml b/spring-javaformat/pom.xml index e5991b91..ff871443 100644 --- a/spring-javaformat/pom.xml +++ b/spring-javaformat/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat pom diff --git a/spring-javaformat/spring-javaformat-checkstyle/pom.xml b/spring-javaformat/spring-javaformat-checkstyle/pom.xml index 3ea8357e..5ab40720 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/pom.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-checkstyle Spring JavaFormat CheckStyle diff --git a/spring-javaformat/spring-javaformat-config/pom.xml b/spring-javaformat/spring-javaformat-config/pom.xml index cf59a073..54ddd0c9 100644 --- a/spring-javaformat/spring-javaformat-config/pom.xml +++ b/spring-javaformat/spring-javaformat-config/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-config Spring JavaFormat Config diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF index abc2e727..7f5780eb 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse Runtime JDK17 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17 -Bundle-Version: 0.0.44.qualifier +Bundle-Version: 0.0.45.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml index 2eff5105..1ba8c47a 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-jdk17 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF index 24f373c1..2c93d052 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse JDK8 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk8 -Bundle-Version: 0.0.44.qualifier +Bundle-Version: 0.0.45.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml index d2ce8030..869a7fd8 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-jdk8 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml index 5e64f7b4..b36d3e7e 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk17 Spring JavaFormat Eclipse JDT JDK-17 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml index 88f90cfc..2a6af271 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk8 Spring JavaFormat Eclipse JDT JDK-8 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml index 2a686bb6..09a3ad1b 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-rewriter Spring JavaFormat Eclipse Rewriter diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml index 9be91feb..eb28f8e8 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-eclipse-runtime Spring JavaFormat Eclipse Runtime diff --git a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml index d047564d..96af85e1 100644 --- a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-shaded Spring JavaFormat Formatter Shaded diff --git a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml index 6485c73e..caae72af 100644 --- a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-shader Spring JavaFormat Formatter Shader diff --git a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml index a2315b1f..ef0f059b 100644 --- a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-test-support Spring JavaFormat Formatter Test Support diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index 6a0da60a..b9269ce4 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter-tests Spring JavaFormat Formatter Tests diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml index c604551e..1537e2fd 100644 --- a/spring-javaformat/spring-javaformat-formatter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.44-SNAPSHOT + 0.0.45-SNAPSHOT spring-javaformat-formatter Spring JavaFormat Formatter From 4122a3e5528fef124c38a2bd027464bf6423140a Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 14 May 2025 12:41:00 -0700 Subject: [PATCH 24/29] Upgrade to jfrog/setup-jfrog-cli v4.5.11 --- .github/workflows/promote.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index cad6e40b..e1faac58 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -36,7 +36,7 @@ jobs: - name: Check Out uses: actions/checkout@v4 - name: Set Up JFrog CLI - uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 + uses: jfrog/setup-jfrog-cli@ff5cb544114ffc152db9cea1cd3d5978d5074946 # v4.5.11 env: JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - name: Check Maven Central Sync Status From e0f76992415e8ff441b4fa7d52a4de0f7d6e9ce5 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 15 May 2025 12:20:16 -0700 Subject: [PATCH 25/29] Refine JSpecify support Update formatter to ignore non JSpecify `@Nullable` annotations and relax checkstyle to allow `@Nullable` on the same line. Fixes gh-440 --- .../check/SpringAnnotationLocationCheck.java | 124 ++++++++++++++++++ .../checkstyle/check/messages.properties | 2 + .../checkstyle/spring-checkstyle.xml | 5 +- .../resources/check/AnnotationOnNewLine.txt | 1 + .../resources/source/AnnotationOnNewLine.java | 45 +++++++ .../formatter/AbstractFormatterTests.java | 6 + .../expected/nullable-not-jspecify.txt | 23 ++++ .../expected/nullable-wildcard-import.txt | 22 ++++ .../src/test/resources/expected/nullable.txt | 3 +- .../source/nullable-not-jspecify.txt | 20 +++ .../source/nullable-wildcard-import.txt | 20 +++ .../src/test/resources/source/nullable.txt | 2 +- .../jdk17/eclipse/JSpecifyPreparator.java | 37 +++++- .../jdk8/eclipse/JSpecifyPreparator.java | 37 +++++- 14 files changed, 339 insertions(+), 8 deletions(-) create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringAnnotationLocationCheck.java create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/AnnotationOnNewLine.txt create mode 100644 spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/AnnotationOnNewLine.java create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-not-jspecify.txt create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-wildcard-import.txt create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-not-jspecify.txt create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-wildcard-import.txt diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringAnnotationLocationCheck.java b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringAnnotationLocationCheck.java new file mode 100644 index 00000000..f0fc0d5e --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringAnnotationLocationCheck.java @@ -0,0 +1,124 @@ +/* + * Copyright 2017-2025 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. + */ + +package io.spring.javaformat.checkstyle.check; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + +/** + * Spring variant of {@link AnnotationLocationCheck}. + * + * @author Phillip Webb + */ +public class SpringAnnotationLocationCheck extends AbstractCheck { + + private static final Set JSPECIFY_ANNOTATION_NAMES = new HashSet<>( + Arrays.asList("NonNull", "Nullable", "NullMarked", "NullUnmarked")); + + @Override + public int[] getDefaultTokens() { + return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.PACKAGE_DEF, + TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.ENUM_DEF, TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, + TokenTypes.VARIABLE_DEF, TokenTypes.RECORD_DEF, TokenTypes.COMPACT_CTOR_DEF, }; + } + + @Override + public int[] getAcceptableTokens() { + return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.PACKAGE_DEF, + TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.ENUM_DEF, TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, + TokenTypes.VARIABLE_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.ANNOTATION_FIELD_DEF, + TokenTypes.RECORD_DEF, TokenTypes.COMPACT_CTOR_DEF, }; + } + + @Override + public int[] getRequiredTokens() { + return CommonUtil.EMPTY_INT_ARRAY; + } + + @Override + public void visitToken(DetailAST ast) { + if (ast.getType() != TokenTypes.VARIABLE_DEF || ast.getParent().getType() == TokenTypes.OBJBLOCK) { + DetailAST node = ast.findFirstToken(TokenTypes.MODIFIERS); + node = (node != null) ? node : ast.findFirstToken(TokenTypes.ANNOTATIONS); + checkAnnotations(node, getExpectedAnnotationIndentation(node)); + } + } + + private int getExpectedAnnotationIndentation(DetailAST node) { + return node.getColumnNo(); + } + + private void checkAnnotations(DetailAST node, int correctIndentation) { + DetailAST annotation = node.getFirstChild(); + while (annotation != null && annotation.getType() == TokenTypes.ANNOTATION) { + checkAnnotation(correctIndentation, annotation); + annotation = annotation.getNextSibling(); + } + } + + private void checkAnnotation(int correctIndentation, DetailAST annotation) { + String annotationName = getAnnotationName(annotation); + if (!isCorrectLocation(annotation) && !isJSpecifyAnnotation(annotationName)) { + log(annotation, AnnotationLocationCheck.MSG_KEY_ANNOTATION_LOCATION_ALONE, annotationName); + } + else if (annotation.getColumnNo() != correctIndentation && !hasNodeBefore(annotation)) { + log(annotation, AnnotationLocationCheck.MSG_KEY_ANNOTATION_LOCATION, annotationName, + annotation.getColumnNo(), correctIndentation); + } + } + + private String getAnnotationName(DetailAST annotation) { + DetailAST identNode = annotation.findFirstToken(TokenTypes.IDENT); + if (identNode == null) { + identNode = annotation.findFirstToken(TokenTypes.DOT).findFirstToken(TokenTypes.IDENT); + } + return identNode.getText(); + } + + private boolean isCorrectLocation(DetailAST annotation) { + return !hasNodeBeside(annotation); + } + + private boolean hasNodeBeside(DetailAST annotation) { + return hasNodeBefore(annotation) || hasNodeAfter(annotation); + } + + private boolean hasNodeBefore(DetailAST annotation) { + int annotationLineNo = annotation.getLineNo(); + DetailAST previousNode = annotation.getPreviousSibling(); + return (previousNode != null) && (annotationLineNo == previousNode.getLineNo()); + } + + private boolean hasNodeAfter(DetailAST annotation) { + int annotationLineNo = annotation.getLineNo(); + DetailAST nextNode = annotation.getNextSibling(); + nextNode = (nextNode != null) ? nextNode : annotation.getParent().getNextSibling(); + return annotationLineNo == nextNode.getLineNo(); + } + + private boolean isJSpecifyAnnotation(String annotationName) { + return JSPECIFY_ANNOTATION_NAMES.contains(annotationName); + } + +} diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties index a27f9263..cdea619e 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/check/messages.properties @@ -1,3 +1,5 @@ +annotation.location=Annotation ''{0}'' have incorrect indentation level {1}, expected level should be {2}. +annotation.location.alone=Annotation ''{0}'' should be alone on line. catch.singleLetter=Single letter catch variable (use "ex" instead). catch.wideEye=''o_O'' catch variable (use "ex" instead). header.unexpected=Unexpected header. diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml index fa6f8a64..4da52558 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml @@ -24,10 +24,7 @@ - - - + diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/AnnotationOnNewLine.txt b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/AnnotationOnNewLine.txt new file mode 100644 index 00000000..69174e4c --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/check/AnnotationOnNewLine.txt @@ -0,0 +1 @@ ++0 errors \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/AnnotationOnNewLine.java b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/AnnotationOnNewLine.java new file mode 100644 index 00000000..8799aae3 --- /dev/null +++ b/spring-javaformat/spring-javaformat-checkstyle/src/test/resources/source/AnnotationOnNewLine.java @@ -0,0 +1,45 @@ +/* + * Copyright 2017-2025 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 org.jspecify.annotations.Nullable; + +/** + * This is a valid example. + * + * @author Phillip Webb + */ +public class AnnotationOnNewLine { + + @Override + public String toString() { + return ""; + } + + @Nullable String test1() { + return ""; + } + + @Override + @Nullable String test2() { + return ""; + } + + @Override + public @Nullable String test3() { + return ""; + } + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java b/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java index c01324c2..f2bebe0a 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/AbstractFormatterTests.java @@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import io.spring.javaformat.config.JavaBaseline; @@ -60,6 +61,7 @@ protected static Item[] items(String expectedOverride) { addItem(items, javaBaseline, source, expected, config); } } + items.sort(Comparator.comparing(Item::getName)); return items.toArray(new Item[0]); } @@ -139,6 +141,10 @@ private JavaFormatConfig loadConfig(JavaBaseline javaBaseline, File configFile) return JavaFormatConfig.of(javaBaseline, config.getIndentationStyle()); } + String getName() { + return this.source.getName(); + } + public File getSource() { return this.source; } diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-not-jspecify.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-not-jspecify.txt new file mode 100644 index 00000000..dbdb1f45 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-not-jspecify.txt @@ -0,0 +1,23 @@ +package example; + +import com.example.Nullable; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override + @Nullable + String myMethod(String param); + + @Override + public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, + @Nullable String @Nullable... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-wildcard-import.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-wildcard-import.txt new file mode 100644 index 00000000..053cbc13 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable-wildcard-import.txt @@ -0,0 +1,22 @@ +package example; + +import org.jspecify.annotations.*; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override + @Nullable String myMethod(String param); + + @Override + public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, + @Nullable String @Nullable ... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt index b077cb5d..8c2d80e6 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt @@ -16,6 +16,7 @@ public interface ExampleNullables { @Override public @Nullable String myPublicMethod(String param); - Object myArrayMethod(@Nullable String @Nullable [] array, @Nullable String @Nullable ... varargs); + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, + @Nullable String @Nullable ... varargs); } diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-not-jspecify.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-not-jspecify.txt new file mode 100644 index 00000000..011a2189 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-not-jspecify.txt @@ -0,0 +1,20 @@ +package example; + +import com.example.Nullable; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override @Nullable String myMethod(String param); + + @Override public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, @Nullable + String @Nullable ... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-wildcard-import.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-wildcard-import.txt new file mode 100644 index 00000000..11c65198 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable-wildcard-import.txt @@ -0,0 +1,20 @@ +package example; + +import org.jspecify.annotations.*; + +/** + * Nullable. + * + * @author Phillip Webb + * @since 1.0.0 + */ +public interface ExampleNullables { + + @Override @Nullable String myMethod(String param); + + @Override public @Nullable String myPublicMethod(String param); + + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, @Nullable + String @Nullable ... varargs); + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt index b2952241..286e78fc 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt @@ -14,7 +14,7 @@ public interface ExampleNullables { @Override public @Nullable String myPublicMethod(String param); - Object myArrayMethod(@Nullable String @Nullable [] array, @Nullable + Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, @Nullable String @Nullable ... varargs); } diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java index 7d017570..e99256c2 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java @@ -17,14 +17,20 @@ package io.spring.javaformat.formatter.jdk17.eclipse; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ASTNode; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ASTVisitor; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.Annotation; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.CompilationUnit; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.IExtendedModifier; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ImportDeclaration; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.MethodDeclaration; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.SingleVariableDeclaration; import io.spring.javaformat.eclipse.jdt.jdk17.core.formatter.CodeFormatter; @@ -33,9 +39,15 @@ public class JSpecifyPreparator implements Preparator { + private static final String PACKAGE_NAME = "org.jspecify.annotations"; + private static final Set ANNOTATION_NAMES = new HashSet<>( Arrays.asList("NonNull", "Nullable", "NullMarked", "NullUnmarked")); + private static final Set FULLY_QUALIFIED_ANNOTATION_NAMES = ANNOTATION_NAMES.stream() + .map((annotationName) -> PACKAGE_NAME + "." + annotationName) + .collect(Collectors.toSet()); + @Override public void apply(int kind, TokenManager tokenManager, ASTNode astRoot) { if ((kind & CodeFormatter.K_COMPILATION_UNIT) != 0) { @@ -48,10 +60,31 @@ private static class Vistor extends ASTVisitor { private final TokenManager tokenManager; + private final Map fullyQualified = new HashMap<>(); + Vistor(TokenManager tokenManager) { this.tokenManager = tokenManager; } + @Override + public boolean visit(CompilationUnit node) { + this.fullyQualified.clear(); + return super.visit(node); + } + + @Override + public boolean visit(ImportDeclaration node) { + String name = node.getName().toString(); + if (name.equals(PACKAGE_NAME) || name.startsWith(PACKAGE_NAME)) { + Set annotationNames = (node.isOnDemand()) ? ANNOTATION_NAMES + : Collections.singleton(name.substring(name.lastIndexOf(".") + 1)); + for (String annotationName : annotationNames) { + this.fullyQualified.put(annotationName, PACKAGE_NAME + "." + annotationName); + } + } + return super.visit(node); + } + @Override @SuppressWarnings("unchecked") public boolean visit(MethodDeclaration node) { @@ -86,7 +119,9 @@ private Annotation getLastAnnotation(List modifiers } private boolean isJSpecifyAnnotation(Annotation annotation) { - return (annotation != null) && ANNOTATION_NAMES.contains(annotation.getTypeName().toString()); + String fullyQualifiedName = (annotation != null) + ? this.fullyQualified.get(annotation.getTypeName().toString()) : null; + return (fullyQualifiedName != null) && FULLY_QUALIFIED_ANNOTATION_NAMES.contains(fullyQualifiedName); } } diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java index 620b462f..e1f0e121 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java @@ -17,14 +17,20 @@ package io.spring.javaformat.formatter.jdk8.eclipse; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ASTNode; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ASTVisitor; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.Annotation; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.CompilationUnit; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.IExtendedModifier; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ImportDeclaration; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.MethodDeclaration; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.SingleVariableDeclaration; import io.spring.javaformat.eclipse.jdt.jdk8.core.formatter.CodeFormatter; @@ -33,9 +39,15 @@ public class JSpecifyPreparator implements Preparator { + private static final String PACKAGE_NAME = "org.jspecify.annotations"; + private static final Set ANNOTATION_NAMES = new HashSet<>( Arrays.asList("NonNull", "Nullable", "NullMarked", "NullUnmarked")); + private static final Set FULLY_QUALIFIED_ANNOTATION_NAMES = ANNOTATION_NAMES.stream() + .map((annotationName) -> PACKAGE_NAME + "." + annotationName) + .collect(Collectors.toSet()); + @Override public void apply(int kind, TokenManager tokenManager, ASTNode astRoot) { if ((kind & CodeFormatter.K_COMPILATION_UNIT) != 0) { @@ -48,10 +60,31 @@ private static class Vistor extends ASTVisitor { private final TokenManager tokenManager; + private final Map fullyQualified = new HashMap<>(); + Vistor(TokenManager tokenManager) { this.tokenManager = tokenManager; } + @Override + public boolean visit(CompilationUnit node) { + this.fullyQualified.clear(); + return super.visit(node); + } + + @Override + public boolean visit(ImportDeclaration node) { + String name = node.getName().toString(); + if (name.equals(PACKAGE_NAME) || name.startsWith(PACKAGE_NAME)) { + Set annotationNames = (node.isOnDemand()) ? ANNOTATION_NAMES + : Collections.singleton(name.substring(name.lastIndexOf(".") + 1)); + for (String annotationName : annotationNames) { + this.fullyQualified.put(annotationName, PACKAGE_NAME + "." + annotationName); + } + } + return super.visit(node); + } + @Override @SuppressWarnings("unchecked") public boolean visit(MethodDeclaration node) { @@ -86,7 +119,9 @@ private Annotation getLastAnnotation(List modifiers } private boolean isJSpecifyAnnotation(Annotation annotation) { - return (annotation != null) && ANNOTATION_NAMES.contains(annotation.getTypeName().toString()); + String fullyQualifiedName = (annotation != null) + ? this.fullyQualified.get(annotation.getTypeName().toString()) : null; + return (fullyQualifiedName != null) && FULLY_QUALIFIED_ANNOTATION_NAMES.contains(fullyQualifiedName); } } From 43a13d291a2533e6754200e1b87d7e6c6286531f Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Tue, 20 May 2025 00:37:16 +0000 Subject: [PATCH 26/29] Next development version (v0.0.46-SNAPSHOT) --- README.adoc | 2 +- pom.xml | 2 +- samples/spring-javaformat-gradle-sample/build.gradle | 4 ++-- samples/spring-javaformat-maven-sample/pom.xml | 2 +- .../io.spring.javaformat.eclipse.feature/feature.xml | 4 ++-- .../io.spring.javaformat.eclipse.feature/pom.xml | 2 +- .../io.spring.javaformat.eclipse.site/category.xml | 2 +- .../io.spring.javaformat.eclipse.product | 2 +- .../io.spring.javaformat.eclipse.site/pom.xml | 2 +- .../io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse.tests/pom.xml | 2 +- .../io.spring.javaformat.eclipse/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse/pom.xml | 2 +- spring-javaformat-eclipse/pom.xml | 2 +- .../io.spring.javaformat.gradle.plugin/pom.xml | 2 +- spring-javaformat-gradle/pom.xml | 2 +- .../spring-javaformat-gradle-plugin/pom.xml | 2 +- spring-javaformat-intellij-idea/pom.xml | 2 +- .../spring-javaformat-intellij-idea-plugin/pom.xml | 2 +- .../spring-javaformat-intellij-idea-runtime/pom.xml | 2 +- spring-javaformat-maven/pom.xml | 2 +- .../spring-javaformat-maven-plugin/pom.xml | 2 +- spring-javaformat-vscode/pom.xml | 2 +- .../spring-javaformat-vscode-extension/package-lock.json | 4 ++-- .../spring-javaformat-vscode-extension/package.json | 2 +- .../spring-javaformat-vscode-extension/pom.xml | 2 +- spring-javaformat/pom.xml | 2 +- spring-javaformat/spring-javaformat-checkstyle/pom.xml | 2 +- spring-javaformat/spring-javaformat-config/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk17/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-rewriter/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-runtime/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shaded/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shader/pom.xml | 2 +- .../spring-javaformat-formatter-test-support/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter/pom.xml | 2 +- 42 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.adoc b/README.adoc index 6ebfec9a..2c00258a 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -:release-version: 0.0.44 +:release-version: 0.0.45 :checkstyle-version: 9.3 == Spring Java Format diff --git a/pom.xml b/pom.xml index ff0d2732..3374b863 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT pom Spring JavaFormat Build Spring JavaFormat diff --git a/samples/spring-javaformat-gradle-sample/build.gradle b/samples/spring-javaformat-gradle-sample/build.gradle index cebfcad0..cf53cc79 100644 --- a/samples/spring-javaformat-gradle-sample/build.gradle +++ b/samples/spring-javaformat-gradle-sample/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.45-SNAPSHOT") + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.46-SNAPSHOT") } } @@ -25,5 +25,5 @@ checkstyle { } dependencies { - checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.45-SNAPSHOT") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.46-SNAPSHOT") } diff --git a/samples/spring-javaformat-maven-sample/pom.xml b/samples/spring-javaformat-maven-sample/pom.xml index e7492a31..22ac6ca4 100644 --- a/samples/spring-javaformat-maven-sample/pom.xml +++ b/samples/spring-javaformat-maven-sample/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT UTF-8 - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml index bbd37c1f..566fc75f 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ @@ -22,7 +22,7 @@ id="io.spring.javaformat.eclipse" download-size="0" install-size="0" - version="0.0.45.qualifier" + version="0.0.46.qualifier" unpack="false"/> diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml index 80811b23..8781b88f 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT io.spring.javaformat.eclipse.feature eclipse-feature diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml index b1a0200a..a7901f2c 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml @@ -3,7 +3,7 @@ Maven Integration for Eclipse (maven-eclipse-plugin support) - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product index 0b2c41b6..542c8623 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product @@ -1,7 +1,7 @@ - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml index 6272fb89..73044003 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT io.spring.javaformat.eclipse.site eclipse-repository diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF index f9dc324d..6dc39cf8 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Tests Bundle-SymbolicName: io.spring.javaformat.eclipse.tests Automatic-Module-Name: io.spring.javaformat.eclipse.tests -Bundle-Version: 0.0.45.qualifier +Bundle-Version: 0.0.46.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., lib/assertj-core.jar, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml index 68810401..3e3b7156 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT io.spring.javaformat.eclipse.tests eclipse-test-plugin diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF index 30ff2e88..62909cb6 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Bundle-SymbolicName: io.spring.javaformat.eclipse;singleton:=true Automatic-Module-Name: io.spring.javaformat.eclipse -Bundle-Version: 0.0.45.qualifier +Bundle-Version: 0.0.46.qualifier Bundle-Activator: io.spring.javaformat.eclipse.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml index 9f05ae23..6c1fa6a7 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT io.spring.javaformat.eclipse eclipse-plugin diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml index 22815dd0..1a2639c5 100644 --- a/spring-javaformat-eclipse/pom.xml +++ b/spring-javaformat-eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-eclipse pom diff --git a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml index e9925fbb..93f26ee8 100644 --- a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml +++ b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT io.spring.javaformat io.spring.javaformat.gradle.plugin diff --git a/spring-javaformat-gradle/pom.xml b/spring-javaformat-gradle/pom.xml index 5ad6e456..39880551 100644 --- a/spring-javaformat-gradle/pom.xml +++ b/spring-javaformat-gradle/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-gradle pom diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml index 233242b6..0c7792a2 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-gradle-plugin pom diff --git a/spring-javaformat-intellij-idea/pom.xml b/spring-javaformat-intellij-idea/pom.xml index 2a7bdf51..42d82863 100644 --- a/spring-javaformat-intellij-idea/pom.xml +++ b/spring-javaformat-intellij-idea/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-intellij-idea pom diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml index 6c454f53..f5581b69 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-intellij-idea-plugin Spring JavaFormat IntelliJ IDEA Plugin diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml index e46a0764..bdbf48d4 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-intellij-idea-runtime pom diff --git a/spring-javaformat-maven/pom.xml b/spring-javaformat-maven/pom.xml index b014b693..02900b22 100644 --- a/spring-javaformat-maven/pom.xml +++ b/spring-javaformat-maven/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-maven pom diff --git a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml index 9ea0fc98..100d5a83 100644 --- a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml +++ b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-maven - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-maven-plugin maven-plugin diff --git a/spring-javaformat-vscode/pom.xml b/spring-javaformat-vscode/pom.xml index 5d2cc25d..ed69c065 100644 --- a/spring-javaformat-vscode/pom.xml +++ b/spring-javaformat-vscode/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-vscode pom diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index 8390499b..7a1dbc61 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-javaformat-vscode-extension", - "version": "0.0.45-SNAPSHOT", + "version": "0.0.46-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-javaformat-vscode-extension", - "version": "0.0.45-SNAPSHOT", + "version": "0.0.46-SNAPSHOT", "devDependencies": { "@types/glob": "^8.0.1", "@types/mocha": "^10.0.1", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index b6be66c5..0b7e7feb 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "spring-javaformat-vscode-extension", "description": "Spring JavaFormat Visual Studio Code Extension", "displayName": "Spring JavaFormat", - "version": "0.0.45-SNAPSHOT", + "version": "0.0.46-SNAPSHOT", "publisher": "io.spring.javaformat", "engines": { "vscode": "^1.75.0" diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml index 446a2c54..afa9b39a 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-vscode - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-vscode-extension Spring JavaFormat Visual Studio Code Extension diff --git a/spring-javaformat/pom.xml b/spring-javaformat/pom.xml index ff871443..c7815e7c 100644 --- a/spring-javaformat/pom.xml +++ b/spring-javaformat/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat pom diff --git a/spring-javaformat/spring-javaformat-checkstyle/pom.xml b/spring-javaformat/spring-javaformat-checkstyle/pom.xml index 5ab40720..709a2f6a 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/pom.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-checkstyle Spring JavaFormat CheckStyle diff --git a/spring-javaformat/spring-javaformat-config/pom.xml b/spring-javaformat/spring-javaformat-config/pom.xml index 54ddd0c9..897d4d9a 100644 --- a/spring-javaformat/spring-javaformat-config/pom.xml +++ b/spring-javaformat/spring-javaformat-config/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-config Spring JavaFormat Config diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF index 7f5780eb..b66f5efe 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse Runtime JDK17 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17 -Bundle-Version: 0.0.45.qualifier +Bundle-Version: 0.0.46.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml index 1ba8c47a..32c72950 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-jdk17 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF index 2c93d052..a6aef027 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse JDK8 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk8 -Bundle-Version: 0.0.45.qualifier +Bundle-Version: 0.0.46.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml index 869a7fd8..3d3c8a4c 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-jdk8 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml index b36d3e7e..4b0ce32f 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk17 Spring JavaFormat Eclipse JDT JDK-17 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml index 2a6af271..0f557001 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk8 Spring JavaFormat Eclipse JDT JDK-8 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml index 09a3ad1b..eb7b4352 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-rewriter Spring JavaFormat Eclipse Rewriter diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml index eb28f8e8..a9bd4c45 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-eclipse-runtime Spring JavaFormat Eclipse Runtime diff --git a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml index 96af85e1..13723df1 100644 --- a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-shaded Spring JavaFormat Formatter Shaded diff --git a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml index caae72af..2eea794d 100644 --- a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-shader Spring JavaFormat Formatter Shader diff --git a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml index ef0f059b..97190e18 100644 --- a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-test-support Spring JavaFormat Formatter Test Support diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index b9269ce4..e43f5e4c 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter-tests Spring JavaFormat Formatter Tests diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml index 1537e2fd..0f2ce215 100644 --- a/spring-javaformat/spring-javaformat-formatter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.45-SNAPSHOT + 0.0.46-SNAPSHOT spring-javaformat-formatter Spring JavaFormat Formatter From cbf53be4fedc606f5d1af1435ef2aab57dcafe0d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 27 May 2025 08:05:59 -0700 Subject: [PATCH 27/29] Further Refine JSpecify support Support `@Nullable` annotations in method bodies. Fixes gh-442 --- .../src/test/resources/expected/nullable.txt | 7 +++++++ .../src/test/resources/source/nullable.txt | 7 +++++++ .../jdk17/eclipse/JSpecifyPreparator.java | 21 ++++++++++++++----- .../jdk8/eclipse/JSpecifyPreparator.java | 21 ++++++++++++++----- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt index 8c2d80e6..b3e8f925 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/nullable.txt @@ -19,4 +19,11 @@ public interface ExampleNullables { Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, @Nullable String @Nullable ... varargs); + default Object inBody() { + @Nullable Object[] args = new Object[length]; + @Nullable List<@Nullable Object> list = new Object[length]; + Object @Nullable [] moreArgs = new Object[length]; + return args; + } + } diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt index 286e78fc..acbefead 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/nullable.txt @@ -17,4 +17,11 @@ public interface ExampleNullables { Object myArrayMethod(@Nullable String string, @Nullable String @Nullable [] array, @Nullable String @Nullable ... varargs); + default Object inBody() { + @Nullable Object[] args = new Object[length]; + @Nullable List<@Nullable Object> list = new Object[length]; + Object @Nullable [] moreArgs = new Object[length]; + return args; + } + } diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java index e99256c2..645bf75d 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk17/eclipse/JSpecifyPreparator.java @@ -33,6 +33,7 @@ import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.ImportDeclaration; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.MethodDeclaration; import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.SingleVariableDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk17.core.dom.VariableDeclarationStatement; import io.spring.javaformat.eclipse.jdt.jdk17.core.formatter.CodeFormatter; import io.spring.javaformat.eclipse.jdt.jdk17.internal.formatter.Preparator; import io.spring.javaformat.eclipse.jdt.jdk17.internal.formatter.TokenManager; @@ -86,12 +87,14 @@ public boolean visit(ImportDeclaration node) { } @Override - @SuppressWarnings("unchecked") public boolean visit(MethodDeclaration node) { - Annotation lastAnnotation = getLastAnnotation((List) node.modifiers()); - if (isJSpecifyAnnotation(lastAnnotation)) { - this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); - } + clearLineBreaksIfHasJSpecifyAnnotation(node.modifiers()); + return true; + } + + @Override + public boolean visit(VariableDeclarationStatement node) { + clearLineBreaksIfHasJSpecifyAnnotation(node.modifiers()); return true; } @@ -107,6 +110,14 @@ public void endVisit(SingleVariableDeclaration node) { } } + @SuppressWarnings("unchecked") + private void clearLineBreaksIfHasJSpecifyAnnotation(List modifiers) { + Annotation lastAnnotation = getLastAnnotation((List) modifiers); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); + } + } + private Annotation getLastAnnotation(List modifiers) { Annotation annotation = null; for (IExtendedModifier modifier : modifiers) { diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java index e1f0e121..4bc1aa0e 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/jdk8/eclipse/JSpecifyPreparator.java @@ -33,6 +33,7 @@ import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.ImportDeclaration; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.MethodDeclaration; import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.SingleVariableDeclaration; +import io.spring.javaformat.eclipse.jdt.jdk8.core.dom.VariableDeclarationStatement; import io.spring.javaformat.eclipse.jdt.jdk8.core.formatter.CodeFormatter; import io.spring.javaformat.eclipse.jdt.jdk8.internal.formatter.Preparator; import io.spring.javaformat.eclipse.jdt.jdk8.internal.formatter.TokenManager; @@ -86,12 +87,14 @@ public boolean visit(ImportDeclaration node) { } @Override - @SuppressWarnings("unchecked") public boolean visit(MethodDeclaration node) { - Annotation lastAnnotation = getLastAnnotation((List) node.modifiers()); - if (isJSpecifyAnnotation(lastAnnotation)) { - this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); - } + clearLineBreaksIfHasJSpecifyAnnotation(node.modifiers()); + return true; + } + + @Override + public boolean visit(VariableDeclarationStatement node) { + clearLineBreaksIfHasJSpecifyAnnotation(node.modifiers()); return true; } @@ -107,6 +110,14 @@ public void endVisit(SingleVariableDeclaration node) { } } + @SuppressWarnings("unchecked") + private void clearLineBreaksIfHasJSpecifyAnnotation(List modifiers) { + Annotation lastAnnotation = getLastAnnotation((List) modifiers); + if (isJSpecifyAnnotation(lastAnnotation)) { + this.tokenManager.lastTokenIn(lastAnnotation, -1).clearLineBreaksAfter(); + } + } + private Annotation getLastAnnotation(List modifiers) { Annotation annotation = null; for (IExtendedModifier modifier : modifiers) { From 5f3470b3344682d78da10c57ca16b3805063bcb3 Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Mon, 2 Jun 2025 18:24:21 +0000 Subject: [PATCH 28/29] Next development version (v0.0.47-SNAPSHOT) --- README.adoc | 2 +- pom.xml | 2 +- samples/spring-javaformat-gradle-sample/build.gradle | 4 ++-- samples/spring-javaformat-maven-sample/pom.xml | 2 +- .../io.spring.javaformat.eclipse.feature/feature.xml | 4 ++-- .../io.spring.javaformat.eclipse.feature/pom.xml | 2 +- .../io.spring.javaformat.eclipse.site/category.xml | 2 +- .../io.spring.javaformat.eclipse.product | 2 +- .../io.spring.javaformat.eclipse.site/pom.xml | 2 +- .../io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse.tests/pom.xml | 2 +- .../io.spring.javaformat.eclipse/META-INF/MANIFEST.MF | 2 +- .../io.spring.javaformat.eclipse/pom.xml | 2 +- spring-javaformat-eclipse/pom.xml | 2 +- .../io.spring.javaformat.gradle.plugin/pom.xml | 2 +- spring-javaformat-gradle/pom.xml | 2 +- .../spring-javaformat-gradle-plugin/pom.xml | 2 +- spring-javaformat-intellij-idea/pom.xml | 2 +- .../spring-javaformat-intellij-idea-plugin/pom.xml | 2 +- .../spring-javaformat-intellij-idea-runtime/pom.xml | 2 +- spring-javaformat-maven/pom.xml | 2 +- .../spring-javaformat-maven-plugin/pom.xml | 2 +- spring-javaformat-vscode/pom.xml | 2 +- .../spring-javaformat-vscode-extension/package-lock.json | 4 ++-- .../spring-javaformat-vscode-extension/package.json | 2 +- .../spring-javaformat-vscode-extension/pom.xml | 2 +- spring-javaformat/pom.xml | 2 +- spring-javaformat/spring-javaformat-checkstyle/pom.xml | 2 +- spring-javaformat/spring-javaformat-config/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk17/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../spring-javaformat-formatter-eclipse-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-rewriter/pom.xml | 2 +- .../spring-javaformat-formatter-eclipse-runtime/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shaded/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-shader/pom.xml | 2 +- .../spring-javaformat-formatter-test-support/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter-tests/pom.xml | 2 +- spring-javaformat/spring-javaformat-formatter/pom.xml | 2 +- 42 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.adoc b/README.adoc index 2c00258a..bf0a6e1c 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,4 @@ -:release-version: 0.0.45 +:release-version: 0.0.46 :checkstyle-version: 9.3 == Spring Java Format diff --git a/pom.xml b/pom.xml index 3374b863..99e69cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT pom Spring JavaFormat Build Spring JavaFormat diff --git a/samples/spring-javaformat-gradle-sample/build.gradle b/samples/spring-javaformat-gradle-sample/build.gradle index cf53cc79..9e1f5c9a 100644 --- a/samples/spring-javaformat-gradle-sample/build.gradle +++ b/samples/spring-javaformat-gradle-sample/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.46-SNAPSHOT") + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.47-SNAPSHOT") } } @@ -25,5 +25,5 @@ checkstyle { } dependencies { - checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.46-SNAPSHOT") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.47-SNAPSHOT") } diff --git a/samples/spring-javaformat-maven-sample/pom.xml b/samples/spring-javaformat-maven-sample/pom.xml index 22ac6ca4..9eb60913 100644 --- a/samples/spring-javaformat-maven-sample/pom.xml +++ b/samples/spring-javaformat-maven-sample/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT UTF-8 - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml index 566fc75f..aebcd72d 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ @@ -22,7 +22,7 @@ id="io.spring.javaformat.eclipse" download-size="0" install-size="0" - version="0.0.46.qualifier" + version="0.0.47.qualifier" unpack="false"/> diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml index 8781b88f..7b4a2a51 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.feature/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT io.spring.javaformat.eclipse.feature eclipse-feature diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml index a7901f2c..cc2c89a7 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/category.xml @@ -3,7 +3,7 @@ Maven Integration for Eclipse (maven-eclipse-plugin support) - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product index 542c8623..20f32d4b 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/io.spring.javaformat.eclipse.product @@ -1,7 +1,7 @@ - + diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml index 73044003..982bb285 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.site/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT io.spring.javaformat.eclipse.site eclipse-repository diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF index 6dc39cf8..d9e188f3 100755 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Tests Bundle-SymbolicName: io.spring.javaformat.eclipse.tests Automatic-Module-Name: io.spring.javaformat.eclipse.tests -Bundle-Version: 0.0.46.qualifier +Bundle-Version: 0.0.47.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., lib/assertj-core.jar, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml index 3e3b7156..99fa280e 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT io.spring.javaformat.eclipse.tests eclipse-test-plugin diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF index 62909cb6..12cac3a6 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spring Java Format Plugin Bundle-SymbolicName: io.spring.javaformat.eclipse;singleton:=true Automatic-Module-Name: io.spring.javaformat.eclipse -Bundle-Version: 0.0.46.qualifier +Bundle-Version: 0.0.47.qualifier Bundle-Activator: io.spring.javaformat.eclipse.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml index 6c1fa6a7..72042fa1 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-eclipse - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT io.spring.javaformat.eclipse eclipse-plugin diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml index 1a2639c5..3590c925 100644 --- a/spring-javaformat-eclipse/pom.xml +++ b/spring-javaformat-eclipse/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-eclipse pom diff --git a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml index 93f26ee8..be5f1d3e 100644 --- a/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml +++ b/spring-javaformat-gradle/io.spring.javaformat.gradle.plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT io.spring.javaformat io.spring.javaformat.gradle.plugin diff --git a/spring-javaformat-gradle/pom.xml b/spring-javaformat-gradle/pom.xml index 39880551..c13954a9 100644 --- a/spring-javaformat-gradle/pom.xml +++ b/spring-javaformat-gradle/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-gradle pom diff --git a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml index 0c7792a2..5a6de1f3 100644 --- a/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml +++ b/spring-javaformat-gradle/spring-javaformat-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-gradle - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-gradle-plugin pom diff --git a/spring-javaformat-intellij-idea/pom.xml b/spring-javaformat-intellij-idea/pom.xml index 42d82863..4d8c434c 100644 --- a/spring-javaformat-intellij-idea/pom.xml +++ b/spring-javaformat-intellij-idea/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-intellij-idea pom diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml index f5581b69..611a99fe 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-intellij-idea-plugin Spring JavaFormat IntelliJ IDEA Plugin diff --git a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml index bdbf48d4..dc437a12 100644 --- a/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml +++ b/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-intellij-idea - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-intellij-idea-runtime pom diff --git a/spring-javaformat-maven/pom.xml b/spring-javaformat-maven/pom.xml index 02900b22..a14e54eb 100644 --- a/spring-javaformat-maven/pom.xml +++ b/spring-javaformat-maven/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-maven pom diff --git a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml index 100d5a83..88294ec8 100644 --- a/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml +++ b/spring-javaformat-maven/spring-javaformat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-maven - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-maven-plugin maven-plugin diff --git a/spring-javaformat-vscode/pom.xml b/spring-javaformat-vscode/pom.xml index ed69c065..c217c403 100644 --- a/spring-javaformat-vscode/pom.xml +++ b/spring-javaformat-vscode/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-vscode pom diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json index 7a1dbc61..5ea30c21 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-javaformat-vscode-extension", - "version": "0.0.46-SNAPSHOT", + "version": "0.0.47-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-javaformat-vscode-extension", - "version": "0.0.46-SNAPSHOT", + "version": "0.0.47-SNAPSHOT", "devDependencies": { "@types/glob": "^8.0.1", "@types/mocha": "^10.0.1", diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json index 0b7e7feb..63e3b775 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "spring-javaformat-vscode-extension", "description": "Spring JavaFormat Visual Studio Code Extension", "displayName": "Spring JavaFormat", - "version": "0.0.46-SNAPSHOT", + "version": "0.0.47-SNAPSHOT", "publisher": "io.spring.javaformat", "engines": { "vscode": "^1.75.0" diff --git a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml index afa9b39a..3c439b79 100644 --- a/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml +++ b/spring-javaformat-vscode/spring-javaformat-vscode-extension/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat-vscode - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-vscode-extension Spring JavaFormat Visual Studio Code Extension diff --git a/spring-javaformat/pom.xml b/spring-javaformat/pom.xml index c7815e7c..7c086cc7 100644 --- a/spring-javaformat/pom.xml +++ b/spring-javaformat/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat-build - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat pom diff --git a/spring-javaformat/spring-javaformat-checkstyle/pom.xml b/spring-javaformat/spring-javaformat-checkstyle/pom.xml index 709a2f6a..7d74f0cc 100644 --- a/spring-javaformat/spring-javaformat-checkstyle/pom.xml +++ b/spring-javaformat/spring-javaformat-checkstyle/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-checkstyle Spring JavaFormat CheckStyle diff --git a/spring-javaformat/spring-javaformat-config/pom.xml b/spring-javaformat/spring-javaformat-config/pom.xml index 897d4d9a..72fe7b7b 100644 --- a/spring-javaformat/spring-javaformat-config/pom.xml +++ b/spring-javaformat/spring-javaformat-config/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-config Spring JavaFormat Config diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF index b66f5efe..f3b70674 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse Runtime JDK17 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17 -Bundle-Version: 0.0.46.qualifier +Bundle-Version: 0.0.47.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml index 32c72950..cd3752e1 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-jdk17 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF index a6aef027..652b5065 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Spring Formatter Eclipse JDK8 Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk8 -Bundle-Version: 0.0.46.qualifier +Bundle-Version: 0.0.47.qualifier Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)", org.eclipse.jface;bundle-version="[1.0.0,10.0.0)", org.eclipse.jdt.core.source;bundle-version="[1.0.0,10.0.0)";resolution:=optional, diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml index 3d3c8a4c..f22c974e 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-jdk8 eclipse-plugin diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml index 4b0ce32f..8621592f 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk17 Spring JavaFormat Eclipse JDT JDK-17 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml index 0f557001..0689734b 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk8/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-jdt-jdk8 Spring JavaFormat Eclipse JDT JDK-8 diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml index eb7b4352..306b6166 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-rewriter/pom.xml @@ -5,7 +5,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-rewriter Spring JavaFormat Eclipse Rewriter diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml index a9bd4c45..73007642 100644 --- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-eclipse-runtime Spring JavaFormat Eclipse Runtime diff --git a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml index 13723df1..5476a0c9 100644 --- a/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shaded/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-shaded Spring JavaFormat Formatter Shaded diff --git a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml index 2eea794d..0648a5b4 100644 --- a/spring-javaformat/spring-javaformat-formatter-shader/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-shader/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-shader Spring JavaFormat Formatter Shader diff --git a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml index 97190e18..e34149fe 100644 --- a/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-test-support/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-test-support Spring JavaFormat Formatter Test Support diff --git a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml index e43f5e4c..ce9bf2a2 100644 --- a/spring-javaformat/spring-javaformat-formatter-tests/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter-tests/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter-tests Spring JavaFormat Formatter Tests diff --git a/spring-javaformat/spring-javaformat-formatter/pom.xml b/spring-javaformat/spring-javaformat-formatter/pom.xml index 0f2ce215..24b89552 100644 --- a/spring-javaformat/spring-javaformat-formatter/pom.xml +++ b/spring-javaformat/spring-javaformat-formatter/pom.xml @@ -6,7 +6,7 @@ io.spring.javaformat spring-javaformat - 0.0.46-SNAPSHOT + 0.0.47-SNAPSHOT spring-javaformat-formatter Spring JavaFormat Formatter From 7308be977d601574313cd3c1145f49164ce34667 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 2 Jun 2025 11:52:03 -0700 Subject: [PATCH 29/29] Fix release workflow to use correct build number --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e5d4746..c80a4091 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,7 @@ jobs: run: git push origin HEAD --tags outputs: release-version: ${{ steps.deduce-versions.outputs.release-version }} + release-build-number: ${{ github.run_number }} promote: name: Promote needs: stage @@ -55,4 +56,4 @@ jobs: with: environment: ${{ inputs.environment }} version: ${{needs.stage.outputs.release-version}} - build-number: ${{ github.run_number }} + build-number: ${{ needs.stage.outputs.release-build-number }}