Skip to content

Commit 3076583

Browse files
committed
Add a separate import group for jakarta imports
Closes gh-289
1 parent 8e6be0f commit 3076583

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ formatter_settings_version=13
6464
org.eclipse.jdt.ui.exception.name=e
6565
org.eclipse.jdt.ui.gettersetter.use.is=true
6666
org.eclipse.jdt.ui.ignorelowercasenames=true
67-
org.eclipse.jdt.ui.importorder=java;javax;;org.springframework;\#;
67+
org.eclipse.jdt.ui.importorder=java;javax;jakarta;;org.springframework;\#;
6868
org.eclipse.jdt.ui.javadoc=true
6969
org.eclipse.jdt.ui.keywordthis=false
7070
org.eclipse.jdt.ui.ondemandthreshold=9999

spring-javaformat/spring-javaformat-checkstyle/src/main/java/io/spring/javaformat/checkstyle/check/SpringImportOrderCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public SpringImportOrderCheck() {
3939
}
4040

4141
public void setProjectRootPackage(String projectRootPackage) {
42-
setGroups("java", "/^javax?\\./", "*", projectRootPackage);
42+
setGroups("java", "/^javax?\\./", "/^jakarta?\\./", "*", projectRootPackage);
4343
}
4444

4545
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
+0 errors
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2017-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example;
18+
19+
import java.util.Objects;
20+
21+
import javax.annotation.Nonnull;
22+
23+
import jakarta.servlet.Servlet;
24+
25+
/**
26+
* Custom pacakge with valid imports.
27+
*
28+
* @author Phillip Webb
29+
*/
30+
public final class ImportOrderValid {
31+
32+
private ImportOrderValid() {
33+
}
34+
35+
@Nonnull
36+
public static void main(String[] args) {
37+
Objects.nonNull(null);
38+
Servlet s = null;
39+
}
40+
41+
}

0 commit comments

Comments
 (0)