Skip to content

Commit

Permalink
Removed reflection from App::makeWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Oct 4, 2021
1 parent 93dafc3 commit 2a02339
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions shared/java/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ public static void init() {
@NotNull @SneakyThrows
public static Window makeWindow() {
assert _onUIThread();
Class cls;
if (Platform.CURRENT == Platform.WINDOWS) {
cls = App.class.forName("io.github.humbleui.jwm.WindowWin32");
} else if (Platform.CURRENT == Platform.MACOS) {
cls = App.class.forName("io.github.humbleui.jwm.WindowMac");
} else if (Platform.CURRENT == Platform.X11) {
cls = App.class.forName("io.github.humbleui.jwm.WindowX11");
} else
Window window;
if (Platform.CURRENT == Platform.WINDOWS)
window = new WindowWin32();
else if (Platform.CURRENT == Platform.MACOS)
window = new WindowMac();
else if (Platform.CURRENT == Platform.X11)
window = new WindowX11();
else
throw new RuntimeException("Unsupported platform: " + Platform.CURRENT);
Constructor<Window> ctor = cls.getDeclaredConstructor();
Window window = ctor.newInstance();;
_windows.add(window);
return window;
}
Expand Down

0 comments on commit 2a02339

Please sign in to comment.