Skip to content

Commit fa63aac

Browse files
authored
build(java)!: update to Java 25 (#51)
1 parent 9feb33e commit fa63aac

12 files changed

Lines changed: 36 additions & 22 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/setup-java@v5
1818
with:
1919
distribution: 'temurin'
20-
java-version: '23'
20+
java-version: '25'
2121

2222
- name: Build pull request
2323
run: mvn clean package

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This example will generate the `eoy-balance.csv` file, showing the balance of yo
4242
mvn -pl examples exec:java -Dexec.mainClass=dev.andstuff.kraken.example.EoyBalanceExample -Dexec.args="2025-01-31T00:00:00Z"
4343
```
4444

45-
## Libary usage
45+
## Library usage
4646

4747
### Public endpoints
4848

@@ -58,7 +58,7 @@ Map<String, AssetPair> pairs = api.assetPairs(List.of("ETH/BTC", "ETH/USD"));
5858
// {ETH/BTC=AssetPair[alternateName=ETHXBT, webSocketName=ETH/XBT, …
5959
```
6060

61-
If the endpoint has not yet been implemented (feel free to submit a PR!), the generic `query` method can be used, which will return a `JsonNode` of the [Jackson][2] deserialization libary:
61+
If the endpoint has not yet been implemented (feel free to submit a PR!), the generic `query` method can be used, which will return a `JsonNode` of the [Jackson][2] deserialization library:
6262

6363
```java
6464
JsonNode ticker = api.query(KrakenAPI.Public.TICKER, Map.of("pair", "XBTEUR"));

RELEASE.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
This document explains how a kraken-api-java release is created and describes what are the tools used and how they interact with each other.
44

5-
When a release is created, the visible "output" is an updated [CHANGLOG.md](https://github.com/nyg/kraken-api-java/blob/master/CHANGELOG.md) file, a [GitHub release](https://github.com/nyg/kraken-api-java/releases) with a changelog, and the [release artifact](https://repo1.maven.org/maven2/dev/andstuff/kraken/kraken-api/) available in the Maven Central repository.
5+
When a release is created, the visible "output" is an updated [CHANGELOG.md](https://github.com/nyg/kraken-api-java/blob/master/CHANGELOG.md)
6+
file, a [GitHub release](https://github.com/nyg/kraken-api-java/releases) with a changelog, and the [release artifact](https://repo1.maven.org/maven2/dev/andstuff/kraken/kraken-api/) available in the Maven Central repository.
67

78
## Overview
89

@@ -19,7 +20,7 @@ Also note that we do not use GitHub's own Maven repository, a.k.a. [GitHub Packa
1920

2021
## Detailed steps
2122

22-
The Maven release plugin helps automatizing certain tasks when making releases for Maven-based projects. Releasing requires invoking two of the plugin's goals: `prepare` and `perform`.
23+
The Maven release plugin helps to automatize certain tasks when making releases for Maven-based projects. Releasing requires invoking two of the plugin's goals: `prepare` and `perform`.
2324

2425
In short, the `prepare` goal updates version numbers in the POMs and creates a tag in the SCM (e.g. Git). The `perform` goal checks out the created tag, builds the project artifacts and publishes them on a remote Maven repository.
2526

@@ -47,7 +48,7 @@ The detailed list of steps executed by the prepare goal are defined [here](https
4748

4849
6. Create and push a commit with the changes made above. The message of the commit can be customized with the `scmDevelopmentCommitComment`.
4950

50-
The prepare goal also creates a `release.properties` file that is used by the `perform` goal in order to know which tag to checkout and build.
51+
The prepare goal also creates a `release.properties` file that is used by the `perform` goal in order to know which tag to check out and build.
5152

5253
Finally, when wanting to make a release, the command line looks like this:
5354

examples/src/main/java/dev/andstuff/kraken/example/EoyBalanceExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class EoyBalanceExample {
2727

2828
private final KrakenAPI api;
2929

30-
public static void main(String[] args) {
30+
static void main(String[] args) {
3131
KrakenCredentials credentials = readFromFile("/api-keys.properties");
3232
Instant dateTo = Instant.parse(args.length > 1 ? args[1] : "2024-01-01T00:00:00Z");
3333
new EoyBalanceExample(new KrakenAPI(credentials))

examples/src/main/java/dev/andstuff/kraken/example/SimpleExamples.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@Slf4j
2020
public class SimpleExamples {
2121

22-
public static void main(String[] args) {
22+
static void main() {
2323

2424
/* Public endpoint examples */
2525

examples/src/main/java/dev/andstuff/kraken/example/StakingRewardsSummaryExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class StakingRewardsSummaryExample {
3030

3131
private final KrakenAPI api;
3232

33-
public static void main(String[] args) {
33+
static void main() {
3434
KrakenCredentials credentials = readFromFile("/api-keys.properties");
3535
new StakingRewardsSummaryExample(new KrakenAPI(credentials))
3636
.generate("rewards.csv", "rewards-summary.csv");

examples/src/main/java/dev/andstuff/kraken/example/helper/CredentialsHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static KrakenCredentials readFromFile(String path) {
1919
return new KrakenCredentials(properties.getProperty("key"), properties.getProperty("secret"));
2020
}
2121
catch (IOException e) {
22-
throw new IllegalStateException(String.format("Could not read properties from file: %s", path));
22+
throw new IllegalStateException("Could not read properties from file: %s".formatted(path), e);
2323
}
2424
}
2525
}

library/src/main/java/dev/andstuff/kraken/api/endpoint/account/csv/RecordMappingStrategy.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.opencsv.bean.AbstractCsvConverter;
1313
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
1414
import com.opencsv.exceptions.CsvBeanIntrospectionException;
15-
import com.opencsv.exceptions.CsvChainedException;
1615
import com.opencsv.exceptions.CsvConstraintViolationException;
1716
import com.opencsv.exceptions.CsvDataTypeMismatchException;
1817
import com.opencsv.exceptions.CsvFieldAssignmentException;
@@ -29,7 +28,7 @@ public RecordMappingStrategy(Class<T> type) {
2928
}
3029

3130
@Override
32-
public T populateNewBean(String[] line) throws CsvBeanIntrospectionException, CsvFieldAssignmentException, CsvChainedException {
31+
public T populateNewBean(String[] line) throws CsvBeanIntrospectionException, CsvFieldAssignmentException {
3332
RecordComponent[] recordComponents = type.getRecordComponents();
3433
if (recordComponents.length != line.length) {
3534
throw new CsvRuntimeException("Mismatch between line values and record components");
@@ -71,7 +70,7 @@ private Map<String, Object> createValuesMap(String[] line) throws CsvConstraintV
7170
public static class KrakenInstantConverter extends AbstractCsvConverter {
7271

7372
@Override
74-
public Object convertToRead(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException {
73+
public Object convertToRead(String value) {
7574
String[] dateTime = value.split(" ");
7675
return Instant.parse("%sT%sZ".formatted(dateTime[0], dateTime[1]));
7776
}

library/src/main/java/dev/andstuff/kraken/api/endpoint/account/response/LedgerEntry.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ public enum Type {
8282
TRANSFER,
8383
WITHDRAWAL,
8484

85-
@JsonProperty("custodytransfer") CUSTODY_TRANSFER,
86-
@JsonProperty("nftcreatorfee") NFT_CREATOR_FEE,
87-
@JsonProperty("nftrebate") NFT_REBATE,
88-
@JsonProperty("nfttrade") NFT_TRADE,
85+
@JsonProperty("custodytransfer")
86+
CUSTODY_TRANSFER,
87+
@JsonProperty("nftcreatorfee")
88+
NFT_CREATOR_FEE,
89+
@JsonProperty("nftrebate")
90+
NFT_REBATE,
91+
@JsonProperty("nfttrade")
92+
NFT_TRADE,
8993

90-
@JsonEnumDefaultValue UNKNOWN
94+
@JsonEnumDefaultValue
95+
UNKNOWN
9196
}
9297
}

library/src/main/java/dev/andstuff/kraken/api/endpoint/account/response/Report.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.time.Instant;
44

5+
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
56
import com.fasterxml.jackson.annotation.JsonProperty;
67

78
import dev.andstuff.kraken.api.endpoint.account.params.ReportFormat;
@@ -10,7 +11,7 @@ public record Report(String id,
1011
@JsonProperty("descr") String description,
1112
ReportFormat format,
1213
String subType,
13-
String status, // TODO enum
14+
Status status,
1415
String fields,
1516
@JsonProperty("createdtm") Instant requestDate,
1617
@JsonProperty("starttm") Instant creationDate,
@@ -19,7 +20,15 @@ public record Report(String id,
1920
@JsonProperty("dataendtm") Instant reportToDate,
2021
String asset) {
2122

23+
enum Status {
24+
QUEUED,
25+
PROCESSING,
26+
PROCESSED,
27+
@JsonEnumDefaultValue
28+
UNKNOWN
29+
}
30+
2231
public boolean isProcessed() {
23-
return "Processed".equals(status);
32+
return status == Status.PROCESSED;
2433
}
2534
}

0 commit comments

Comments
 (0)