Skip to content

Commit 7b2aa68

Browse files
authored
Merge pull request #2817 from hazendaz/rewrite
Add private constructors per open rewrite / fix two tests that were invalid
2 parents eaa6983 + 2ed8f7a commit 7b2aa68

File tree

19 files changed

+74
-15
lines changed

19 files changed

+74
-15
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/io/ResourcesTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,4 @@ void shouldGetReaderWithClassLoader() throws IOException {
170170

171171
}
172172

173-
@Test
174-
void stupidJustForCoverage() {
175-
assertNotNull(new Resources());
176-
}
177173
}

src/test/java/org/apache/ibatis/reflection/ArrayUtilTest.java

Lines changed: 2 additions & 2 deletions
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.
@@ -21,7 +21,7 @@
2121

2222
import org.junit.jupiter.api.Test;
2323

24-
class ArrayUtilTest extends ArrayUtil {
24+
class ArrayUtilTest {
2525

2626
@Test
2727
void testHashCode() {

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
}

0 commit comments

Comments
 (0)