Changeset 35667 for main


Ignore:
Timestamp:
2021-10-22T14:38:34+13:00 (3 years ago)
Author:
davidb
Message:

Some notes on how to address deprecated warnings added

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gems/MetadataSetTree.java

    r18412 r35667  
    107107    public void mouseReleased(MouseEvent event) { }
    108108
     109
     110    // Observer/Obserable became deprecated in JDK9 onwards, although with no set date for removal.
     111    // If looking to replace use of Observer/Obserable, then using java.bean.PropertyChangeLister
     112    // and PropertyChangeEvent is (StackOverflow) cited go to.
     113    // For a worked example comparing the two different approaches, see:
     114    //
     115    //   https://gist.github.com/mtorchiano/e69ac7e309fee81bd17f4f0740b9ffa9
     116    //   Replacing Observer-Observable (inheritance vs. composition)
     117   
    109118    public void update(Observable o,Object arg){
    110119        if (arg !=null){
  • main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java

    r34288 r35667  
    589589    public void keyPressed(KeyEvent key_event)
    590590    {
     591        // **** getModifiers() in InputEvent has been deprecated 
     592        //   Oracle directs you to use getModifiersEx() which is an extended version that
     593        //   has been more carefully constructed.
     594        //
     595
     596        //  int onmask = SHIFT_DOWN_MASK | BUTTON1_DOWN_MASK;
     597        //  int offmask = CTRL_DOWN_MASK;
     598        //  if ((event.getModifiersEx() & (onmask | offmask)) == onmask) {
     599        //    // ...
     600        //  }
     601
     602        // The above code excerpt is from:
     603        //   https://docs.oracle.com/javase/10/docs/api/java/awt/event/InputEvent.html
     604        //
     605        // In working through changes to avoid using this deprecated call, as similar
     606        // change from using getMenuShortcutKeyMask() to getMenuShortcutKeyMaskEx()
     607        // will be needed.
     608       
     609       
    591610        // Don't hardcode check for Ctrl key "(e.getModifiers() & KeyEvent.CTRL_MASK) != 0)"
    592611        // because Mac uses another modifier key, Command-F instead of Ctrl-F.
  • main/trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java

    r34241 r35667  
    936936        try
    937937        {
     938            // OutputFormat() and XMLSerlalizer() have been deprecated
     939            // StackOverflow suggested alternative is to use LSSerializer class from the package org.w3c.dom.ls
     940            // Some example code doing this at:
     941            // https://stackoverflow.com/questions/55729019/xmlserializer-outputformat-deprecated
     942           
    938943            OutputStream os = new FileOutputStream(xml_file);
    939944            // Create an output format for our document.
Note: See TracChangeset for help on using the changeset viewer.