Skip to content

Commit 8eb78be

Browse files
Bump minimum JDK to 17 (#400)
* WIP bump minimum JDK to 17 * Finish bumping + remove errorprone
1 parent 12184e9 commit 8eb78be

File tree

42 files changed

+226
-581
lines changed

Some content is hidden

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

42 files changed

+226
-581
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up JDK ${{ matrix.java }}
1515
uses: actions/setup-java@v3
1616
with:
17-
java-version: 11
17+
java-version: 17
1818
distribution: 'adopt'
1919

2020
- name: Setup Gradle

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
java: [ 11, 17, 21 ]
18+
java: [ 17, 21 ]
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: Set up JDK ${{ matrix.java }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ We know that your time is precious and, therefore, deeply value any effort to co
314314

315315
Prerequisites:
316316

317-
- JDK >= 11
317+
- JDK >= 17
318318
- Docker or Podman
319319

320320
To build the SDK:

admin-client/build.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import net.ltgt.gradle.errorprone.errorprone
21
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
32

43
plugins {
@@ -48,11 +47,6 @@ tasks.withType<GenerateTask> {
4847
finalizedBy("spotlessJava")
4948
}
5049

51-
tasks.withType<JavaCompile>().configureEach {
52-
// Disable errorprone for this module
53-
options.errorprone.disableAllChecks.set(true)
54-
}
55-
5650
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
5751
java { targetExclude(fileTree("build/generate-resources") { include("**/*.java") }) }
5852
}

buildSrc/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ repositories {
99

1010

1111
dependencies {
12-
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.0")
13-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0")
14-
implementation("org.jetbrains.kotlin:kotlin-serialization:2.0.0")
12+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
13+
implementation("org.jetbrains.kotlin:kotlin-serialization:2.0.21")
1514
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
1615
}

buildSrc/src/main/kotlin/java-conventions.gradle.kts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,16 @@
1-
2-
import net.ltgt.gradle.errorprone.errorprone
3-
41
plugins {
52
java
6-
id("net.ltgt.errorprone")
73
id("com.diffplug.spotless")
84
}
95

10-
dependencies { errorprone("com.google.errorprone:error_prone_core:2.28.0") }
11-
126
// Configure the java toolchain to use. If not found, it will be downloaded automatically
137
java {
14-
toolchain { languageVersion = JavaLanguageVersion.of(11) }
8+
toolchain { languageVersion = JavaLanguageVersion.of(17) }
159

1610
withJavadocJar()
1711
withSourcesJar()
1812
}
1913

20-
tasks.withType<JavaCompile>().configureEach {
21-
options.errorprone.disableWarningsInGeneratedCode.set(true)
22-
options.errorprone.disable(
23-
// We use toString() in proto messages for debugging reasons.
24-
"LiteProtoToString",
25-
// This check is proposing to use a guava API instead...
26-
"StringSplitter",
27-
// This is conflicting with a javadoc warn lint
28-
"MissingSummary"
29-
)
30-
options.errorprone.excludedPaths.set(".*/build/generated/.*")
31-
}
32-
3314
tasks.withType<Test> { useJUnitPlatform() }
3415

3516
configure<com.diffplug.gradle.spotless.SpotlessExtension> {

buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
java {
8-
toolchain { languageVersion = JavaLanguageVersion.of(11) }
8+
toolchain { languageVersion = JavaLanguageVersion.of(17) }
99

1010
withJavadocJar()
1111
withSourcesJar()

examples/src/main/java/my/restate/sdk/examples/Counter.java

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ public long get(SharedObjectContext ctx) {
4848
return ctx.get(TOTAL).orElse(0L);
4949
}
5050

51-
/** Get the current counter value. */
52-
@Shared
53-
@Handler
54-
public Node getNode(SharedObjectContext ctx) {
55-
return null;
56-
}
57-
5851
/** Add a value, and get both the previous value and the new value. */
5952
@Handler
6053
public CounterUpdateResult getAndAdd(ObjectContext ctx, long request) {
@@ -71,39 +64,5 @@ public static void main(String[] args) {
7164
RestateHttpEndpointBuilder.builder().bind(new Counter()).buildAndListen();
7265
}
7366

74-
public static class Node {
75-
private final String data;
76-
private final Node inner;
77-
78-
public Node(String data, Node inner) {
79-
this.data = data;
80-
this.inner = inner;
81-
}
82-
83-
public String getData() {
84-
return data;
85-
}
86-
87-
public Node getInner() {
88-
return inner;
89-
}
90-
}
91-
92-
public static class CounterUpdateResult {
93-
private final long newValue;
94-
private final long oldValue;
95-
96-
public CounterUpdateResult(long newValue, long oldValue) {
97-
this.newValue = newValue;
98-
this.oldValue = oldValue;
99-
}
100-
101-
public long getNewValue() {
102-
return newValue;
103-
}
104-
105-
public long getOldValue() {
106-
return oldValue;
107-
}
108-
}
67+
public record CounterUpdateResult(long newValue, long oldValue) {}
10968
}

examples/src/main/java/my/restate/sdk/examples/LoanWorkflow.java

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// https://github.com/restatedev/sdk-java/blob/main/LICENSE
99
package my.restate.sdk.examples;
1010

11-
import com.fasterxml.jackson.annotation.JsonCreator;
12-
import com.fasterxml.jackson.annotation.JsonProperty;
1311
import dev.restate.sdk.Context;
1412
import dev.restate.sdk.JsonSerdes;
1513
import dev.restate.sdk.SharedWorkflowContext;
@@ -45,41 +43,8 @@ public enum Status {
4543
TRANSFER_FAILED
4644
}
4745

48-
public static class LoanRequest {
49-
50-
private final String customerName;
51-
private final String customerId;
52-
private final String customerBankAccount;
53-
private final BigDecimal amount;
54-
55-
@JsonCreator
56-
public LoanRequest(
57-
@JsonProperty("customerName") String customerName,
58-
@JsonProperty("customerId") String customerId,
59-
@JsonProperty("customerBankAccount") String customerBankAccount,
60-
@JsonProperty("amount") BigDecimal amount) {
61-
this.customerName = customerName;
62-
this.customerId = customerId;
63-
this.customerBankAccount = customerBankAccount;
64-
this.amount = amount;
65-
}
66-
67-
public String getCustomerName() {
68-
return customerName;
69-
}
70-
71-
public String getCustomerId() {
72-
return customerId;
73-
}
74-
75-
public String getCustomerBankAccount() {
76-
return customerBankAccount;
77-
}
78-
79-
public BigDecimal getAmount() {
80-
return amount;
81-
}
82-
}
46+
public record LoanRequest(
47+
String customerName, String customerId, String customerBankAccount, BigDecimal amount) {}
8348

8449
private static final Logger LOG = LogManager.getLogger(LoanWorkflow.class);
8550

@@ -123,8 +88,7 @@ public String run(WorkflowContext ctx, LoanRequest loanRequest) {
12388
executionTime =
12489
bankClient
12590
.transfer(
126-
new TransferRequest(
127-
loanRequest.getCustomerBankAccount(), loanRequest.getAmount()))
91+
new TransferRequest(loanRequest.customerBankAccount(), loanRequest.amount()))
12892
.await(Duration.ofDays(7));
12993
} catch (TerminalException | TimeoutException e) {
13094
LOG.warn("Transaction failed", e);
@@ -223,24 +187,5 @@ public Instant transfer(Context context, TransferRequest request) throws Termina
223187
}
224188
}
225189

226-
public static class TransferRequest {
227-
private final String bankAccount;
228-
private final BigDecimal amount;
229-
230-
@JsonCreator
231-
public TransferRequest(
232-
@JsonProperty("bankAccount") String bankAccount,
233-
@JsonProperty("amount") BigDecimal amount) {
234-
this.bankAccount = bankAccount;
235-
this.amount = amount;
236-
}
237-
238-
public String getBankAccount() {
239-
return bankAccount;
240-
}
241-
242-
public BigDecimal getAmount() {
243-
return amount;
244-
}
245-
}
190+
public record TransferRequest(String bankAccount, BigDecimal amount) {}
246191
}

sdk-api-gen-common/src/main/java/dev/restate/sdk/gen/model/Handler.java

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,13 @@
1111
import java.util.Objects;
1212
import org.jspecify.annotations.Nullable;
1313

14-
public class Handler {
15-
16-
private final CharSequence name;
17-
private final HandlerType handlerType;
18-
private final @Nullable String inputAccept;
19-
private final PayloadType inputType;
20-
private final PayloadType outputType;
21-
private final @Nullable String documentation;
22-
23-
public Handler(
24-
CharSequence name,
25-
HandlerType handlerType,
26-
@Nullable String inputAccept,
27-
PayloadType inputType,
28-
PayloadType outputType,
29-
@Nullable String documentation) {
30-
this.name = name;
31-
this.handlerType = handlerType;
32-
this.inputAccept = inputAccept;
33-
this.inputType = inputType;
34-
this.outputType = outputType;
35-
this.documentation = documentation;
36-
}
37-
38-
public CharSequence getName() {
39-
return name;
40-
}
41-
42-
public HandlerType getHandlerType() {
43-
return handlerType;
44-
}
45-
46-
@Nullable
47-
public String getInputAccept() {
48-
return inputAccept;
49-
}
50-
51-
public PayloadType getInputType() {
52-
return inputType;
53-
}
54-
55-
public PayloadType getOutputType() {
56-
return outputType;
57-
}
58-
59-
public @Nullable String getDocumentation() {
60-
return documentation;
61-
}
14+
public record Handler(
15+
CharSequence name,
16+
HandlerType handlerType,
17+
@Nullable String inputAccept,
18+
PayloadType inputType,
19+
PayloadType outputType,
20+
@Nullable String documentation) {
6221

6322
public static Builder builder() {
6423
return new Builder();

0 commit comments

Comments
 (0)