From: gmungoc Date: Fri, 1 Sep 2017 09:13:19 +0000 (+0100) Subject: JAL-2488 remove finalize methods X-Git-Tag: Release_2_10_3b1~58^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=82b053436b1d354d5b09ab419cac65ca032aea94;p=jalview.git JAL-2488 remove finalize methods --- diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index b07666e..36cb185 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -62,15 +62,6 @@ public class AlignViewport extends AlignmentViewport private AnnotationColumnChooser annotationColumnSelectionState; - @Override - public void finalize() - { - applet = null; - quality = null; - alignment = null; - colSel = null; - } - public AlignViewport(AlignmentI al, JalviewLite applet) { super(al); diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 8e333ba..bb26caa 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -73,23 +73,6 @@ public class AlignmentPanel extends Panel // this value is set false when selection area being dragged boolean fastPaint = true; - @Override - public void finalize() throws Throwable - { - alignFrame = null; - av = null; - vpRanges = null; - seqPanel = null; - seqPanelHolder = null; - sequenceHolderPanel = null; - scalePanel = null; - scalePanelHolder = null; - annotationPanel = null; - annotationPanelHolder = null; - annotationSpaceFillerHolder = null; - super.finalize(); - } - public AlignmentPanel(AlignFrame af, final AlignViewport av) { try diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index dd05843..e44c32d 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -52,14 +52,6 @@ public class AlignViewController implements AlignViewControllerI */ private AlignViewControllerGuiI avcg; - @Override - protected void finalize() throws Throwable - { - viewport = null; - alignPanel = null; - avcg = null; - }; - public AlignViewController(AlignViewControllerGuiI alignFrame, AlignViewportI viewport, AlignmentViewPanel alignPanel) { diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index c464af2..09facbf 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -241,19 +241,6 @@ public class AlignmentAnnotation private boolean isrna; - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() throws Throwable - { - sequenceRef = null; - groupRef = null; - super.finalize(); - } - public static int getGraphValueFromString(String string) { if (string.equalsIgnoreCase("BAR_GRAPH")) diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java index 328b96a..b5184fb 100644 --- a/src/jalview/datamodel/Mapping.java +++ b/src/jalview/datamodel/Mapping.java @@ -693,19 +693,6 @@ public class Mapping to = tto; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() throws Throwable - { - map = null; - to = null; - super.finalize(); - } - /** * Returns an iterator which can serve up the aligned codon column positions * and their corresponding peptide products diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 13b715e..fd640cf 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -2713,8 +2713,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /* * Create a new AlignmentPanel (with its own, new Viewport) */ - AlignmentPanel newap = new Jalview2XML().copyAlignPanel(alignPanel, - true); + AlignmentPanel newap = new Jalview2XML().copyAlignPanel(alignPanel); if (!copyAnnotation) { /* diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 1658f0f88..a64a475 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -216,34 +216,6 @@ public class Jalview2XML } } - void clearSeqRefs() - { - if (_cleartables) - { - if (seqRefIds != null) - { - seqRefIds.clear(); - } - if (seqsToIds != null) - { - seqsToIds.clear(); - } - if (incompleteSeqs != null) - { - incompleteSeqs.clear(); - } - // seqRefIds = null; - // seqsToIds = null; - } - else - { - // do nothing - warn("clearSeqRefs called when _cleartables was not set. Doing nothing."); - // seqRefIds = new Hashtable(); - // seqsToIds = new IdentityHashMap(); - } - } - void initSeqRefs() { if (seqsToIds == null) @@ -5341,28 +5313,25 @@ public class Jalview2XML } - public jalview.gui.AlignmentPanel copyAlignPanel(AlignmentPanel ap, - boolean keepSeqRefs) + /** + * Provides a 'copy' of an alignment view (on action New View) by 'saving' the + * view as XML (but not to file), and then reloading it + * + * @param ap + * @return + */ + public AlignmentPanel copyAlignPanel(AlignmentPanel ap) { initSeqRefs(); JalviewModel jm = saveState(ap, null, null, null); - if (!keepSeqRefs) - { - clearSeqRefs(); - jm.getJalviewModelSequence().getViewport(0).setSequenceSetId(null); - } - else - { - uniqueSetSuffix = ""; - jm.getJalviewModelSequence().getViewport(0).setId(null); // we don't - // overwrite the - // view we just - // copied - } + uniqueSetSuffix = ""; + jm.getJalviewModelSequence().getViewport(0).setId(null); + // we don't overwrite the view we just copied + if (this.frefedSequence == null) { - frefedSequence = new Vector(); + frefedSequence = new Vector(); } viewportsAdded.clear(); @@ -5382,32 +5351,8 @@ public class Jalview2XML return af.alignPanel; } - /** - * flag indicating if hashtables should be cleared on finalization TODO this - * flag may not be necessary - */ - private final boolean _cleartables = true; - private Hashtable jvids2vobj; - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() throws Throwable - { - // really make sure we have no buried refs left. - if (_cleartables) - { - clearSeqRefs(); - } - this.seqRefIds = null; - this.seqsToIds = null; - super.finalize(); - } - private void warn(String msg) { warn(msg, null); diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index cdbb4fa..2a7743a 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -60,15 +60,6 @@ public class ViewSelectionMenu extends JMenu private ItemListener _handler; - @Override - protected void finalize() throws Throwable - { - _selectedviews = null; - _handler = null; - _allviews = null; - super.finalize(); - } - /** * create a new view selection menu. This menu has some standard entries * (select all, invert selection), and a checkbox for every view. Mousing over diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 26641b1..f26d6da 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -606,18 +606,4 @@ public class FileLoader implements Runnable return tempStructFile.toString(); } - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() throws Throwable - { - source = null; - alignFrame = null; - viewport = null; - super.finalize(); - } - } diff --git a/src/jalview/io/InputStreamParser.java b/src/jalview/io/InputStreamParser.java index d269e97..65ba74a 100644 --- a/src/jalview/io/InputStreamParser.java +++ b/src/jalview/io/InputStreamParser.java @@ -47,11 +47,4 @@ public class InputStreamParser extends FileParse error = false; } - @Override - protected void finalize() throws Throwable - { - dataIn = null; - super.finalize(); - } - } diff --git a/src/jalview/javascript/JSFunctionExec.java b/src/jalview/javascript/JSFunctionExec.java index 083cd26..29f3fa9 100644 --- a/src/jalview/javascript/JSFunctionExec.java +++ b/src/jalview/javascript/JSFunctionExec.java @@ -39,19 +39,6 @@ public class JSFunctionExec implements Runnable jvlite.setExecutor(this); } - @Override - protected void finalize() throws Throwable - { - jvlite = null; - executor = null; - if (jsExecQueue != null) - { - jsExecQueue.clear(); - } - jsExecQueue = null; - super.finalize(); - } - private Vector jsExecQueue; private Thread executor = null; diff --git a/src/jalview/javascript/MouseOverStructureListener.java b/src/jalview/javascript/MouseOverStructureListener.java index 874bfd3..6071933 100644 --- a/src/jalview/javascript/MouseOverStructureListener.java +++ b/src/jalview/javascript/MouseOverStructureListener.java @@ -299,13 +299,6 @@ public class MouseOverStructureListener extends JSFunctionExec } @Override - public void finalize() throws Throwable - { - jvlite = null; - super.finalize(); - } - - @Override public void releaseReferences(Object svl) { diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index cb8f75a..2f3c298 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -170,13 +170,11 @@ public class Jws2Instance { try { - Closeable svc = (Closeable) service; - service = null; - svc.close(); - } catch (Exception e) + ((Closeable) service).close(); + } catch (Throwable t) { + // ignore } - ; } super.finalize(); }