Skip to content

Commit cd0448b

Browse files
committed
Code linting and formatting
Use lombok, JDK 17 syntax, improve formatting, ...
1 parent 77ed61f commit cd0448b

File tree

95 files changed

+1188
-1360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1188
-1360
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ Please find here some of the main coding guidelines:
9595
* Left braces are located at the end of the line.
9696
* Braces are mandatory around conditional and loops blocks.
9797
* Don't write more than one statement by line.
98+
* Use Lombok annotations for logging (with `@Slf4j`), and for getters and setters, when applicable.
99+
* For constructors and methods with more than 2 parameters, write them one below the other, especially if the method
100+
throws an exception (avoid having `throws` clause isolated on a separate line)
98101

99102
### Javadoc
100103

pom.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@
120120
<java.driver.version>4.19.1</java.driver.version>
121121
<jackson.version>3.0.2</jackson.version>
122122
<jakarta.version>3.0.0</jakarta.version>
123+
<lombok.version>1.18.42</lombok.version>
123124
<opencsv.version>5.12.0</opencsv.version>
124125
<semver4j.version>6.0.0</semver4j.version>
125126
<!-- Versions for test dependencies -->
126127
<approvaltests.version>25.7.0</approvaltests.version>
127128
<dotenv.version>3.2.0</dotenv.version>
128129
<hamcrest.version>3.0</hamcrest.version>
129130
<junit.version>6.0.1</junit.version>
130-
<lombok.version>1.18.42</lombok.version>
131131
<mockito.version>5.20.0</mockito.version>
132132
<slf4j.version>2.0.17</slf4j.version>
133133
<testcontainers.version>2.0.2</testcontainers.version>
@@ -219,6 +219,14 @@
219219
<version>${jakarta.version}</version>
220220
</dependency>
221221

222+
<!-- Lombok annotations -->
223+
<dependency>
224+
<groupId>org.projectlombok</groupId>
225+
<artifactId>lombok</artifactId>
226+
<version>${lombok.version}</version>
227+
<scope>optional</scope>
228+
</dependency>
229+
222230
<!-- AWS Auth provider support -->
223231
<dependency>
224232
<groupId>software.aws.mcs</groupId>
@@ -343,13 +351,6 @@
343351
<version>${approvaltests.version}</version>
344352
<scope>test</scope>
345353
</dependency>
346-
<!-- Lombok (used only for some tests) -->
347-
<dependency>
348-
<groupId>org.projectlombok</groupId>
349-
<artifactId>lombok</artifactId>
350-
<version>${lombok.version}</version>
351-
<scope>test</scope>
352-
</dependency>
353354
<!-- Dotenv for tests only running locally (integration with DBaaS) -->
354355
<dependency>
355356
<groupId>io.github.cdimascio</groupId>

src/main/java/com/ing/data/cassandra/jdbc/AbstractConnection.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ public CallableStatement prepareCall(final String cql) throws SQLException {
6767
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
6868
}
6969

70-
public CallableStatement prepareCall(final String cql, final int resultSetType, final int resultSetConcurrency)
71-
throws SQLException {
70+
public CallableStatement prepareCall(final String cql,
71+
final int resultSetType,
72+
final int resultSetConcurrency) throws SQLException {
7273
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
7374
}
7475

75-
public CallableStatement prepareCall(final String cql, final int resultSetType, final int resultSetConcurrency,
76+
public CallableStatement prepareCall(final String cql,
77+
final int resultSetType,
78+
final int resultSetConcurrency,
7679
final int resultSetHoldability) throws SQLException {
7780
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
7881
}

src/main/java/com/ing/data/cassandra/jdbc/AbstractResultSet.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
import java.sql.Wrapper;
3939
import java.util.Map;
4040

41+
import static com.ing.data.cassandra.jdbc.types.DataTypeEnum.cqlName;
4142
import static com.ing.data.cassandra.jdbc.utils.ErrorConstants.NOT_SUPPORTED;
4243
import static com.ing.data.cassandra.jdbc.utils.ErrorConstants.NO_INTERFACE;
44+
import static org.apache.commons.lang3.StringUtils.substringBefore;
4345

4446
/**
4547
* Provides a default implementation (returning a {@link SQLFeatureNotSupportedException}) to hold the unimplemented
@@ -58,7 +60,7 @@ abstract class AbstractResultSet implements Wrapper {
5860
* @throws SQLException when the CQL type cannot be determined for the given column.
5961
*/
6062
boolean isCqlType(final int columnIndex, @Nonnull final DataTypeEnum type) throws SQLException {
61-
final String columnType = StringUtils.substringBefore(DataTypeEnum.cqlName(getCqlDataType(columnIndex)), "<");
63+
final String columnType = substringBefore(cqlName(getCqlDataType(columnIndex)), "<");
6264
return type.cqlType.equalsIgnoreCase(columnType);
6365
}
6466

@@ -71,7 +73,7 @@ boolean isCqlType(final int columnIndex, @Nonnull final DataTypeEnum type) throw
7173
* @throws SQLException when the CQL type cannot be determined for the given column.
7274
*/
7375
boolean isCqlType(final String columnLabel, @Nonnull final DataTypeEnum type) throws SQLException {
74-
final String columnType = StringUtils.substringBefore(DataTypeEnum.cqlName(getCqlDataType(columnLabel)), "<");
76+
final String columnType = substringBefore(cqlName(getCqlDataType(columnLabel)), "<");
7577
return type.cqlType.equalsIgnoreCase(columnType);
7678
}
7779

0 commit comments

Comments
 (0)