提交 d1ac43de 编写于 作者: S Skylot

fix(gui): add default contructor for classes serialized with GSON (#752)

上级 00f5e835
......@@ -38,10 +38,18 @@ public class JadxProject {
private int projectVersion = 0;
// Don't remove. Used in json serialization
public JadxProject() {
}
public JadxProject(JadxSettings settings) {
this.settings = settings;
}
public void setSettings(JadxSettings settings) {
this.settings = settings;
}
public Path getProjectPath() {
return projectPath;
}
......
......@@ -54,8 +54,8 @@ public class JadxSettingsAdapter {
}
public static JadxSettings load() {
String jsonSettings = PREFS.get(JADX_GUI_KEY, "");
try {
String jsonSettings = PREFS.get(JADX_GUI_KEY, "");
JadxSettings settings = fromString(jsonSettings);
if (settings == null) {
LOG.debug("Created new settings.");
......@@ -68,7 +68,7 @@ public class JadxSettingsAdapter {
}
return settings;
} catch (Exception e) {
LOG.error("Error load settings", e);
LOG.error("Error load settings. Settings will reset.\n Loaded json string: {}", jsonSettings, e);
return new JadxSettings();
}
}
......
......@@ -3,10 +3,12 @@ package jadx.gui.settings;
import java.awt.*;
public class WindowLocation {
private String windowId;
private Rectangle bounds;
private final String windowId;
private final Rectangle bounds;
// Don't remove. Used in json serialization
public WindowLocation() {
}
public WindowLocation(String windowId, Rectangle bounds) {
this.windowId = windowId;
......@@ -17,10 +19,18 @@ public class WindowLocation {
return windowId;
}
public void setWindowId(String windowId) {
this.windowId = windowId;
}
public Rectangle getBounds() {
return bounds;
}
public void setBounds(Rectangle bounds) {
this.bounds = bounds;
}
@Override
public String toString() {
return "WindowLocation{"
......
......@@ -3,7 +3,11 @@ package jadx.gui.utils;
import java.util.Locale;
public class LangLocale {
private final Locale locale;
private Locale locale;
// Don't remove. Used in json serialization
public LangLocale() {
}
public LangLocale(Locale locale) {
this.locale = locale;
......@@ -17,6 +21,14 @@ public class LangLocale {
return locale;
}
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
@Override
public String toString() {
return NLS.str("language.name", this);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册