Skip to content

Commit 187cca2

Browse files
committed
[ci] Add private constructors to classes that cannot be instantiated (all static)
1 parent 630f017 commit 187cca2

File tree

17 files changed

+72
-9
lines changed

17 files changed

+72
-9
lines changed

src/main/java/org/apache/ibatis/io/Resources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Resources {
3939
*/
4040
private static Charset charset;
4141

42-
Resources() {
42+
private Resources() {
4343
}
4444

4545
/**

src/main/java/org/apache/ibatis/io/VFS.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ static VFS createVFS() {
7676

7777
return vfs;
7878
}
79+
80+
private VFSHolder() {
81+
}
7982
}
8083

8184
/**

src/main/java/org/apache/ibatis/reflection/ArrayUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@ public static String toString(Object obj) {
152152
}
153153
}
154154

155+
private ArrayUtil() {
156+
}
157+
155158
}

src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ static class MySqlProvider {
339339
public static String provideSql() {
340340
return "SELECT 1";
341341
}
342+
343+
private MySqlProvider() {
344+
}
342345
}
343346

344347
@Test

src/test/java/org/apache/ibatis/databases/blog/StoredProcedures.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,7 @@ public static void selectAuthorViaOutParams(int id, String[] username, String[]
5656
bio[0] = rs.getString("bio");
5757
}
5858
}
59+
60+
private StoredProcedures() {
61+
}
5962
}

src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,4 +682,7 @@ static MappedStatement prepareInsertAuthorMappedStatementWithBeforeAutoKey(final
682682
}).build()).cache(authorCache).keyGenerator(new SelectKeyGenerator(kms, true)).keyProperty("id").build();
683683
}
684684

685+
private ExecutorTestHelper() {
686+
}
687+
685688
}

src/test/java/org/apache/ibatis/submitted/dirty_select/Mapper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,5 +48,8 @@ static class MyProvider {
4848
public static String getSql() {
4949
return "insert into users (name) values (#{name}) returning id, name";
5050
}
51+
52+
private MyProvider() {
53+
}
5154
}
5255
}

src/test/java/org/apache/ibatis/submitted/dynsql/CustomUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ public class CustomUtil {
1919
public static String esc(final String s) {
2020
return s.replace("'", "''");
2121
}
22+
23+
private CustomUtil() {
24+
}
2225
}

src/test/java/org/apache/ibatis/submitted/global_variables_defaults/SupportClasses.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -71,6 +71,9 @@ static SupportClasses.CustomCache unwrap(Cache cache) {
7171
field.setAccessible(false);
7272
}
7373
}
74+
75+
private Utils() {
76+
}
7477
}
7578

7679
}

src/test/java/org/apache/ibatis/submitted/ognlstatic/StaticClass.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,4 +18,7 @@
1818
public class StaticClass {
1919

2020
public static String value = "User1";
21+
22+
private StaticClass() {
23+
}
2124
}

0 commit comments

Comments
 (0)