提交 6c9c427d authored 作者: noelgrandin's avatar noelgrandin

java1.6 allows covariant return type for overriding methods, use it for clone()

上级 5336c8d1
...@@ -112,7 +112,7 @@ public class ConnectionInfo implements Cloneable { ...@@ -112,7 +112,7 @@ public class ConnectionInfo implements Cloneable {
return KNOWN_SETTINGS.contains(s); return KNOWN_SETTINGS.contains(s);
} }
public Object clone() throws CloneNotSupportedException { public ConnectionInfo clone() throws CloneNotSupportedException {
ConnectionInfo clone = (ConnectionInfo) super.clone(); ConnectionInfo clone = (ConnectionInfo) super.clone();
clone.prop = (Properties) prop.clone(); clone.prop = (Properties) prop.clone();
clone.filePasswordHash = Utils.cloneByteArray(filePasswordHash); clone.filePasswordHash = Utils.cloneByteArray(filePasswordHash);
......
...@@ -130,7 +130,7 @@ public class Engine implements SessionFactory { ...@@ -130,7 +130,7 @@ public class Engine implements SessionFactory {
// In serialized mode, database instance sharing is not possible // In serialized mode, database instance sharing is not possible
ci.setProperty("OPEN_NEW", "TRUE"); ci.setProperty("OPEN_NEW", "TRUE");
try { try {
backup = (ConnectionInfo) ci.clone(); backup = ci.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw DbException.convert(e); throw DbException.convert(e);
} }
......
...@@ -294,8 +294,8 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -294,8 +294,8 @@ public class SessionRemote extends SessionWithState implements DataHandler {
ConnectionInfo backup = null; ConnectionInfo backup = null;
try { try {
if (autoServerMode) { if (autoServerMode) {
backup = (ConnectionInfo) ci.clone(); backup = ci.clone();
connectionInfo = (ConnectionInfo) ci.clone(); connectionInfo = ci.clone();
} }
if (openNew) { if (openNew) {
ci.setProperty("OPEN_NEW", "true"); ci.setProperty("OPEN_NEW", "true");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论