upgrade to jdk20

* use pattern matching preview feature
* bump fuse-nio-adapter
This commit is contained in:
Armin Schrenk 2023-05-08 19:12:35 +02:00
parent 532ffb1202
commit 151ef6c7b2
No known key found for this signature in database
GPG Key ID: 8F2992163CBBA7FC
6 changed files with 40 additions and 35 deletions

View File

@ -8,7 +8,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20_PREVIEW" project-jdk-name="20" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -26,7 +26,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.jdk.version>19</project.jdk.version>
<project.jdk.version>20</project.jdk.version>
<!-- Group IDs of jars that need to stay on the class path for now -->
<!-- Once hypfvieh, swiesend, purejava and integrations-linux have module-info, remove them-->
@ -38,7 +38,7 @@
<cryptomator.integrations.win.version>1.2.0</cryptomator.integrations.win.version>
<cryptomator.integrations.mac.version>1.2.0</cryptomator.integrations.mac.version>
<cryptomator.integrations.linux.version>1.2.0</cryptomator.integrations.linux.version>
<cryptomator.fuse.version>2.0.5</cryptomator.fuse.version>
<cryptomator.fuse.version>3.0.0</cryptomator.fuse.version>
<cryptomator.dokany.version>2.0.0</cryptomator.dokany.version>
<cryptomator.webdav.version>2.0.2</cryptomator.webdav.version>
@ -64,7 +64,7 @@
<!-- build-time dependencies -->
<jetbrains.annotations.version>23.0.0</jetbrains.annotations.version>
<dependency-check.version>8.1.0</dependency-check.version>
<jacoco.version>0.8.8</jacoco.version>
<jacoco.version>0.8.9</jacoco.version>
</properties>
<dependencies>
@ -332,6 +332,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -5,10 +5,10 @@ import java.util.List;
public interface IpcMessageListener {
default void handleMessage(IpcMessage message) {
if (message instanceof RevealRunningAppMessage) {
revealRunningApp();
} else if (message instanceof HandleLaunchArgsMessage m) {
handleLaunchArgs(m.args());
switch (message) {
case RevealRunningAppMessage x -> revealRunningApp();
case HandleLaunchArgsMessage hlam -> handleLaunchArgs(hlam.args());
default -> {}
}
}

View File

@ -102,14 +102,16 @@ public class StartController implements FxController {
}
private void loadingKeyFailed(Throwable e) {
if (e instanceof UnlockCancelledException) {
// ok
} else if (e instanceof VaultKeyInvalidException) {
LOG.error("Invalid key"); //TODO: specific error screen
appWindows.showErrorWindow(e, window, null);
} else {
LOG.error("Failed to load key.", e);
appWindows.showErrorWindow(e, window, null);
switch (e) {
case UnlockCancelledException uce -> {} //ok
case VaultKeyInvalidException vkie -> {
LOG.error("Invalid key"); //TODO: specific error screen
appWindows.showErrorWindow(e, window, null);
}
default -> {
LOG.error("Failed to load key.", e);
appWindows.showErrorWindow(e, window, null);
}
}
}

View File

@ -84,18 +84,19 @@ public class AwtTrayMenuController implements TrayMenuController {
private void addChildren(Menu menu, List<TrayMenuItem> items) {
for (var item : items) {
// TODO: use Pattern Matching for switch, once available
if (item instanceof ActionItem a) {
var menuItem = new MenuItem(a.title());
menuItem.addActionListener(evt -> a.action().run());
menuItem.setEnabled(a.enabled());
menu.add(menuItem);
} else if (item instanceof SeparatorItem) {
menu.addSeparator();
} else if (item instanceof SubMenuItem s) {
var submenu = new Menu(s.title());
addChildren(submenu, s.items());
menu.add(submenu);
switch (item) {
case ActionItem a -> {
var menuItem = new MenuItem(a.title());
menuItem.addActionListener(evt -> a.action().run());
menuItem.setEnabled(a.enabled());
menu.add(menuItem);
}
case SeparatorItem si -> menu.addSeparator();
case SubMenuItem smi -> {
var submenu = new Menu(smi.title());
addChildren(submenu, smi.items());
menu.add(submenu);
}
}
}
}

View File

@ -38,13 +38,12 @@ public class UnlockInvalidMountPointController implements FxController {
@FXML
public void initialize() {
var e = unlockException.get();
String translationKey = "unlock.error.customPath.description.generic";
if (e instanceof MountPointNotSupportedException) {
translationKey = "unlock.error.customPath.description.notSupported";
} else if (e instanceof MountPointNotExistsException) {
translationKey = "unlock.error.customPath.description.notExists";
}
dialogDescription.setFormat(resourceBundle.getString(translationKey));
var translationKeySuffix = switch (e) {
case MountPointNotSupportedException x -> "notSupported";
case MountPointNotExistsException x -> "notExists";
default -> "generic";
};
dialogDescription.setFormat(resourceBundle.getString("unlock.error.customPath.description." + translationKeySuffix));
dialogDescription.setArg1(e.getMessage());
}