Skip to content

Commit 723f50b

Browse files
committed
chore(sdk): enforce java 8 compatibility
1 parent 721f0fd commit 723f50b

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ allprojects {
2424
java {
2525
sourceCompatibility = JavaVersion.VERSION_1_8
2626
targetCompatibility = JavaVersion.VERSION_1_8
27+
28+
toolchain {
29+
languageVersion = JavaLanguageVersion.of(8)
30+
}
2731
}
2832

2933
tasks.withType(JavaCompile).configureEach {
3034
options.encoding = 'UTF-8'
35+
options.release = 8 // enforce java 8 compatibility
3136
}
3237

3338
spotless {
@@ -69,7 +74,6 @@ subprojects {
6974
afterEvaluate { project ->
7075
// only apply to service sub-projects and core
7176
if (project.path.startsWith(':services:') || project.name == "core" ) {
72-
7377
// override the version of each service with the ones obtained from the VERSION files
7478
def versionFile = project.file("VERSION")
7579
if (versionFile.exists()) {

examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import cloud.stackit.sdk.iaas.api.IaasApi;
55
import cloud.stackit.sdk.iaas.model.*;
66
import java.io.IOException;
7-
import java.util.Map;
7+
import java.util.Collections;
88
import java.util.Objects;
99
import java.util.UUID;
1010
import java.util.concurrent.TimeUnit;
@@ -36,7 +36,7 @@ public static void main(String[] args) throws IOException {
3636
.name("java-sdk-example-network-01")
3737
.dhcp(true)
3838
.routed(false)
39-
.labels(Map.ofEntries(Map.entry("foo", "bar")))
39+
.labels(Collections.singletonMap("foo", "bar"))
4040
.addressFamily(
4141
new CreateNetworkAddressFamily()
4242
.ipv4(
@@ -50,7 +50,7 @@ public static void main(String[] args) throws IOException {
5050
newNetwork.getNetworkId(),
5151
new PartialUpdateNetworkPayload()
5252
.dhcp(false)
53-
.labels(Map.ofEntries(Map.entry("foo", "bar-updated"))));
53+
.labels(Collections.singletonMap("foo", "bar-updated")));
5454

5555
/* fetch the network we just created */
5656
Network fetchedNetwork = iaasApi.getNetwork(projectId, newNetwork.getNetworkId());
@@ -83,7 +83,7 @@ public static void main(String[] args) throws IOException {
8383
/* get an image */
8484
UUID imageId =
8585
images.getItems()
86-
.getFirst()
86+
.get(0)
8787
.getId(); // we just use a random image id in our example
8888
assert imageId != null;
8989
Image fetchedImage = iaasApi.getImage(projectId, imageId);
@@ -119,7 +119,7 @@ public static void main(String[] args) throws IOException {
119119
assert newKeypair.getName() != null;
120120
iaasApi.updateKeyPair(
121121
newKeypair.getName(),
122-
new UpdateKeyPairPayload().labels(Map.ofEntries(Map.entry("foo", "bar"))));
122+
new UpdateKeyPairPayload().labels(Collections.singletonMap("foo", "bar")));
123123

124124
/* fetch the keypair we just created / updated */
125125
Keypair fetchedKeypair = iaasApi.getKeyPair(newKeypair.getName());
@@ -144,7 +144,7 @@ public static void main(String[] args) throws IOException {
144144

145145
/* fetch details about a machine type */
146146
MachineType fetchedMachineType =
147-
iaasApi.getMachineType(projectId, machineTypes.getItems().getFirst().getName());
147+
iaasApi.getMachineType(projectId, machineTypes.getItems().get(0).getName());
148148
System.out.println("\nFetched machine type: ");
149149
System.out.println("* Name: " + fetchedMachineType.getName());
150150
System.out.println("* Description: " + fetchedMachineType.getDescription());
@@ -163,7 +163,7 @@ public static void main(String[] args) throws IOException {
163163
.name("java-sdk-example-server-01")
164164
.machineType("t2i.1")
165165
.imageId(imageId)
166-
.labels(Map.ofEntries(Map.entry("foo", "bar")))
166+
.labels(Collections.singletonMap("foo", "bar"))
167167
// add the keypair we created above
168168
.keypairName(newKeypair.getName())
169169
// add the server to the network we created above
@@ -188,7 +188,7 @@ public static void main(String[] args) throws IOException {
188188
projectId,
189189
newServer.getId(),
190190
new UpdateServerPayload()
191-
.labels(Map.ofEntries(Map.entry("foo", "bar-updated"))));
191+
.labels(Collections.singletonMap("foo", "bar-updated")));
192192

193193
/* list all servers */
194194
ServerListResponse servers = iaasApi.listServers(projectId, false, null);

examples/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/examples/ResourcemanagerExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import cloud.stackit.sdk.resourcemanager.model.FolderResponse;
88
import cloud.stackit.sdk.resourcemanager.model.Project;
99
import java.io.IOException;
10-
import java.util.Map;
10+
import java.util.Collections;
1111
import java.util.UUID;
1212

1313
class ResourcemanagerExample {
@@ -25,14 +25,14 @@ public static void main(String[] args) throws IOException {
2525
resourceManagerApi.createProject(
2626
new CreateProjectPayload()
2727
.containerParentId(containerParentId.toString())
28-
.labels(Map.ofEntries(Map.entry("foo", "bar"))));
28+
.labels(Collections.singletonMap("foo", "bar")));
2929

3030
/* create a folder */
3131
FolderResponse folder =
3232
resourceManagerApi.createFolder(
3333
new CreateFolderPayload()
3434
.containerParentId(containerParentId.toString())
35-
.labels(Map.ofEntries(Map.entry("foo", "bar"))));
35+
.labels(Collections.singletonMap("foo", "bar")));
3636
} catch (ApiException e) {
3737
throw new RuntimeException(e);
3838
}

0 commit comments

Comments
 (0)