From 3027bfb4b1b13af8686abcd419888e03141bd672 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 20 Mar 2019 16:13:14 +0000 Subject: [PATCH] JAL-3130 Lots of deprecation fixes. See utils/deprecation_auto_fixes.sh for commands used to fix the bulk of these (a couple of manual fixes at the end too). --- build-j11.xml | 12 ++- src/MCview/AppletPDBCanvas.java | 5 +- src/MCview/Atom.java | 10 +- src/MCview/PDBCanvas.java | 5 +- src/com/stevesoft/pat/RegOpt.java | 8 +- src/com/stevesoft/pat/RegexTokenizer.java | 4 +- src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java | 4 +- src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java | 2 +- src/jalview/analysis/AlignmentSorter.java | 2 +- src/jalview/analysis/Conservation.java | 4 +- src/jalview/analysis/ParseProperties.java | 2 +- src/jalview/analysis/SeqsetUtils.java | 4 +- src/jalview/analysis/StructureFrequency.java | 12 +-- src/jalview/appletgui/AlignFrame.java | 10 +- src/jalview/appletgui/AlignViewport.java | 4 +- src/jalview/appletgui/AnnotationColourChooser.java | 2 +- src/jalview/appletgui/AnnotationLabels.java | 4 +- src/jalview/appletgui/AnnotationPanel.java | 4 +- src/jalview/appletgui/FeatureColourChooser.java | 2 +- src/jalview/appletgui/FeatureSettings.java | 2 +- src/jalview/appletgui/FontChooser.java | 6 +- src/jalview/appletgui/IdPanel.java | 4 +- src/jalview/appletgui/OverviewPanel.java | 12 +-- src/jalview/appletgui/ScalePanel.java | 4 +- src/jalview/appletgui/SeqPanel.java | 8 +- src/jalview/bin/JalviewLite.java | 18 ++-- src/jalview/datamodel/AlignmentAnnotation.java | 4 +- src/jalview/datamodel/BinarySequence.java | 2 +- src/jalview/datamodel/ColumnSelection.java | 6 +- src/jalview/ext/htsjdk/VCFReader.java | 12 +-- src/jalview/ext/jmol/JalviewJmolBinding.java | 2 +- src/jalview/gui/AlignFrame.java | 4 +- src/jalview/gui/BlogReader.java | 2 +- src/jalview/gui/Desktop.java | 20 ++-- src/jalview/gui/FeatureRenderer.java | 8 +- src/jalview/gui/FeatureSettings.java | 4 +- src/jalview/gui/PCAPanel.java | 10 +- src/jalview/gui/RotatableCanvas.java | 2 +- src/jalview/gui/SplitFrame.java | 6 +- src/jalview/gui/WsPreferences.java | 2 +- src/jalview/io/AnnotationFile.java | 6 +- src/jalview/io/FeaturesFile.java | 2 +- src/jalview/io/JPredFile.java | 4 +- src/jalview/io/JnetAnnotationMaker.java | 4 +- src/jalview/io/ModellerDescription.java | 2 +- src/jalview/io/NewickFile.java | 6 +- src/jalview/io/VamsasAppDatastore.java | 6 +- src/jalview/io/vamsas/Rangetype.java | 12 +-- src/jalview/io/vamsas/Sequencefeature.java | 6 +- src/jalview/io/vamsas/Tree.java | 4 +- src/jalview/jbgui/GAlignFrame.java | 56 +++++------ src/jalview/jbgui/GCutAndPasteHtmlTransfer.java | 8 +- src/jalview/jbgui/GCutAndPasteTransfer.java | 8 +- src/jalview/jbgui/GDesktop.java | 2 +- src/jalview/project/Jalview2XML.java | 4 +- src/jalview/schemes/FeatureColour.java | 6 +- src/jalview/util/Platform.java | 2 +- .../seqfeatures/FeatureRendererModel.java | 8 +- src/jalview/ws/jws2/RNAalifoldClient.java | 2 +- src/uk/ac/ebi/www/InputParams.java | 6 +- .../AccessionMapperBindingStub.java | 4 +- test/jalview/datamodel/ColumnSelectionTest.java | 6 +- test/jalview/datamodel/SequenceFeatureTest.java | 4 +- test/jalview/gui/SeqPanelTest.java | 103 ++++++++++---------- test/jalview/io/StockholmFileTest.java | 4 +- utils/deprecation_auto_fixes.sh | 12 +++ 66 files changed, 276 insertions(+), 249 deletions(-) create mode 100644 utils/deprecation_auto_fixes.sh diff --git a/build-j11.xml b/build-j11.xml index 71fee4f..d56d029 100755 --- a/build-j11.xml +++ b/build-j11.xml @@ -44,6 +44,7 @@ + @@ -326,7 +327,11 @@ - + + + + + - + + diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index b15c3cc..c6553f8 100644 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -37,8 +37,7 @@ import jalview.util.MessageManager; import java.awt.Color; import java.awt.Dimension; -import java.awt.Event; -import java.awt.Font; +import java.awt.event.InputEvent;import java.awt.Font; import java.awt.Graphics; import java.awt.Image; // JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug @@ -893,7 +892,7 @@ public class AppletPDBCanvas extends Panel MCMatrix objmat = new MCMatrix(3, 3); objmat.setIdentity(); - if ((evt.getModifiers() & Event.META_MASK) != 0) + if ((evt.getModifiersEx() & InputEvent.META_DOWN_MASK) != 0) { objmat.rotatez(((mx - omx))); } diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 904e307..a2ce2ae 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -83,14 +83,14 @@ public class Atom resNumber = Integer.parseInt(str.substring(22, 26).trim()); resNumIns = str.substring(22, 27).trim(); insCode = str.substring(26, 27).charAt(0); - this.x = (new Float(str.substring(30, 38).trim()).floatValue()); - this.y = (new Float(str.substring(38, 46).trim()).floatValue()); - this.z = (new Float(str.substring(47, 55).trim()).floatValue()); + this.x = (Float.valueOf(str.substring(30, 38).trim()).floatValue()); + this.y = (Float.valueOf(str.substring(38, 46).trim()).floatValue()); + this.z = (Float.valueOf(str.substring(47, 55).trim()).floatValue()); // optional entries - see JAL-730 String tm = str.substring(54, 60).trim(); if (tm.length() > 0) { - occupancy = (new Float(tm)).floatValue(); + occupancy = (Float.valueOf(tm)).floatValue(); } else { @@ -100,7 +100,7 @@ public class Atom tm = str.substring(60, 66).trim(); if (tm.length() > 0) { - tfactor = (new Float(tm).floatValue()); + tfactor = (Float.valueOf(tm).floatValue()); } else { diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index ab172f2..a34e574 100644 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -36,8 +36,7 @@ import jalview.structure.StructureSelectionManager; import java.awt.Color; import java.awt.Dimension; -import java.awt.Event; -import java.awt.Font; +import java.awt.event.InputEvent;import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; // JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug @@ -858,7 +857,7 @@ public class PDBCanvas extends JPanel MCMatrix objmat = new MCMatrix(3, 3); objmat.setIdentity(); - if ((evt.getModifiers() & Event.META_MASK) != 0) + if ((evt.getModifiersEx() & InputEvent.META_DOWN_MASK) != 0) { objmat.rotatez(((mx - omx))); } diff --git a/src/com/stevesoft/pat/RegOpt.java b/src/com/stevesoft/pat/RegOpt.java index 50d799f..d5f62de 100755 --- a/src/com/stevesoft/pat/RegOpt.java +++ b/src/com/stevesoft/pat/RegOpt.java @@ -138,16 +138,16 @@ class Branch extends Pattern n = RegOpt.opt(n, ignoreCase, dontMinQ); } n.setParent(this); - set(new Character(o.c), n, ignoreCase, dontMinQ); + set(Character.valueOf(o.c), n, ignoreCase, dontMinQ); if (ignoreCase) { if (o.c != o.altc) { - set(new Character(o.altc), n, ignoreCase, dontMinQ); + set(Character.valueOf(o.altc), n, ignoreCase, dontMinQ); } if (o.c != o.altc2 && o.altc != o.altc2) { - set(new Character(o.altc2), n, ignoreCase, dontMinQ); + set(Character.valueOf(o.altc2), n, ignoreCase, dontMinQ); } } } @@ -250,7 +250,7 @@ class Branch extends Pattern { return -1; } - Pattern n = (Pattern) h.get(new Character(pt.src.charAt(pos))); + Pattern n = (Pattern) h.get(Character.valueOf(pt.src.charAt(pos))); if (n == null) { return -1; diff --git a/src/com/stevesoft/pat/RegexTokenizer.java b/src/com/stevesoft/pat/RegexTokenizer.java index 31fa2ba..c99bfea 100755 --- a/src/com/stevesoft/pat/RegexTokenizer.java +++ b/src/com/stevesoft/pat/RegexTokenizer.java @@ -43,13 +43,13 @@ public class RegexTokenizer implements Enumeration if (r.searchFrom(toParse, pos)) { v.addElement(r.left().substring(pos)); - vi.addElement(new Integer(r.matchFrom() + r.charsMatched())); + vi.addElement(Integer.valueOf(r.matchFrom() + r.charsMatched())); for (int i = 0; i < r.numSubs(); i++) { if (r.substring() != null) { v.addElement(r.substring(i + offset)); - vi.addElement(new Integer(r.matchFrom(i + offset) + vi.addElement(Integer.valueOf(r.matchFrom(i + offset) + r.charsMatched(i + offset))); } } diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java index 1d57a31..6b5e36c 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java @@ -173,7 +173,7 @@ public abstract class ChimUtils float[] rgbValues = new float[4]; for (int i = 0; i < rgbStrings.length; i++) { - Float f = new Float(rgbStrings[i]); + Float f = Float.valueOf(rgbStrings[i]); rgbValues[i] = f.floatValue(); } if (rgbStrings.length == 4) @@ -203,7 +203,7 @@ public abstract class ChimUtils */ public static Integer makeModelKey(int model, int subModel) { - return new Integer(model * MAX_SUB_MODELS + subModel); + return Integer.valueOf(model * MAX_SUB_MODELS + subModel); } // invoked by the getResdiue (parseConnectivityReplies in diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java index 9a29a99..4f871d3 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java @@ -200,7 +200,7 @@ public class ChimeraChain implements ChimeraStructuralObject */ public ChimeraResidue getResidue(String index) { - // Integer index = new Integer(residueIndex); + // Integer index = Integer.valueOf(residueIndex); if (residueMap.containsKey(index)) return residueMap.get(index); return null; diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index b5cefe0..8473904 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -586,7 +586,7 @@ public class AlignmentSorter for (int i = 0; i < alignment.length; i++) { - ids[i] = (new Float(alignment[i].getName().substring(8))) + ids[i] = (Float.valueOf(alignment[i].getName().substring(8))) .floatValue(); } diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 0af5d20..c3de19b 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -695,7 +695,7 @@ public class Conservation max = Math.max(max, bigtot); - quality.addElement(new Double(bigtot)); + quality.addElement(Double.valueOf(bigtot)); } double newmax = -Double.MAX_VALUE; @@ -707,7 +707,7 @@ public class Conservation tmp = ((max - tmp) * (size - cons2GapCounts[j])) / size; // System.out.println(tmp+ " " + j); - quality.setElementAt(new Double(tmp), j); + quality.setElementAt(Double.valueOf(tmp), j); if (tmp > newmax) { diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java index 629a8a3..4b68d93 100644 --- a/src/jalview/analysis/ParseProperties.java +++ b/src/jalview/analysis/ParseProperties.java @@ -134,7 +134,7 @@ public class ParseProperties double score = Double.NaN; try { - score = new Double(sstring).doubleValue(); + score = Double.valueOf(sstring).doubleValue(); } catch (Exception e) { // don't try very hard to parse if regex was wrong. diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index fabd0c6..fdca89d 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -45,8 +45,8 @@ public class SeqsetUtils { Hashtable sqinfo = new Hashtable(); sqinfo.put("Name", seq.getName()); - sqinfo.put("Start", new Integer(seq.getStart())); - sqinfo.put("End", new Integer(seq.getEnd())); + sqinfo.put("Start", Integer.valueOf(seq.getStart())); + sqinfo.put("End", Integer.valueOf(seq.getEnd())); if (seq.getDescription() != null) { sqinfo.put("Description", seq.getDescription()); diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index b681aa6..1342bb2 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -227,14 +227,14 @@ public class StructureFrequency maxResidue = "{"; } } - residueHash.put(MAXCOUNT, new Integer(count)); + residueHash.put(MAXCOUNT, Integer.valueOf(count)); residueHash.put(MAXRESIDUE, maxResidue); percentage = ((float) count * 100) / jSize; - residueHash.put(PID_GAPS, new Float(percentage)); + residueHash.put(PID_GAPS, Float.valueOf(percentage)); percentage = ((float) count * 100) / nongap; - residueHash.put(PID_NOGAPS, new Float(percentage)); + residueHash.put(PID_NOGAPS, Float.valueOf(percentage)); if (result[i] == null) { @@ -261,14 +261,14 @@ public class StructureFrequency residueHash.put(PAIRPROFILE, pairs); } - residueHash.put(MAXCOUNT, new Integer(count)); + residueHash.put(MAXCOUNT, Integer.valueOf(count)); residueHash.put(MAXRESIDUE, maxResidue); percentage = ((float) count * 100) / jSize; - residueHash.put(PID_GAPS, new Float(percentage)); + residueHash.put(PID_GAPS, Float.valueOf(percentage)); percentage = ((float) count * 100) / nongap; - residueHash.put(PID_NOGAPS, new Float(percentage)); + residueHash.put(PID_NOGAPS, Float.valueOf(percentage)); result[bpEnd] = residueHash; } diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 85fb03c..eb3be88 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -106,6 +106,7 @@ import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; import java.util.Arrays; @@ -1569,7 +1570,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, try { new URL(url); - url = URLEncoder.encode(url); + url = URLEncoder.encode(url, "UTF-8"); } /* * When we finally deprecate 1.1 compatibility, we can start to use @@ -1582,6 +1583,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { url = viewport.applet.getCodeBase() + url; } + catch (UnsupportedEncodingException ex) + { + System.err.println( + "WARNING = IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR " + + url); + ex.printStackTrace(); + } return url; } diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 055584a..45180db 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -73,7 +73,7 @@ public class AlignViewport extends AlignmentViewport { try { - widthScale = new Float(param).floatValue(); + widthScale = Float.valueOf(param).floatValue(); } catch (Exception e) { } @@ -96,7 +96,7 @@ public class AlignViewport extends AlignmentViewport { try { - heightScale = new Float(param).floatValue(); + heightScale = Float.valueOf(param).floatValue(); } catch (Exception e) { } diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index 533226e..9456986 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -350,7 +350,7 @@ public class AnnotationColourChooser extends Panel implements { try { - float f = new Float(thresholdValue.getText()).floatValue(); + float f = Float.valueOf(thresholdValue.getText()).floatValue(); slider.setValue((int) (f * 1000)); adjustmentValueChanged(null); } catch (NumberFormatException ex) diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 1366f31..a0102b9 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -457,8 +457,8 @@ public class AnnotationLabels extends Panel .getAlignmentAnnotation(); // DETECT RIGHT MOUSE BUTTON IN AWT - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { PopupMenu popup = new PopupMenu( diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 50bc184..2b50c32 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -354,8 +354,8 @@ public class AnnotationPanel extends Panel } } - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK && activeRow != -1) { if (av.getColumnSelection() == null diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 5569ab0..0d70660 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -311,7 +311,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, { try { - float f = new Float(thresholdValue.getText()).floatValue(); + float f = Float.valueOf(thresholdValue.getText()).floatValue(); slider.setValue((int) (f * SCALE_FACTOR_1K)); adjustmentValueChanged(null); diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index a60aacd..489cbb1 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -703,7 +703,7 @@ public class FeatureSettings extends Panel public void mouseClicked(MouseEvent evt) { MyCheckbox check = (MyCheckbox) evt.getSource(); - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) + if ((evt.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0) { this.popupSort(check, fr.getMinMax(), evt.getX(), evt.getY()); } diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 443ebce..8b74e32 100644 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -31,9 +31,9 @@ import java.awt.FlowLayout; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Frame; +import java.awt.GraphicsEnvironment; import java.awt.Label; import java.awt.Panel; -import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -144,7 +144,9 @@ public class FontChooser extends Panel implements ItemListener */ void init() { - String fonts[] = Toolkit.getDefaultToolkit().getFontList(); + // String fonts[] = Toolkit.getDefaultToolkit().getFontList(); + String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getAvailableFontFamilyNames(); for (int i = 0; i < fonts.length; i++) { fontName.addItem(fonts[i]); diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index af1c47b..1d37d08 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -279,8 +279,8 @@ public class IdPanel extends Panel int seq = alignPanel.seqPanel.findSeq(e); - if ((e.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((e.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { SequenceI sq = av.getAlignment().getSequenceAt(seq); diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 96138bf..8f72260 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -114,8 +114,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mouseClicked(MouseEvent evt) { - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { showPopupMenu(evt); } @@ -140,8 +140,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mousePressed(MouseEvent evt) { - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { if (!Platform.isAMac()) { @@ -185,8 +185,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mouseDragged(MouseEvent evt) { - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { if (!Platform.isAMac()) { diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index c91449f..d3f4a69 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -96,8 +96,8 @@ public class ScalePanel extends Panel min = res; max = res; - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { rightMouseButtonPressed(evt, res); } diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index e07dae6..fee68c8 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -499,8 +499,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, // For now, ignore the mouseWheel font resizing on Macs // As the Button2_mask always seems to be true - if ((evt.getModifiers() - & InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK + if ((evt.getModifiersEx() + & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK && !av.MAC) { mouseWheelPressed = true; @@ -1432,8 +1432,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, } // DETECT RIGHT MOUSE BUTTON IN AWT - if ((evt.getModifiers() - & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiersEx() + & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) { List allFeatures = findFeaturesAtColumn(sequence, sequence.findPosition(column + 1)); diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index a60496c..8873cc9 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -198,7 +198,7 @@ public class JalviewLite extends Applet int apos = -1; try { - apos = new Integer(position).intValue(); + apos = Integer.valueOf(position).intValue(); apos--; } catch (NumberFormatException ex) { @@ -337,7 +337,7 @@ public class JalviewLite extends Applet int from = -1, to = -1; try { - from = new Integer(cl.substring(0, p)).intValue(); + from = Integer.valueOf(cl.substring(0, p)).intValue(); from--; } catch (NumberFormatException ex) { @@ -348,7 +348,7 @@ public class JalviewLite extends Applet } try { - to = new Integer(cl.substring(p + 1)).intValue(); + to = Integer.valueOf(cl.substring(p + 1)).intValue(); to--; } catch (NumberFormatException ex) { @@ -408,7 +408,7 @@ public class JalviewLite extends Applet int r = -1; try { - r = new Integer(cl).intValue(); + r = Integer.valueOf(cl).intValue(); r--; } catch (NumberFormatException ex) { @@ -1176,7 +1176,7 @@ public class JalviewLite extends Applet try { StructureSelectionManager.getStructureSelectionManager(me) - .mouseOverStructure(new Integer(pdbResNum).intValue(), + .mouseOverStructure(Integer.valueOf(pdbResNum).intValue(), chain, pdbfile); if (debug) { @@ -1212,8 +1212,8 @@ public class JalviewLite extends Applet { try { - alf.scrollTo(new Integer(topRow).intValue(), - new Integer(leftHandColumn).intValue()); + alf.scrollTo(Integer.valueOf(topRow).intValue(), + Integer.valueOf(leftHandColumn).intValue()); } catch (Exception ex) { @@ -1244,7 +1244,7 @@ public class JalviewLite extends Applet { try { - alf.scrollToRow(new Integer(topRow).intValue()); + alf.scrollToRow(Integer.valueOf(topRow).intValue()); } catch (Exception ex) { @@ -1276,7 +1276,7 @@ public class JalviewLite extends Applet { try { - alf.scrollToColumn(new Integer(leftHandColumn).intValue()); + alf.scrollToColumn(Integer.valueOf(leftHandColumn).intValue()); } catch (Exception ex) { diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index ee9389c..2ee4503 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -991,7 +991,7 @@ public class AlignmentAnnotation seqPos = i + startRes; } - sequenceMapping.put(new Integer(seqPos), annotations[i]); + sequenceMapping.put(Integer.valueOf(seqPos), annotations[i]); } } @@ -1030,7 +1030,7 @@ public class AlignmentAnnotation { for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++) { - index = new Integer(a); + index = Integer.valueOf(a); Annotation annot = sequenceMapping.get(index); if (annot != null) { diff --git a/src/jalview/datamodel/BinarySequence.java b/src/jalview/datamodel/BinarySequence.java index c33abb3..cea9de7 100755 --- a/src/jalview/datamodel/BinarySequence.java +++ b/src/jalview/datamodel/BinarySequence.java @@ -169,7 +169,7 @@ public class BinarySequence extends Sequence for (int i = 0; i < binary.length; i++) { - out += (new Integer(binary[i])).toString(); + out += (Integer.valueOf(binary[i])).toString(); if (i < (binary.length - 1)) { diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 3ccaab8..6f14e21 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -106,7 +106,7 @@ public class ColumnSelection void remove(int col) { - Integer colInt = new Integer(col); + Integer colInt = Integer.valueOf(col); if (selected.get(col)) { @@ -204,7 +204,7 @@ public class ColumnSelection // clear shifted bits and update List of selected columns selected.clear(temp); mask.set(temp - change); - order.set(i, new Integer(temp - change)); + order.set(i, Integer.valueOf(temp - change)); } } // lastly update the bitfield all at once @@ -309,7 +309,7 @@ public class ColumnSelection Integer colInt; for (int i = start; i < end; i++) { - colInt = new Integer(i); + colInt = Integer.valueOf(i); if (selection.contains(colInt)) { selection.remove(colInt); diff --git a/src/jalview/ext/htsjdk/VCFReader.java b/src/jalview/ext/htsjdk/VCFReader.java index 14c057f..ceff642 100644 --- a/src/jalview/ext/htsjdk/VCFReader.java +++ b/src/jalview/ext/htsjdk/VCFReader.java @@ -1,14 +1,14 @@ package jalview.ext.htsjdk; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; + import htsjdk.samtools.util.CloseableIterator; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.vcf.VCFFileReader; import htsjdk.variant.vcf.VCFHeader; -import java.io.Closeable; -import java.io.File; -import java.io.IOException; - /** * A thin wrapper for htsjdk classes to read either plain, or compressed, or * compressed and indexed VCF files @@ -116,7 +116,7 @@ public class VCFReader implements Closeable, Iterable { final CloseableIterator it = reader.iterator(); - return new CloseableIterator() + return new CloseableIterator<>() { boolean atEnd = false; @@ -145,7 +145,7 @@ public class VCFReader implements Closeable, Iterable int vend = variant.getEnd(); // todo what is the undeprecated way to get // the chromosome for the variant? - if (chrom.equals(variant.getChr()) && (vstart <= end) + if (chrom.equals(variant.getContig()) && (vstart <= end) && (vend >= start)) { return variant; diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index a5b1110..4406e73 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -876,7 +876,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel try { // recover PDB filename for the model hovered over. - int mnumber = new Integer(mdlId).intValue() - 1; + int mnumber = Integer.valueOf(mdlId).intValue() - 1; if (_modelFileNameMap != null) { int _mp = _modelFileNameMap.length - 1; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index bd9f661..adc8a15 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -2108,7 +2108,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newGraphGroups.add(q, null); } newGraphGroups.set(newann.graphGroup, - new Integer(++fgroup)); + Integer.valueOf(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); @@ -2155,7 +2155,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newGraphGroups.add(q, null); } newGraphGroups.set(newann.graphGroup, - new Integer(++fgroup)); + Integer.valueOf(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 9d68af1..65c8b5a 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -538,7 +538,7 @@ public class BlogReader extends JPanel public LaunchJvBrowserOnItem(JList listItems) { super("Open in Browser"); - this.putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_O)); + this.putValue(MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_O)); this.putValue(Action.LONG_DESCRIPTION, "Open in Browser"); _listItems = listItems; } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index e4c5266..4c0faa8 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1108,7 +1108,7 @@ public class Desktop extends jalview.jbgui.GDesktop KeyStroke ctrlWKey = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK); KeyStroke cmdWKey = KeyStroke.getKeyStroke(KeyEvent.VK_W, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()); InputMap inputMap = frame .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); @@ -2856,7 +2856,7 @@ public class Desktop extends jalview.jbgui.GDesktop { getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()), "Quit"); getRootPane().getActionMap().put("Quit", new AbstractAction() { @@ -2913,18 +2913,18 @@ public class Desktop extends jalview.jbgui.GDesktop progressBarHandlers = new Hashtable<>(); } - if (progressBars.get(new Long(id)) != null) + if (progressBars.get(Long.valueOf(id)) != null) { - JPanel panel = progressBars.remove(new Long(id)); - if (progressBarHandlers.contains(new Long(id))) + JPanel panel = progressBars.remove(Long.valueOf(id)); + if (progressBarHandlers.contains(Long.valueOf(id))) { - progressBarHandlers.remove(new Long(id)); + progressBarHandlers.remove(Long.valueOf(id)); } removeProgressPanel(panel); } else { - progressBars.put(new Long(id), addProgressPanel(message)); + progressBars.put(Long.valueOf(id), addProgressPanel(message)); } } @@ -2939,13 +2939,13 @@ public class Desktop extends jalview.jbgui.GDesktop final IProgressIndicatorHandler handler) { if (progressBarHandlers == null - || !progressBars.containsKey(new Long(id))) + || !progressBars.containsKey(Long.valueOf(id))) { throw new Error(MessageManager.getString( "error.call_setprogressbar_before_registering_handler")); } - progressBarHandlers.put(new Long(id), handler); - final JPanel progressPanel = progressBars.get(new Long(id)); + progressBarHandlers.put(Long.valueOf(id), handler); + final JPanel progressPanel = progressBars.get(Long.valueOf(id)); if (handler.canCancel()) { JButton cancel = new JButton( diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 46f574e..e22f506 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -269,8 +269,8 @@ public class FeatureRenderer name.setText(sf.getType()); description.setText(sf.getDescription()); group.setText(sf.getFeatureGroup()); - start.setValue(new Integer(sf.getBegin())); - end.setValue(new Integer(sf.getEnd())); + start.setValue(Integer.valueOf(sf.getBegin())); + end.setValue(Integer.valueOf(sf.getEnd())); SearchResultsI highlight = new SearchResults(); highlight.addResult(sequences.get(0), sf.getBegin(), @@ -357,8 +357,8 @@ public class FeatureRenderer name.setText(featureType); group.setText(featureGroup); - start.setValue(new Integer(firstFeature.getBegin())); - end.setValue(new Integer(firstFeature.getEnd())); + start.setValue(Integer.valueOf(firstFeature.getBegin())); + end.setValue(Integer.valueOf(firstFeature.getEnd())); description.setText(firstFeature.getDescription()); updateColourButton(mainPanel, colour, (oldcol = fcol = getFeatureStyle(featureType))); diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 4526517..9ca409b 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -636,7 +636,7 @@ public class FeatureSettings extends JPanel data[dataIndex][FILTER_COLUMN] = featureFilter == null ? new FeatureMatcherSet() : featureFilter; - data[dataIndex][SHOW_COLUMN] = new Boolean( + data[dataIndex][SHOW_COLUMN] = Boolean.valueOf( af.getViewport().getFeaturesDisplayed().isVisible(type)); dataIndex++; displayableTypes.remove(type); @@ -663,7 +663,7 @@ public class FeatureSettings extends JPanel data[dataIndex][FILTER_COLUMN] = featureFilter == null ? new FeatureMatcherSet() : featureFilter; - data[dataIndex][SHOW_COLUMN] = new Boolean(true); + data[dataIndex][SHOW_COLUMN] = Boolean.valueOf(true); dataIndex++; displayableTypes.remove(type); } diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 3388d4d..4f660a2 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -601,11 +601,11 @@ public class PCAPanel extends GPCAPanel // } // // JPanel progressPanel; - // Long lId = new Long(id); + // Long lId = Long.valueOf(id); // GridLayout layout = (GridLayout) statusPanel.getLayout(); // if (progressBars.get(lId) != null) // { - // progressPanel = (JPanel) progressBars.get(new Long(id)); + // progressPanel = (JPanel) progressBars.get(Long.valueOf(id)); // statusPanel.remove(progressPanel); // progressBars.remove(lId); // progressPanel = null; @@ -644,13 +644,13 @@ public class PCAPanel extends GPCAPanel final IProgressIndicatorHandler handler) { progressBar.registerHandler(id, handler); - // if (progressBarHandlers == null || !progressBars.contains(new Long(id))) + // if (progressBarHandlers == null || !progressBars.contains(Long.valueOf(id))) // { // throw new // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler")); // } - // progressBarHandlers.put(new Long(id), handler); - // final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); + // progressBarHandlers.put(Long.valueOf(id), handler); + // final JPanel progressPanel = (JPanel) progressBars.get(Long.valueOf(id)); // if (handler.canCancel()) // { // JButton cancel = new JButton( diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index dc0cdb4..561fb3c 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -630,7 +630,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, int yDelta = yPos - mouseY; // Check if this is a rectangle drawing drag - if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) + if ((evt.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) { // rectx2 = evt.getX(); // recty2 = evt.getY(); diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index a0d31cf..98a8251 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -412,7 +412,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI * Ctrl-W / Cmd-W - close view or window */ KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); action = new AbstractAction() { @Override @@ -433,7 +433,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI * Ctrl-T / Cmd-T open new view */ KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); AbstractAction action = new AbstractAction() { @Override @@ -773,7 +773,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI * Ctrl-F / Cmd-F open Finder dialog, 'focused' on the right alignment */ KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); AbstractAction action = new AbstractAction() { @Override diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index 850ef21..5186a26 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -123,7 +123,7 @@ public class WsPreferences extends GWsPreferences for (String url : wsUrls) { int status = Jws2Discoverer.getDiscoverer().getServerStatusFor(url); - tdat[r][1] = new Integer(status); + tdat[r][1] = Integer.valueOf(status); tdat[r++][0] = url; } diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index dd385d2..86b4402 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -274,7 +274,7 @@ public class AnnotationFile if (row.graphGroup > -1) { graphGroupSeen.set(row.graphGroup); - Integer key = new Integer(row.graphGroup); + Integer key = Integer.valueOf(row.graphGroup); if (graphGroup.containsKey(key)) { graphGroup.put(key, graphGroup.get(key) + "\t" + row.label); @@ -762,7 +762,7 @@ public class AnnotationFile autoAnnotsKey(aa[aai], aa[aai].sequenceRef, (aa[aai].groupRef == null ? null : aa[aai].groupRef.getName())), - new Integer(1)); + Integer.valueOf(1)); } } } @@ -1271,7 +1271,7 @@ public class AnnotationFile { displayChar = token; // foo - value = new Float(token).floatValue(); + value = Float.valueOf(token).floatValue(); parsedValue = true; continue; } catch (NumberFormatException ex) diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 12ad0d4..70f2ac7 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -441,7 +441,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI float score = Float.NaN; try { - score = new Float(gffColumns[6]).floatValue(); + score = Float.valueOf(gffColumns[6]).floatValue(); } catch (NumberFormatException ex) { sf = new SequenceFeature(ft, desc, startPos, endPos, featureGroup); diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java index 026c879..6732e82 100755 --- a/src/jalview/io/JPredFile.java +++ b/src/jalview/io/JPredFile.java @@ -207,7 +207,7 @@ public class JPredFile extends AlignFile { ascore = symbols.nextToken(); - Float score = new Float(ascore); + Float score = Float.valueOf(ascore); scores.addElement(score); } @@ -283,7 +283,7 @@ public class JPredFile extends AlignFile seq_entries.addElement(newseq.toString()); ids.addElement(id); - Symscores.put(id, new Integer(ids.size() - 1)); + Symscores.put(id, Integer.valueOf(ids.size() - 1)); } } } diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java index c9f1fcf..6828202 100755 --- a/src/jalview/io/JnetAnnotationMaker.java +++ b/src/jalview/io/JnetAnnotationMaker.java @@ -148,7 +148,7 @@ public class JnetAnnotationMaker { for (int j = 0; j < width; j++) { - float value = new Float(preds[i].getCharAt(j) + "") + float value = Float.valueOf(preds[i].getCharAt(j) + "") .floatValue(); annotations[gapmap[j]] = new Annotation( preds[i].getCharAt(j) + "", "", @@ -159,7 +159,7 @@ public class JnetAnnotationMaker { for (int j = 0; j < width; j++) { - float value = new Float(preds[i].getCharAt(j) + "") + float value = Float.valueOf(preds[i].getCharAt(j) + "") .floatValue(); annotations[gapmap[delMap[j]]] = new Annotation( preds[i].getCharAt(j) + "", "", diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java index 442278d..c1849fc 100755 --- a/src/jalview/io/ModellerDescription.java +++ b/src/jalview/io/ModellerDescription.java @@ -85,7 +85,7 @@ public class ModellerDescription resCode(int v) { - val = new Integer(v); + val = Integer.valueOf(v); field = val.toString(); } }; diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index c414145..2221f00 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -477,7 +477,7 @@ public class NewickFile extends FileParse { try { - bootstrap = (new Integer(nbootstrap.stringMatched(1))) + bootstrap = (Integer.valueOf(nbootstrap.stringMatched(1))) .intValue(); HasBootstrap = true; } catch (Exception e) @@ -494,7 +494,7 @@ public class NewickFile extends FileParse { try { - distance = (new Float(ndist.stringMatched(1))).floatValue(); + distance = (Float.valueOf(ndist.stringMatched(1))).floatValue(); HasDistances = true; nodehasdistance = true; } catch (Exception e) @@ -661,7 +661,7 @@ public class NewickFile extends FileParse if (code.toLowerCase().equals("b")) { int v = -1; - Float iv = new Float(value); + Float iv = Float.valueOf(value); v = iv.intValue(); // jalview only does integer bootstraps // currently c.setBootstrap(v); diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index adf4447..387dbfa 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -2248,7 +2248,7 @@ public class VamsasAppDatastore Float val = null; try { - val = new Float(props[p].getContent()); + val = Float.valueOf(props[p].getContent()); } catch (Exception e) { Cache.log.warn("Failed to parse threshold property"); @@ -2537,7 +2537,7 @@ public class VamsasAppDatastore int se_end = se[1 - se[2]] + (se[2] == 0 ? 1 : -1); for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1) { - posList.add(new Integer(p)); + posList.add(Integer.valueOf(p)); } } } @@ -2548,7 +2548,7 @@ public class VamsasAppDatastore for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) { pos = dseta.getPos(p).getI(); - posList.add(new Integer(pos)); + posList.add(Integer.valueOf(pos)); } } } diff --git a/src/jalview/io/vamsas/Rangetype.java b/src/jalview/io/vamsas/Rangetype.java index ee4fa83..b4580f0 100644 --- a/src/jalview/io/vamsas/Rangetype.java +++ b/src/jalview/io/vamsas/Rangetype.java @@ -148,7 +148,7 @@ public abstract class Rangetype extends DatastoreItem int se_end = se[1 - se[2]] + (se[2] == 0 ? 1 : -1); for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1) { - posList.add(new Integer(p)); + posList.add(Integer.valueOf(p)); } } } @@ -159,7 +159,7 @@ public abstract class Rangetype extends DatastoreItem for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) { pos = dseta.getPos(p).getI(); - posList.add(new Integer(pos)); + posList.add(Integer.valueOf(pos)); } } } @@ -193,8 +193,8 @@ public abstract class Rangetype extends DatastoreItem for (int s = 0, sSize = range.getSegCount(); s < sSize; s++) { se = getSegRange(range.getSeg(s), false); - posList.addElement(new Integer(se[0])); - posList.addElement(new Integer(se[1])); + posList.addElement(Integer.valueOf(se[0])); + posList.addElement(Integer.valueOf(se[1])); } } else if (range.getPosCount() > 0) @@ -204,8 +204,8 @@ public abstract class Rangetype extends DatastoreItem for (int p = 0, pSize = range.getPosCount(); p < pSize; p++) { pos = range.getPos(p).getI(); - posList.add(new Integer(pos)); - posList.add(new Integer(pos)); + posList.add(Integer.valueOf(pos)); + posList.add(Integer.valueOf(pos)); } } } diff --git a/src/jalview/io/vamsas/Sequencefeature.java b/src/jalview/io/vamsas/Sequencefeature.java index 74f73d4..f8d86d5 100644 --- a/src/jalview/io/vamsas/Sequencefeature.java +++ b/src/jalview/io/vamsas/Sequencefeature.java @@ -351,7 +351,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Boolean(p.getContent()); + val = Boolean.valueOf(p.getContent()); } catch (Exception e) { } @@ -360,7 +360,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Float(p.getContent()); + val = Float.valueOf(p.getContent()); } catch (Exception e) { @@ -370,7 +370,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Integer(p.getContent()); + val = Integer.valueOf(p.getContent()); } catch (Exception e) { } diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java index aa130cc..9c1f5ea 100644 --- a/src/jalview/io/vamsas/Tree.java +++ b/src/jalview/io/vamsas/Tree.java @@ -443,7 +443,7 @@ public class Tree extends DatastoreItem Integer nindx = (Integer) nodespecs.get(nname); if (nindx == null) { - nindx = new Integer(1); + nindx = Integer.valueOf(1); } nname = nindx.toString() + " " + nname; return nname; @@ -465,7 +465,7 @@ public class Tree extends DatastoreItem String oval = nodespec.substring(0, nodespec.indexOf(' ')); try { - occurence = new Integer(oval).intValue(); + occurence = Integer.valueOf(oval).intValue(); } catch (Exception e) { System.err.println("Invalid nodespec '" + nodespec + "'"); diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 9f41c92..ff15070 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -266,14 +266,14 @@ public class GAlignFrame extends JInternalFrame // FIXME getDefaultToolkit throws an exception in Headless mode KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + | KeyEvent.SHIFT_DOWN_MASK, false); addMenuActionAndAccelerator(keyStroke, saveAs, al); closeMenuItem.setText(MessageManager.getString("action.close")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -296,7 +296,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem selectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.select_all")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -323,7 +323,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem invertSequenceMenuItem = new JMenuItem( MessageManager.getString("action.invert_sequence_selection")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -359,7 +359,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem remove2LeftMenuItem = new JMenuItem( MessageManager.getString("action.remove_left")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -373,7 +373,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem remove2RightMenuItem = new JMenuItem( MessageManager.getString("action.remove_right")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -387,7 +387,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeGappedColumnMenuItem = new JMenuItem( MessageManager.getString("action.remove_empty_columns")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -401,8 +401,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeAllGapsMenuItem = new JMenuItem( MessageManager.getString("action.remove_all_gaps")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + | KeyEvent.SHIFT_DOWN_MASK, false); al = new ActionListener() { @@ -509,7 +509,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem removeRedundancyMenuItem = new JMenuItem( MessageManager.getString("action.remove_redundancy")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -684,7 +684,7 @@ public class GAlignFrame extends JInternalFrame undoMenuItem.setEnabled(false); undoMenuItem.setText(MessageManager.getString("action.undo")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -698,7 +698,7 @@ public class GAlignFrame extends JInternalFrame redoMenuItem.setEnabled(false); redoMenuItem.setText(MessageManager.getString("action.redo")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -722,7 +722,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem printMenuItem = new JMenuItem( MessageManager.getString("action.print")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -748,7 +748,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem findMenuItem = new JMenuItem( MessageManager.getString("action.find")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.find_tip"))); al = new ActionListener() @@ -909,7 +909,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem deleteGroups = new JMenuItem( MessageManager.getString("action.undefine_groups")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -934,7 +934,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem createGroup = new JMenuItem( MessageManager.getString("action.create_group")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -948,8 +948,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem unGroup = new JMenuItem( MessageManager.getString("action.remove_group")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + | KeyEvent.SHIFT_DOWN_MASK, false); al = new ActionListener() { @@ -963,7 +963,7 @@ public class GAlignFrame extends JInternalFrame copy.setText(MessageManager.getString("action.copy")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @@ -977,7 +977,7 @@ public class GAlignFrame extends JInternalFrame cut.setText(MessageManager.getString("action.cut")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -1003,8 +1003,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem pasteNew = new JMenuItem( MessageManager.getString("label.to_new_alignment")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.SHIFT_MASK, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + | KeyEvent.SHIFT_DOWN_MASK, false); al = new ActionListener() { @@ -1019,7 +1019,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem pasteThis = new JMenuItem( MessageManager.getString("label.to_this_alignment")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -1531,8 +1531,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem invertColSel = new JMenuItem( MessageManager.getString("action.invert_column_selection")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() - | KeyEvent.ALT_MASK, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + | KeyEvent.ALT_DOWN_MASK, false); al = new ActionListener() { @@ -1595,7 +1595,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem save = new JMenuItem(MessageManager.getString("action.save")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override @@ -1620,7 +1620,7 @@ public class GAlignFrame extends JInternalFrame JMenuItem newView = new JMenuItem( MessageManager.getString("action.new_view")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false); al = new ActionListener() { @Override diff --git a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java index a6e0ace..389a030 100644 --- a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java @@ -136,11 +136,11 @@ public class GCutAndPasteHtmlTransfer extends JInternalFrame }); close.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_W, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); selectAll.setText(MessageManager.getString("action.select_all")); selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_A, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); selectAll.addActionListener(new ActionListener() { @Override @@ -153,7 +153,7 @@ public class GCutAndPasteHtmlTransfer extends JInternalFrame save.setText(MessageManager.getString("action.save")); save.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_S, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); save.addActionListener(new ActionListener() { @Override @@ -164,7 +164,7 @@ public class GCutAndPasteHtmlTransfer extends JInternalFrame }); copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_C, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); editMenubar.add(jMenu1); editMenubar.add(editMenu); diff --git a/src/jalview/jbgui/GCutAndPasteTransfer.java b/src/jalview/jbgui/GCutAndPasteTransfer.java index 97ac840..2e4d733 100755 --- a/src/jalview/jbgui/GCutAndPasteTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteTransfer.java @@ -123,7 +123,7 @@ public class GCutAndPasteTransfer extends JInternalFrame selectAll.setText(MessageManager.getString("action.select_all")); selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_A, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); selectAll.addActionListener(new ActionListener() { @Override @@ -136,7 +136,7 @@ public class GCutAndPasteTransfer extends JInternalFrame save.setText(MessageManager.getString("action.save")); save.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_S, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); save.addActionListener(new ActionListener() { @Override @@ -147,10 +147,10 @@ public class GCutAndPasteTransfer extends JInternalFrame }); copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_C, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_V, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); editMenubar.add(jMenu1); editMenubar.add(editMenu); textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12)); diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index c26946c..0d075cf 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -161,7 +161,7 @@ public class GDesktop extends JFrame .setText(MessageManager.getString("label.load_tree_from_file")); inputLocalFileMenuItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(), false)); inputLocalFileMenuItem .addActionListener(new java.awt.event.ActionListener() diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 02b405e..2aefd81 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -5113,7 +5113,7 @@ public class Jalview2XML } else { - featureOrder.put(featureType, new Float( + featureOrder.put(featureType, Float.valueOf( fs / jm.getFeatureSettings().getSetting().size())); } if (safeBoolean(setting.isDisplay())) @@ -5125,7 +5125,7 @@ public class Jalview2XML for (int gs = 0; gs < jm.getFeatureSettings().getGroup().size(); gs++) { Group grp = jm.getFeatureSettings().getGroup().get(gs); - fgtable.put(grp.getName(), new Boolean(grp.isDisplay())); + fgtable.put(grp.getName(), Boolean.valueOf(grp.isDisplay())); } // FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, // fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ? diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 6483b85..0d36f4f 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -323,7 +323,7 @@ public class FeatureColour implements FeatureColourI { if (minval.length() > 0) { - min = new Float(minval).floatValue(); + min = Float.valueOf(minval).floatValue(); } } catch (Exception e) { @@ -335,7 +335,7 @@ public class FeatureColour implements FeatureColourI { if (maxval.length() > 0) { - max = new Float(maxval).floatValue(); + max = Float.valueOf(maxval).floatValue(); } } catch (Exception e) { @@ -403,7 +403,7 @@ public class FeatureColour implements FeatureColourI { gcol.nextToken(); tval = gcol.nextToken(); - featureColour.setThreshold(new Float(tval).floatValue()); + featureColour.setThreshold(Float.valueOf(tval).floatValue()); } catch (Exception e) { System.err.println("Couldn't parse threshold value as a float: (" diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 4625055..1be6086 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -140,7 +140,7 @@ public class Platform { return false; } - return (Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() // .getMenuShortcutKeyMask() + return (Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() // .getMenuShortcutKeyMaskEx() & e.getModifiersEx()) != 0; // getModifiers()) != 0; } return e.isControlDown(); diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 4af6fde..17f9362 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -652,7 +652,7 @@ public abstract class FeatureRendererModel { featureOrder = new Hashtable<>(); } - featureOrder.put(type, new Float(position)); + featureOrder.put(type, Float.valueOf(position)); return position; } @@ -852,7 +852,7 @@ public abstract class FeatureRendererModel } if (newGroupsVisible) { - featureGroups.put(group, new Boolean(true)); + featureGroups.put(group, Boolean.valueOf(true)); return true; } return false; @@ -888,7 +888,7 @@ public abstract class FeatureRendererModel @Override public void setGroupVisibility(String group, boolean visible) { - featureGroups.put(group, new Boolean(visible)); + featureGroups.put(group, Boolean.valueOf(visible)); } @Override @@ -900,7 +900,7 @@ public abstract class FeatureRendererModel for (String gst : toset) { Boolean st = featureGroups.get(gst); - featureGroups.put(gst, new Boolean(visible)); + featureGroups.put(gst, Boolean.valueOf(visible)); if (st != null) { rdrw = rdrw || (visible != st.booleanValue()); diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index 80c9ce9..f9e597f 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -237,7 +237,7 @@ public class RNAalifoldClient extends JabawsCalcWorker // The Score objects contain a set of size one containing the range and // an ArrayList of size one containing the probabilty basePairs.put(score.getRanges().first(), - new Float(score.getScores().get(0))); + Float.valueOf(score.getScores().get(0))); } for (int i = 0, ri = 0, iEnd = struct.length(); i < iEnd; i++, ri++) diff --git a/src/uk/ac/ebi/www/InputParams.java b/src/uk/ac/ebi/www/InputParams.java index fe1c70c..ba8f8b0 100755 --- a/src/uk/ac/ebi/www/InputParams.java +++ b/src/uk/ac/ebi/www/InputParams.java @@ -296,8 +296,8 @@ public class InputParams implements java.io.Serializable { _hashCode += getMatrix().hashCode(); } - _hashCode += new Float(getExp()).hashCode(); - _hashCode += new Boolean(isEchofilter()).hashCode(); + _hashCode += Float.valueOf(getExp()).hashCode(); + _hashCode += Boolean.valueOf(isEchofilter()).hashCode(); if (getFilter() != null) { _hashCode += getFilter().hashCode(); @@ -325,7 +325,7 @@ public class InputParams implements java.io.Serializable _hashCode += getOutformat().hashCode(); } _hashCode += getTopcombon(); - _hashCode += new Boolean(isAsync()).hashCode(); + _hashCode += Boolean.valueOf(isAsync()).hashCode(); if (getEmail() != null) { _hashCode += getEmail().hashCode(); diff --git a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java index 5391221..f06a80a 100644 --- a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java +++ b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java @@ -285,7 +285,7 @@ public class AccessionMapperBindingStub extends org.apache.axis.client.Stub setAttachments(_call); java.lang.Object _resp = _call.invoke(new java.lang.Object[] { sequence, searchDatabases, taxonId, - new java.lang.Boolean(onlyActive) }); + java.lang.Boolean.valueOf(onlyActive) }); if (_resp instanceof java.rmi.RemoteException) { @@ -332,7 +332,7 @@ public class AccessionMapperBindingStub extends org.apache.axis.client.Stub setAttachments(_call); java.lang.Object _resp = _call.invoke(new java.lang.Object[] { accession, ac_version, searchDatabases, taxonId, - new java.lang.Boolean(onlyActive) }); + java.lang.Boolean.valueOf(onlyActive) }); if (_resp instanceof java.rmi.RemoteException) { diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 2dda4d3..aefcbc0 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -103,8 +103,8 @@ public class ColumnSelectionTest cs.removeElement(1); List sel = cs.getSelected(); assertEquals(2, sel.size()); - assertEquals(new Integer(2), sel.get(0)); - assertEquals(new Integer(5), sel.get(1)); + assertEquals(Integer.valueOf(2), sel.get(0)); + assertEquals(Integer.valueOf(5), sel.get(1)); // removing an element in the list removes it cs.removeElement(2); @@ -112,7 +112,7 @@ public class ColumnSelectionTest assertEquals(1, sel.size()); sel = cs.getSelected(); assertEquals(1, sel.size()); - assertEquals(new Integer(5), sel.get(0)); + assertEquals(Integer.valueOf(5), sel.get(0)); } /** diff --git a/test/jalview/datamodel/SequenceFeatureTest.java b/test/jalview/datamodel/SequenceFeatureTest.java index c955979..9111e5a 100644 --- a/test/jalview/datamodel/SequenceFeatureTest.java +++ b/test/jalview/datamodel/SequenceFeatureTest.java @@ -48,7 +48,7 @@ public class SequenceFeatureTest 12.5f, "group"); sf1.setValue("STRAND", "+"); sf1.setValue("Note", "Testing"); - Integer count = new Integer(7); + Integer count = Integer.valueOf(7); sf1.setValue("Count", count); SequenceFeature sf2 = new SequenceFeature(sf1); @@ -106,7 +106,7 @@ public class SequenceFeatureTest assertEquals("+", sf1.getValue("STRAND")); assertNull(sf1.getValue("strand")); // case-sensitive assertEquals(".", sf1.getValue("unknown", ".")); - Integer i = new Integer(27); + Integer i = Integer.valueOf(27); assertSame(i, sf1.getValue("Unknown", i)); } diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index 0d49936..bdbc3c9 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -40,8 +40,7 @@ import jalview.io.DataSourceType; import jalview.io.FileLoader; import jalview.util.MessageManager; -import java.awt.Event; -import java.awt.EventQueue; +import java.awt.event.InputEvent;import java.awt.EventQueue; import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; @@ -241,7 +240,7 @@ public class SeqPanelTest /* * mouse at top left of unwrapped panel */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); @@ -286,7 +285,7 @@ public class SeqPanelTest * mouse at top left of wrapped panel; there is a gap of charHeight * above the alignment */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); @@ -297,7 +296,7 @@ public class SeqPanelTest * cursor at bottom of gap above */ y = charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -307,7 +306,7 @@ public class SeqPanelTest * cursor over top of first sequence */ y = charHeight; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -317,7 +316,7 @@ public class SeqPanelTest * cursor at bottom of first sequence */ y = 2 * charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -327,7 +326,7 @@ public class SeqPanelTest * cursor at top of second sequence */ y = 2 * charHeight; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 1); @@ -337,7 +336,7 @@ public class SeqPanelTest * cursor at bottom of second sequence */ y = 3 * charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 1); @@ -347,7 +346,7 @@ public class SeqPanelTest * cursor at bottom of last sequence */ y = charHeight * (1 + alignmentHeight) - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -358,7 +357,7 @@ public class SeqPanelTest * method reports index of nearest sequence above */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -368,7 +367,7 @@ public class SeqPanelTest * cursor still in the gap above annotations, now at the bottom of it */ y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2 - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -382,7 +381,7 @@ public class SeqPanelTest * cursor at the top of the n'th annotation */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -392,7 +391,7 @@ public class SeqPanelTest * cursor at the bottom of the n'th annotation */ y += annotationRows[n].height - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -403,7 +402,7 @@ public class SeqPanelTest * cursor in gap between wrapped widths */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -413,7 +412,7 @@ public class SeqPanelTest * cursor at bottom of gap between wrapped widths */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -423,7 +422,7 @@ public class SeqPanelTest * cursor at top of first sequence, second wrapped width */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -461,7 +460,7 @@ public class SeqPanelTest * mouse at top left of wrapped panel; there is a gap of charHeight * above the alignment */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); @@ -473,7 +472,7 @@ public class SeqPanelTest * two charHeights including scale panel */ y = 2 * charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -483,7 +482,7 @@ public class SeqPanelTest * cursor over top of first sequence */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -493,7 +492,7 @@ public class SeqPanelTest * cursor at bottom of first sequence */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -503,7 +502,7 @@ public class SeqPanelTest * cursor at top of second sequence */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 1); @@ -513,7 +512,7 @@ public class SeqPanelTest * cursor at bottom of second sequence */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 1); @@ -524,7 +523,7 @@ public class SeqPanelTest * (scale + gap + sequences) */ y = charHeight * (2 + alignmentHeight) - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -534,7 +533,7 @@ public class SeqPanelTest * cursor below sequences, in 3-pixel gap above annotations */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -545,7 +544,7 @@ public class SeqPanelTest * method reports index of nearest sequence above */ y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2 - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -558,7 +557,7 @@ public class SeqPanelTest * cursor at the top of the n'th annotation */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -568,7 +567,7 @@ public class SeqPanelTest * cursor at the bottom of the n'th annotation */ y += annotationRows[n].height - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -579,7 +578,7 @@ public class SeqPanelTest * cursor in gap between wrapped widths */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -589,7 +588,7 @@ public class SeqPanelTest * cursor at bottom of gap between wrapped widths */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -599,7 +598,7 @@ public class SeqPanelTest * cursor at top of scale, second wrapped width */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -609,7 +608,7 @@ public class SeqPanelTest * cursor at bottom of scale, second wrapped width */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -619,7 +618,7 @@ public class SeqPanelTest * cursor at top of first sequence, second wrapped width */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -657,7 +656,7 @@ public class SeqPanelTest * mouse at top left of wrapped panel; there is a gap of charHeight * above the alignment */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); @@ -668,7 +667,7 @@ public class SeqPanelTest * cursor over top of first sequence */ y = charHeight; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -678,7 +677,7 @@ public class SeqPanelTest * cursor at bottom of last sequence */ y = charHeight * (1 + alignmentHeight) - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, alignmentHeight - 1); @@ -688,7 +687,7 @@ public class SeqPanelTest * cursor below sequences, at top of charHeight gap between widths */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -698,7 +697,7 @@ public class SeqPanelTest * cursor below sequences, at top of charHeight gap between widths */ y += charHeight - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, -1); @@ -708,7 +707,7 @@ public class SeqPanelTest * cursor at the top of the first sequence, second width */ y += 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0, false, 0); pos = testee.findMousePosition(evt); assertEquals(pos.seqIndex, 0); @@ -730,7 +729,7 @@ public class SeqPanelTest /* * mouse at top left of unwrapped panel */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 0); @@ -738,7 +737,7 @@ public class SeqPanelTest * not quite one charWidth across */ x = charWidth-1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 0); @@ -746,7 +745,7 @@ public class SeqPanelTest * one charWidth across */ x = charWidth; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 1); @@ -754,7 +753,7 @@ public class SeqPanelTest * two charWidths across */ x = 2 * charWidth; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 2); @@ -762,7 +761,7 @@ public class SeqPanelTest * limited to last column of seqcanvas */ x = 20000; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas; int w = seqCanvas.getWidth(); @@ -776,7 +775,7 @@ public class SeqPanelTest alignFrame.getViewport().hideColumns(4, 9); x = 5 * charWidth + 2; // x is in 6th visible column, absolute column 12, or 11 base 0 - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 11); } @@ -803,7 +802,7 @@ public class SeqPanelTest /* * mouse at top left of wrapped panel, no West (left) scale */ - MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, + MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 0); @@ -811,7 +810,7 @@ public class SeqPanelTest * not quite one charWidth across */ x = charWidth-1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 0); @@ -819,7 +818,7 @@ public class SeqPanelTest * one charWidth across */ x = charWidth; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 1); @@ -833,12 +832,12 @@ public class SeqPanelTest int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest"); assertTrue(labelWidth > 0); x = labelWidth - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), -1); x = labelWidth; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), 0); @@ -848,7 +847,7 @@ public class SeqPanelTest int residuesWide = av.getRanges().getViewportWidth(); assertTrue(residuesWide > 0); x = labelWidth + charWidth * residuesWide - 1; - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), residuesWide - 1); @@ -864,7 +863,7 @@ public class SeqPanelTest assertTrue(residuesWide2 > 0); assertTrue(residuesWide2 < residuesWide); // available width reduced x += 1; // just over left edge of scale right - evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, + evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0, false, 0); assertEquals(testee.findColumn(evt), -1); diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index e86c8ad..ba4312a 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -257,8 +257,8 @@ public class StockholmFileTest assertEquals("Threshold line not identical.", aa_original[i].threshold, aa_new[i].threshold); // graphGroup may differ, but pattern should be the same - Integer o_ggrp = new Integer(aa_original[i].graphGroup + 2); - Integer n_ggrp = new Integer(aa_new[i].graphGroup + 2); + Integer o_ggrp = Integer.valueOf(aa_original[i].graphGroup + 2); + Integer n_ggrp = Integer.valueOf(aa_new[i].graphGroup + 2); BitSet orig_g = orig_groups.get(o_ggrp); BitSet new_g = new_groups.get(n_ggrp); if (orig_g == null) diff --git a/utils/deprecation_auto_fixes.sh b/utils/deprecation_auto_fixes.sh new file mode 100644 index 0000000..27a6319 --- /dev/null +++ b/utils/deprecation_auto_fixes.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +TYPES="Boolean|Character|Double|Float|Long|Integer" find src test -type f -name "*.java" -exec perl -p -i -e 's/\bnew\s+(java\.lang\.)?($ENV{TYPES})\(/${1}${2}.valueOf(/;' {} + + +find src test -type f -name "*.java" -exec perl -p -i -e 's/(InputEvent|KeyEvent)\s*\.\s*([A-Z0-9]+)_MASK\b/${1}.${2}_DOWN_MASK/g;' {} + + +find src test -type f -name "*.java" -exec perl -p -i -e 's/\b(e|evt)\.getModifiers\b/${1}.getModifiersEx/g;' {} + + +find src test -type f -name "*.java" -exec perl -p -i -e 's/\.getMenuShortcutKeyMask\b/\.getMenuShortcutKeyMaskEx/g;' {} + + +# +find src test -type f -name "*.java" -exec perl -p -i -e 'if ( s/^\s*import\s+java\.awt\.Event\s*;\s*$/import java.awt.event.InputEvent;/ ) { $event = 1 }; if ($event == 1) { s/\b(java\.awt\.)?Event\s*\.\s*([A-Z0-9]+)_MASK\b/InputEvent.${2}_DOWN_MASK/g; s/\b(java\.awt\.)?Event\s*\.\s*(MOUSE_MOVE)/MouseEvent.MOUSE_MOVED/g }' {} + -- 1.7.10.2