This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xerces-j.git


The following commit(s) were added to refs/heads/main by this push:
     new 52b6b1709 update code to use typed collections and generics (#2)
52b6b1709 is described below

commit 52b6b1709b0f5f69ce76f71cd2fb10fcbca89e70
Author: Samael <[email protected]>
AuthorDate: Thu Nov 20 11:41:30 2025 +0000

    update code to use typed collections and generics (#2)
    
    * fix some deprecations and start using generics properly
    
    more type info for collections
    
    Remove type from some constructor args
    
    undo unnecessary changes
    
    undo unnecessary changes
    
    undo unnecessary changes
    
    undo unnecessary changes
    
    * undo unnecessary changes
    
    * undo unnecessary imports of List
---
 samples/xni/SecuritySupport.java                   |  70 +++++-------
 src/org/apache/html/dom/SecuritySupport.java       |  70 +++++-------
 src/org/apache/xerces/dom/AttributeMap.java        |  10 +-
 .../apache/xerces/dom/DOMConfigurationImpl.java    |  13 ++-
 .../xerces/dom/DOMImplementationListImpl.java      |  19 ++--
 .../xerces/dom/DOMImplementationSourceImpl.java    |   2 +-
 src/org/apache/xerces/dom/DOMNormalizer.java       |   3 +-
 src/org/apache/xerces/dom/DOMStringListImpl.java   |  11 +-
 .../xerces/dom/DOMXSImplementationSourceImpl.java  |   2 +-
 src/org/apache/xerces/dom/DeepNodeListImpl.java    |   8 +-
 src/org/apache/xerces/dom/DocumentImpl.java        | 125 ++++++++++++---------
 src/org/apache/xerces/dom/NamedNodeMapImpl.java    |  31 ++---
 src/org/apache/xerces/dom/RangeImpl.java           |  23 ++--
 src/org/apache/xerces/dom/SecuritySupport.java     |  70 +++++-------
 src/org/apache/xerces/impl/dtd/DTDGrammar.java     |   3 +-
 .../apache/xerces/impl/dtd/XMLDTDDescription.java  |  12 +-
 src/org/apache/xerces/impl/dv/SecuritySupport.java |  70 +++++-------
 .../apache/xerces/impl/xpath/XPathException.java   |   5 +-
 src/org/apache/xerces/impl/xs/SchemaGrammar.java   |  51 ++++++---
 src/org/apache/xerces/impl/xs/XMLSchemaLoader.java |  52 ++++++---
 .../apache/xerces/impl/xs/XMLSchemaValidator.java  |  37 +++---
 .../xerces/impl/xs/traversers/XSDHandler.java      |  33 +++---
 .../xerces/impl/xs/util/LSInputListImpl.java       |   9 +-
 .../apache/xerces/impl/xs/util/ObjectListImpl.java |   8 +-
 .../apache/xerces/impl/xs/util/ShortListImpl.java  |  11 +-
 .../apache/xerces/impl/xs/util/SimpleLocator.java  |  25 +++--
 .../apache/xerces/impl/xs/util/XSGrammarPool.java  |   4 +-
 .../jaxp/validation/StAXValidatorHelper.java       |   2 +-
 .../xerces/parsers/BasicParserConfiguration.java   |   5 +-
 src/org/apache/xerces/parsers/SecuritySupport.java |  70 +++++-------
 .../apache/xerces/parsers/XML11Configuration.java  |  40 ++++---
 .../xerces/parsers/XML11DTDConfiguration.java      |  35 ++++--
 .../parsers/XML11NonValidatingConfiguration.java   |  35 ++++--
 src/org/apache/xerces/util/DOMUtil.java            |  25 +++--
 .../xerces/util/JAXPNamespaceContextWrapper.java   |  27 ++++-
 .../xerces/util/ParserConfigurationSettings.java   |  22 ++--
 .../apache/xerces/xinclude/SecuritySupport.java    |  70 +++++-------
 .../apache/xml/serialize/DOMSerializerImpl.java    |   2 +-
 src/org/apache/xml/serialize/SecuritySupport.java  |  70 +++++-------
 tests/dom/DTest.java                               |   4 +-
 40 files changed, 623 insertions(+), 561 deletions(-)

diff --git a/samples/xni/SecuritySupport.java b/samples/xni/SecuritySupport.java
index 77dd4efdb..b814233e0 100644
--- a/samples/xni/SecuritySupport.java
+++ b/samples/xni/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return new Long(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/html/dom/SecuritySupport.java 
b/src/org/apache/html/dom/SecuritySupport.java
index 0db0e8bf6..1d3069f77 100644
--- a/src/org/apache/html/dom/SecuritySupport.java
+++ b/src/org/apache/html/dom/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/xerces/dom/AttributeMap.java 
b/src/org/apache/xerces/dom/AttributeMap.java
index 443613362..16cc27637 100644
--- a/src/org/apache/xerces/dom/AttributeMap.java
+++ b/src/org/apache/xerces/dom/AttributeMap.java
@@ -71,7 +71,7 @@ public class AttributeMap extends NamedNodeMapImpl {
      */
     public Node setNamedItem(Node arg)
     throws DOMException {
-        
+
         boolean errCheck = ownerNode.ownerDocument().errorChecking;
         if (errCheck) {
             if (isReadOnly()) {
@@ -141,7 +141,7 @@ public class AttributeMap extends NamedNodeMapImpl {
      */
     public Node setNamedItemNS(Node arg)
     throws DOMException {
-        
+
         boolean errCheck = ownerNode.ownerDocument().errorChecking;
         if (errCheck) { 
             if (isReadOnly()) {
@@ -472,7 +472,7 @@ public class AttributeMap extends NamedNodeMapImpl {
      * Cloning a NamedNodeMap is a DEEP OPERATION; it always clones
      * all the nodes contained in the map.
      */
-     
+
     public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) {
         AttributeMap newmap =
             new AttributeMap((ElementImpl) ownerNode, null);
@@ -485,12 +485,12 @@ public class AttributeMap extends NamedNodeMapImpl {
      * Override parent's method to set the ownerNode correctly
      */
     protected void cloneContent(NamedNodeMapImpl srcmap) {
-        List srcnodes = srcmap.nodes;
+        List<Node> srcnodes = srcmap.nodes;
         if (srcnodes != null) {
             int size = srcnodes.size();
             if (size != 0) {
                 if (nodes == null) {
-                    nodes = new ArrayList(size);
+                    nodes = new ArrayList<>(size);
                 }
                 else {
                     nodes.clear();
diff --git a/src/org/apache/xerces/dom/DOMConfigurationImpl.java 
b/src/org/apache/xerces/dom/DOMConfigurationImpl.java
index 8058dd709..ac32bd207 100644
--- a/src/org/apache/xerces/dom/DOMConfigurationImpl.java
+++ b/src/org/apache/xerces/dom/DOMConfigurationImpl.java
@@ -20,6 +20,7 @@ package org.apache.xerces.dom;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.StringTokenizer;
 
@@ -228,7 +229,10 @@ public class DOMConfigurationImpl extends 
ParserConfigurationSettings
     /** Symbol table. */
     protected SymbolTable fSymbolTable;
 
-    /** Components. */
+    /**
+     * Components.
+     * @see XMLComponent
+     */
     protected ArrayList fComponents;
 
     protected ValidationManager fValidationManager;
@@ -371,7 +375,7 @@ public class DOMConfigurationImpl extends 
ParserConfigurationSettings
         }
         fSymbolTable = symbolTable;
 
-        fComponents = new ArrayList();
+        fComponents = new ArrayList<XMLComponent>();
 
         setProperty(SYMBOL_TABLE, fSymbolTable);
         fErrorReporter = new XMLErrorReporter();
@@ -766,7 +770,7 @@ public class DOMConfigurationImpl extends 
ParserConfigurationSettings
                             // tokenize location string
                             StringTokenizer t = new 
StringTokenizer(fSchemaLocation, " \n\t\r");
                             if (t.hasMoreTokens()) {
-                                ArrayList locations = new ArrayList();
+                                final List<String> locations = new 
ArrayList<>();
                                 locations.add(t.nextToken());
                                 while (t.hasMoreTokens()) {
                                     locations.add (t.nextToken());
@@ -1051,7 +1055,7 @@ public class DOMConfigurationImpl extends 
ParserConfigurationSettings
      */
        public DOMStringList getParameterNames() {
            if (fRecognizedParameters == null){
-               ArrayList parameters = new ArrayList();
+               ArrayList<String> parameters = new ArrayList<>();
 
                //Add DOM recognized parameters
                //REVISIT: Would have been nice to have a list of
@@ -1087,7 +1091,6 @@ public class DOMConfigurationImpl extends 
ParserConfigurationSettings
                parameters.add(SEND_PSVI);
 
                fRecognizedParameters = new DOMStringListImpl(parameters);
-
            }
 
            return fRecognizedParameters;
diff --git a/src/org/apache/xerces/dom/DOMImplementationListImpl.java 
b/src/org/apache/xerces/dom/DOMImplementationListImpl.java
index ef54e1284..b21bafed5 100644
--- a/src/org/apache/xerces/dom/DOMImplementationListImpl.java
+++ b/src/org/apache/xerces/dom/DOMImplementationListImpl.java
@@ -18,6 +18,7 @@
 package org.apache.xerces.dom;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
 
 import org.w3c.dom.DOMImplementation;
@@ -34,38 +35,38 @@ import org.w3c.dom.DOMImplementationList;
 public class DOMImplementationListImpl implements DOMImplementationList {
 
     // A collection of DOMImplementations
-    private final ArrayList fImplementations;
+    private final List<DOMImplementation> fImplementations;
 
     /**
      * Construct an empty list of DOMImplementations
      */
     public DOMImplementationListImpl() {
-        fImplementations = new ArrayList();
+        fImplementations = new ArrayList<>();
     }
     
     /** 
-     * Construct a list of DOMImplementations from an ArrayList
-     */ 
+     * Construct a list of DOMImplementations from an ArrayList of 
DOMImplementation
+     */
     public DOMImplementationListImpl(ArrayList params) {
         fImplementations = params;    
     }
 
     /** 
-     * Construct a list of DOMImplementations from a Vector
-     */ 
+     * Construct a list of DOMImplementations from a Vector of 
DOMImplementation
+     */
     public DOMImplementationListImpl(Vector params) {
-        fImplementations = new ArrayList(params);
+        fImplementations = new ArrayList<>(params);
     }
 
     /**
      * Returns the indexth item in the collection.
      * 
-     * @param index The index of the DOMImplemetation from the list to return.
+     * @param index the index of the DOMImplementation from the list to return
      */
     public DOMImplementation item(int index) {
         final int length = getLength();
         if (index >= 0 && index < length) {
-            return (DOMImplementation) fImplementations.get(index);
+            return fImplementations.get(index);
         }
         return null;
     }
diff --git a/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java 
b/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
index 883f73ffb..bb2fba50a 100644
--- a/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
+++ b/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java
@@ -78,7 +78,7 @@ public class DOMImplementationSourceImpl
     public DOMImplementationList getDOMImplementationList(String features) {
         // first check whether the CoreDOMImplementation would do
         DOMImplementation impl = 
CoreDOMImplementationImpl.getDOMImplementation();
-        final ArrayList implementations = new ArrayList();
+        final ArrayList<DOMImplementation> implementations = new ArrayList<>();
         if (testImpl(impl, features)) {
             implementations.add(impl);
         }
diff --git a/src/org/apache/xerces/dom/DOMNormalizer.java 
b/src/org/apache/xerces/dom/DOMNormalizer.java
index ab48a579b..ed6250784 100644
--- a/src/org/apache/xerces/dom/DOMNormalizer.java
+++ b/src/org/apache/xerces/dom/DOMNormalizer.java
@@ -138,7 +138,7 @@ public class DOMNormalizer implements XMLDocumentHandler {
     protected final NamespaceContext fLocalNSBinder = new NamespaceSupport();
 
     /** list of attributes */
-    protected final ArrayList fAttributeList = new ArrayList(5);
+    protected final ArrayList fAttributeList = new ArrayList<Node>(5);
 
     /** DOM Locator -  for namespace fixup algorithm */
     protected final DOMLocatorImpl fLocator = new DOMLocatorImpl();
@@ -890,6 +890,7 @@ public class DOMNormalizer implements XMLDocumentHandler {
 
             // clone content of the attributes
             attributes.cloneMap(fAttributeList);
+
             for (int i = 0; i < fAttributeList.size(); i++) {
                 Attr attr = (Attr) fAttributeList.get(i);
                 fLocator.fRelatedNode = attr;
diff --git a/src/org/apache/xerces/dom/DOMStringListImpl.java 
b/src/org/apache/xerces/dom/DOMStringListImpl.java
index 015aceb41..f7bd1daff 100644
--- a/src/org/apache/xerces/dom/DOMStringListImpl.java
+++ b/src/org/apache/xerces/dom/DOMStringListImpl.java
@@ -18,6 +18,7 @@
 package org.apache.xerces.dom;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
 
 import org.w3c.dom.DOMStringList;
@@ -34,27 +35,27 @@ import org.w3c.dom.DOMStringList;
 public class DOMStringListImpl implements DOMStringList {
        
        // A collection of DOMString values
-    private final ArrayList fStrings;
+    private final List<String> fStrings;
 
     /** 
      * Construct an empty list of DOMStringListImpl
      */ 
     public DOMStringListImpl() {
-        fStrings = new ArrayList();    
+        fStrings = new ArrayList<>();    
     }
 
     /** 
-     * Construct a DOMStringListImpl from an ArrayList
+     * Construct a DOMStringListImpl from an ArrayList of String values
      */ 
     public DOMStringListImpl(ArrayList params) {
         fStrings = params;    
     }
     
     /** 
-     * Construct a DOMStringListImpl from a Vector
+     * Construct a DOMStringListImpl from a Vector of String values
      */ 
     public DOMStringListImpl(Vector params) {
-        fStrings = new ArrayList(params);
+        fStrings = new ArrayList<>(params);
     }
         
        /**
diff --git a/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java 
b/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
index 01295b011..6944c60d6 100644
--- a/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
+++ b/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java
@@ -77,7 +77,7 @@ public class DOMXSImplementationSourceImpl
      *   features.
      */
     public DOMImplementationList getDOMImplementationList(String features) {
-        final ArrayList implementations = new ArrayList();
+        final ArrayList<DOMImplementation> implementations = new ArrayList<>();
 
         // first check whether the CoreDOMImplementation would do
         DOMImplementationList list = super.getDOMImplementationList(features);
diff --git a/src/org/apache/xerces/dom/DeepNodeListImpl.java 
b/src/org/apache/xerces/dom/DeepNodeListImpl.java
index b085d8181..772342f2d 100644
--- a/src/org/apache/xerces/dom/DeepNodeListImpl.java
+++ b/src/org/apache/xerces/dom/DeepNodeListImpl.java
@@ -79,7 +79,7 @@ import org.w3c.dom.NodeList;
  * @version $Id$
  * @since  PR-DOM-Level-1-19980818.
  */
-public class DeepNodeListImpl 
+public class DeepNodeListImpl
     implements NodeList {
 
     //
@@ -89,7 +89,7 @@ public class DeepNodeListImpl
     protected NodeImpl rootNode; // Where the search started
     protected String tagName;   // Or "*" to mean all-tags-acceptable
     protected int changes=0;
-    protected ArrayList nodes;
+    protected ArrayList nodes; // list of Node
     
     protected String nsName;
     protected boolean enableNS = false;
@@ -102,7 +102,7 @@ public class DeepNodeListImpl
     public DeepNodeListImpl(NodeImpl rootNode, String tagName) {
         this.rootNode = rootNode;
         this.tagName  = tagName;
-        nodes = new ArrayList();
+        nodes = new ArrayList<Node>();
     }  
 
     /** Constructor for Namespace support. */
@@ -130,7 +130,7 @@ public class DeepNodeListImpl
 
         // Tree changed. Do it all from scratch!
        if (rootNode.changes() != changes) {
-            nodes   = new ArrayList();     
+            nodes   = new ArrayList<Node>();
             changes = rootNode.changes();
        }
     
diff --git a/src/org/apache/xerces/dom/DocumentImpl.java 
b/src/org/apache/xerces/dom/DocumentImpl.java
index f13a29fb8..a71bb7d6a 100644
--- a/src/org/apache/xerces/dom/DocumentImpl.java
+++ b/src/org/apache/xerces/dom/DocumentImpl.java
@@ -103,19 +103,40 @@ public class DocumentImpl
     // Data
     //
 
-    /** Node Iterators */
+    /**
+     * Node Iterators as a <code>List&lt;Reference&lt;NodeIterator>></></code>.
+     *
+     * @see Reference
+     * @see NodeIterator
+     */
     protected transient List iterators;
     
-    /** Reference queue for cleared Node Iterator references */
+    /**
+     * Reference queue for cleared Node Iterator references as a 
<code>ReferenceQueue&lt;NodeIterator></code>.
+     * @see NodeIterator
+     */
     protected transient ReferenceQueue iteratorReferenceQueue;
 
-    /** Ranges */
+    /**
+     * Ranges as a <code>List&lt;Reference&lt;Range>></code>.
+     *
+     * @see Reference
+     * @see Range
+     */
     protected transient List ranges;
     
-    /** Reference queue for cleared Range references */
+    /**
+     * Reference queue for cleared Range references as a 
<code>ReferenceQueue&lt;Range></code>.
+     * @see Range
+     */
     protected transient ReferenceQueue rangeReferenceQueue;
 
-    /** Table for event listeners registered to this document nodes. */
+    /**
+     * Table (<code>Hashtable&lt;NodeImpl, Vector&lt;LEntry>></code>) of for 
event listeners registered to this document nodes.
+     *
+     * @see NodeImpl
+     * @see LEntry
+     */
     protected Hashtable eventListeners;
 
     /** Bypass mutation events firing. */
@@ -240,12 +261,12 @@ public class DocumentImpl
                                                      filter,
                                                      entityReferenceExpansion);
         if (iterators == null) {
-            iterators = new LinkedList();
-            iteratorReferenceQueue = new ReferenceQueue();
+            iterators = new LinkedList<Reference<NodeIterator>>();
+            iteratorReferenceQueue = new ReferenceQueue<NodeIterator>();
         }
 
         removeStaleIteratorReferences();
-        iterators.add(new WeakReference(iterator, iteratorReferenceQueue));
+        iterators.add(new WeakReference<NodeIterator>(iterator, 
iteratorReferenceQueue));
 
         return iterator;
     }
@@ -304,9 +325,9 @@ public class DocumentImpl
         if (iterators == null) return;
 
         removeStaleIteratorReferences();
-        Iterator i = iterators.iterator();
+        Iterator<Reference<NodeIterator>> i = iterators.iterator();
         while (i.hasNext()) {
-            Object iterator = ((Reference) i.next()).get();
+            final NodeIterator iterator = (i.next()).get();
             if (iterator == nodeIterator) {
                 i.remove();
                 return;
@@ -328,17 +349,17 @@ public class DocumentImpl
     /**
      * Remove stale references from the given list.
      */
-    private void removeStaleReferences(ReferenceQueue queue, List list) {
-        Reference ref = queue.poll();
+    private <T> void removeStaleReferences(ReferenceQueue<T> queue, 
List<Reference<T>> list) {
+        Reference<?> ref = queue.poll();
         int count = 0;
         while (ref != null) {
             ++count;
             ref = queue.poll();
         }
         if (count > 0) {
-            final Iterator i = list.iterator();
+            final Iterator<Reference<T>> i = list.iterator();
             while (i.hasNext()) {
-                Object o = ((Reference) i.next()).get();
+                T o = ((Reference<T>) i.next()).get();
                 if (o == null) {
                     i.remove();
                     if (--count <= 0) {
@@ -357,14 +378,14 @@ public class DocumentImpl
     public Range createRange() {
 
         if (ranges == null) {
-            ranges = new LinkedList();
-            rangeReferenceQueue = new ReferenceQueue();
+            ranges = new LinkedList<Reference<Range>>();
+            rangeReferenceQueue = new ReferenceQueue<>();
         }
 
         Range range = new RangeImpl(this);
 
         removeStaleRangeReferences();
-        ranges.add(new WeakReference(range, rangeReferenceQueue));
+        ranges.add(new WeakReference<Range>(range, rangeReferenceQueue));
 
         return range;
 
@@ -380,9 +401,9 @@ public class DocumentImpl
         if (ranges == null) return;
 
         removeStaleRangeReferences();
-        Iterator i = ranges.iterator();
+        Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            Object otherRange = ((Reference) i.next()).get();
+            Range otherRange = (i.next()).get();
             if (otherRange == range) {
                 i.remove();
                 return;
@@ -407,9 +428,9 @@ public class DocumentImpl
     
     private void notifyRangesReplacedText(CharacterDataImpl node) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
+            final RangeImpl range = (RangeImpl) (i.next()).get();
             if (range != null) {
                 range.receiveReplacedText(node);
             }
@@ -433,9 +454,9 @@ public class DocumentImpl
     
     private void notifyRangesDeletedText(CharacterDataImpl node, int offset, 
int count) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
+            final RangeImpl range = (RangeImpl) (i.next()).get();
             if (range != null) {
                 range.receiveDeletedText(node, offset, count);
             }
@@ -459,9 +480,9 @@ public class DocumentImpl
     
     private void notifyRangesInsertedText(CharacterDataImpl node, int offset, 
int count) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
+            final RangeImpl range = (RangeImpl) (i.next()).get();
             if (range != null) {
                 range.receiveInsertedText(node, offset, count);
             }
@@ -485,7 +506,7 @@ public class DocumentImpl
     
     private void notifyRangesSplitData(Node node, Node newNode, int offset) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
             RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
             if (range != null) {
@@ -571,19 +592,21 @@ public class DocumentImpl
      * This is another place where we could use weak references! Indeed, the
      * node here won't be GC'ed as long as some listener is registered on it,
      * since the eventsListeners table will have a reference to the node.
+     * @param node The node to add/remove from the hashtable depending on 
listeners being null or not
+     * @param listeners A vector of LEntry or null. If this arg has a value 
then the node will be put in the table
      */
-    protected void setEventListeners(NodeImpl n, Vector listeners) {
+    protected void setEventListeners(NodeImpl node, Vector<LEntry> listeners) {
         if (eventListeners == null) {
-            eventListeners = new Hashtable();
+            eventListeners = new Hashtable<>();
         }
         if (listeners == null) {
-            eventListeners.remove(n);
+            eventListeners.remove(node);
             if (eventListeners.isEmpty()) {
                 // stop firing events when there isn't any listener
                 mutationEvents = false;
             }
         } else {
-            eventListeners.put(n, listeners);
+            eventListeners.put(node, listeners);
             // turn mutation events on
             mutationEvents = true;
         }
@@ -592,11 +615,11 @@ public class DocumentImpl
     /**
      * Retreive event listener registered on a given node
      */
-    protected Vector getEventListeners(NodeImpl n) {
+    protected Vector<LEntry> getEventListeners(NodeImpl n) {
         if (eventListeners == null) {
             return null;
         }
-        return (Vector) eventListeners.get(n);
+        return (Vector<LEntry>) eventListeners.get(n);
     }
 
     //
@@ -656,16 +679,16 @@ public class DocumentImpl
     {
         // We can't dispatch to blank type-name, and of course we need
         // a listener to dispatch to
-        if (type == null || type.length() == 0 || listener == null)
+        if (type == null || type.isEmpty() || listener == null)
             return;
       
         // Each listener may be registered only once per type per phase.
         // Simplest way to code that is to zap the previous entry, if any.
         removeEventListener(node, type, listener, useCapture);
            
-        Vector nodeListeners = getEventListeners(node);
+        Vector<LEntry> nodeListeners = getEventListeners(node);
         if(nodeListeners == null) {
-            nodeListeners = new Vector();
+            nodeListeners = new Vector<>();
             setEventListeners(node, nodeListeners);
         }
         nodeListeners.addElement(new LEntry(type, listener, useCapture));
@@ -701,7 +724,7 @@ public class DocumentImpl
         // If this couldn't be a valid listener registration, ignore request
         if (type == null || type.length() == 0 || listener == null)
             return;
-        Vector nodeListeners = getEventListeners(node);
+        Vector<LEntry> nodeListeners = getEventListeners(node);
         if (nodeListeners == null)
             return;
 
@@ -734,11 +757,11 @@ public class DocumentImpl
     } // removeEventListener(NodeImpl,String,EventListener,boolean) :void
 
     protected void copyEventListeners(NodeImpl src, NodeImpl tgt) {
-        Vector nodeListeners = getEventListeners(src);
+        Vector<LEntry> nodeListeners = getEventListeners(src);
         if (nodeListeners == null) {
             return;
         }
-        setEventListeners(tgt, (Vector) nodeListeners.clone());
+        setEventListeners(tgt, (Vector<LEntry>) nodeListeners.clone());
     }
 
     /**
@@ -800,7 +823,7 @@ public class DocumentImpl
 
         // VALIDATE -- must have been initialized at least once, must have
         // a non-null non-blank name.
-        if (!evt.initialized || evt.type == null || evt.type.length() == 0) {
+        if (!evt.initialized || evt.type == null || evt.type.isEmpty()) {
             String msg = 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 
"UNSPECIFIED_EVENT_TYPE_ERR", null);
             throw new 
EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR, msg);
         }
@@ -827,7 +850,7 @@ public class DocumentImpl
         // is issued to the Element rather than the Attr
         // and causes a _second_ DOMSubtreeModified in the Element's
         // tree.
-        ArrayList pv = new ArrayList(10);
+        List<Node> pv = new ArrayList<>(10);
         Node p = node;
         Node n = p.getParentNode();
         while (n != null) {
@@ -848,9 +871,9 @@ public class DocumentImpl
                 // Handle all capturing listeners on this node
                 NodeImpl nn = (NodeImpl) pv.get(j);
                 evt.currentTarget = nn;
-                Vector nodeListeners = getEventListeners(nn);
+                Vector<LEntry> nodeListeners = getEventListeners(nn);
                 if (nodeListeners != null) {
-                    Vector nl = (Vector) nodeListeners.clone();
+                    Vector<LEntry> nl = (Vector<LEntry>) nodeListeners.clone();
                     // call listeners in the order in which they got registered
                     int nlsize = nl.size();
                     for (int i = 0; i < nlsize; i++) {
@@ -877,9 +900,9 @@ public class DocumentImpl
             // node are _not_ invoked, even during the capture phase.
             evt.eventPhase = Event.AT_TARGET;
             evt.currentTarget = node;
-            Vector nodeListeners = getEventListeners(node);
+            Vector<LEntry> nodeListeners = getEventListeners(node);
             if (!evt.stopPropagation && nodeListeners != null) {
-                Vector nl = (Vector) nodeListeners.clone();
+                Vector<LEntry> nl = (Vector<LEntry>) nodeListeners.clone();
                 // call listeners in the order in which they got registered
                 int nlsize = nl.size();
                 for (int i = 0; i < nlsize; i++) {
@@ -912,7 +935,7 @@ public class DocumentImpl
                     evt.currentTarget = nn;
                     nodeListeners = getEventListeners(nn);
                     if (nodeListeners != null) {
-                        Vector nl = (Vector) nodeListeners.clone();
+                        Vector<LEntry> nl = (Vector<LEntry>) 
nodeListeners.clone();
                         // call listeners in the order in which they got
                         // registered
                         int nlsize = nl.size();
@@ -1263,9 +1286,9 @@ public class DocumentImpl
     
     private void notifyRangesInsertedNode(NodeImpl newInternal) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
+            final RangeImpl range = (RangeImpl) (i.next()).get();
             if (range != null) {
                 range.insertedNodeFromDOM(newInternal);
             }
@@ -1299,9 +1322,9 @@ public class DocumentImpl
     
     private void notifyIteratorsRemovingNode(NodeImpl oldChild) {
         removeStaleIteratorReferences();
-        final Iterator i = iterators.iterator();
+        final Iterator<Reference<NodeIterator>> i = iterators.iterator();
         while (i.hasNext()) {
-            NodeIteratorImpl iterator = (NodeIteratorImpl) ((Reference) 
i.next()).get();
+            final NodeIteratorImpl iterator = (NodeIteratorImpl) 
(i.next()).get();
             if (iterator != null) {
                 iterator.removeNode(oldChild);
             }
@@ -1314,9 +1337,9 @@ public class DocumentImpl
     
     private void notifyRangesRemovingNode(NodeImpl oldChild) {
         removeStaleRangeReferences();
-        final Iterator i = ranges.iterator();
+        final Iterator<Reference<Range>> i = ranges.iterator();
         while (i.hasNext()) {
-            RangeImpl range = (RangeImpl) ((Reference) i.next()).get();
+            final RangeImpl range = (RangeImpl) (i.next()).get();
             if (range != null) {
                 range.removeNode(oldChild);
             }
diff --git a/src/org/apache/xerces/dom/NamedNodeMapImpl.java 
b/src/org/apache/xerces/dom/NamedNodeMapImpl.java
index 61cf010c2..f2beeb335 100644
--- a/src/org/apache/xerces/dom/NamedNodeMapImpl.java
+++ b/src/org/apache/xerces/dom/NamedNodeMapImpl.java
@@ -78,7 +78,9 @@ public class NamedNodeMapImpl
     protected final static short CHANGED      = 0x1<<1;
     protected final static short HASDEFAULTS  = 0x1<<2;
 
-    /** Nodes. */
+    /**
+     * Nodes as a <code>List&lt;Node></code>
+     */
     protected List nodes;
 
     protected NodeImpl ownerNode; // the node this map belongs to
@@ -176,7 +178,7 @@ public class NamedNodeMapImpl
      */
     public Node setNamedItem(Node arg)
     throws DOMException {
-        
+
         CoreDocumentImpl ownerDocument = ownerNode.ownerDocument();
         if (ownerDocument.errorChecking) {
             if (isReadOnly()) {
@@ -197,7 +199,7 @@ public class NamedNodeMapImpl
         } else {
             i = -1 - i; // Insert point (may be end of list)
             if (null == nodes) {
-                nodes = new ArrayList(5);
+                nodes = new ArrayList<Node>(5);
             }
             nodes.add(i, arg);
         }
@@ -218,7 +220,7 @@ public class NamedNodeMapImpl
      */
     public Node setNamedItemNS(Node arg)
     throws DOMException {
-        
+
         CoreDocumentImpl ownerDocument = ownerNode.ownerDocument();
         if (ownerDocument.errorChecking) {
             if (isReadOnly()) {
@@ -233,7 +235,7 @@ public class NamedNodeMapImpl
         }
         
         int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName());
-        NodeImpl previous = null;
+        Node previous = null;
         if (i >= 0) {
             previous = (NodeImpl) nodes.get(i);
             nodes.set(i, arg);
@@ -247,7 +249,7 @@ public class NamedNodeMapImpl
             } else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new ArrayList(5);
+                    nodes = new ArrayList<Node>(5);
                 }
                 nodes.add(i, arg);
             }
@@ -261,7 +263,6 @@ public class NamedNodeMapImpl
      * @param name The name of a node to remove.
      * @return The node removed from the map if a node with such a name exists.
      */
-    /***/
     public Node removeNamedItem(String name)
         throws DOMException {
 
@@ -336,12 +337,12 @@ public class NamedNodeMapImpl
     }
 
     protected void cloneContent(NamedNodeMapImpl srcmap) {
-        List srcnodes = srcmap.nodes;
+        List<Node> srcnodes = srcmap.nodes;
         if (srcnodes != null) {
             int size = srcnodes.size();
             if (size != 0) {
                 if (nodes == null) {
-                    nodes = new ArrayList(size);
+                    nodes = new ArrayList<Node>(size);
                 }
                 else {
                     nodes.clear();
@@ -562,7 +563,7 @@ public class NamedNodeMapImpl
             else {
                 i = -1 - i; // Insert point (may be end of list)
                 if (null == nodes) {
-                    nodes = new ArrayList(5);
+                    nodes = new ArrayList<Node>(5);
                 }
                 nodes.add(i, arg);
             }
@@ -573,12 +574,12 @@ public class NamedNodeMapImpl
     /**
      * NON-DOM: copy content of this map into the specified ArrayList
      * 
-     * @param list   ArrayList to copy information into.
+     * @param list a list of {@link Node} to copy information into, or null to 
create a new list
      * @return A copy of this node named map
      */
     protected ArrayList cloneMap(ArrayList list) {
         if (list == null) {
-            list = new ArrayList(5);
+            list = new ArrayList<Node>(5);
         }
         list.clear();
         if (nodes != null) {
@@ -608,15 +609,15 @@ public class NamedNodeMapImpl
         in.defaultReadObject();
         if (nodes != null) {
             // cast to Vector is required
-            nodes = new ArrayList((Vector)nodes);
+            nodes = new ArrayList<Node>((Vector<Node>)nodes);
         }
     }
 
     private void writeObject(ObjectOutputStream out) throws IOException {
-        List oldNodes = this.nodes;
+        final List<Node> oldNodes = this.nodes;
         try {
             if (oldNodes != null) {
-                this.nodes = new Vector(oldNodes);
+                this.nodes = new Vector<Node>(oldNodes);
             }
             out.defaultWriteObject();
         }
diff --git a/src/org/apache/xerces/dom/RangeImpl.java 
b/src/org/apache/xerces/dom/RangeImpl.java
index a05bfdd40..7045839ce 100644
--- a/src/org/apache/xerces/dom/RangeImpl.java
+++ b/src/org/apache/xerces/dom/RangeImpl.java
@@ -18,6 +18,7 @@
 package org.apache.xerces.dom;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.DOMException;
@@ -113,7 +114,7 @@ public class RangeImpl implements Range {
                 DOMException.INVALID_STATE_ERR, 
                 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 
"INVALID_STATE_ERR", null));
         }
-        return (fStartContainer == fEndContainer 
+        return (fStartContainer == fEndContainer
              && fStartOffset == fEndOffset);
     }
     
@@ -123,16 +124,18 @@ public class RangeImpl implements Range {
                 DOMException.INVALID_STATE_ERR, 
                 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 
"INVALID_STATE_ERR", null));
         }
-        ArrayList startV = new ArrayList();
+
+        List<Node> startV = new ArrayList<>();
         Node node;
-        for (node=fStartContainer; node != null; 
-             node=node.getParentNode()) 
+        for (node=fStartContainer; node != null;
+             node=node.getParentNode())
         {
             startV.add(node);
         }
-        ArrayList endV = new ArrayList();
-        for (node=fEndContainer; node != null; 
-             node=node.getParentNode()) 
+
+        List<Node> endV = new ArrayList<>();
+        for (node=fEndContainer; node != null;
+             node=node.getParentNode())
         {
             endV.add(node);
         }
@@ -226,8 +229,8 @@ public class RangeImpl implements Range {
         } 
     }
 
-    public void setStartBefore(Node refNode) 
-        throws RangeException 
+    public void setStartBefore(Node refNode)
+        throws RangeException
     {
         if (fDocument.errorChecking) {
             if (fDetach) {
@@ -385,7 +388,7 @@ public class RangeImpl implements Range {
     }
     
     public void collapse(boolean toStart) {
-        
+
        if( fDetach) {
                throw new DOMException(
                DOMException.INVALID_STATE_ERR, 
diff --git a/src/org/apache/xerces/dom/SecuritySupport.java 
b/src/org/apache/xerces/dom/SecuritySupport.java
index 4ce11a582..63fe40e58 100644
--- a/src/org/apache/xerces/dom/SecuritySupport.java
+++ b/src/org/apache/xerces/dom/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/xerces/impl/dtd/DTDGrammar.java 
b/src/org/apache/xerces/impl/dtd/DTDGrammar.java
index a06f4d8fc..45fac547f 100644
--- a/src/org/apache/xerces/impl/dtd/DTDGrammar.java
+++ b/src/org/apache/xerces/impl/dtd/DTDGrammar.java
@@ -796,7 +796,8 @@ public class DTDGrammar
             int chunk, index = 0;
             String currName = null;
             final int size = fElementDeclCount;
-            ArrayList elements = new ArrayList(size);
+            ArrayList<String> elements = new ArrayList<>(size);
+
             for (int i = 0; i < size; ++i) {
                 chunk = i >> CHUNK_SHIFT;
                 index = i & CHUNK_MASK;
diff --git a/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java 
b/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
index 0bb366ce5..0224f694a 100644
--- a/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
+++ b/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
@@ -87,12 +87,20 @@ public class XMLDTDDescription extends 
XMLResourceIdentifierImpl
         fPossibleRoots = null;
     }
     
-    /** Set possible roots **/
+    /**
+     * Set possible roots.
+     *
+     * @param possibleRoots an ArrayList of string values
+     */
     public void setPossibleRoots(ArrayList possibleRoots) {
         fPossibleRoots = possibleRoots;
     }
 
-    /** Set possible roots **/
+    /**
+     * Set possible roots.
+     *
+     * @param possibleRoots a Vector of string values
+     */
     public void setPossibleRoots(Vector possibleRoots) {
         fPossibleRoots = (possibleRoots != null) ? new 
ArrayList(possibleRoots) : null;
     }
diff --git a/src/org/apache/xerces/impl/dv/SecuritySupport.java 
b/src/org/apache/xerces/impl/dv/SecuritySupport.java
index 9d5ad0ff5..25f4eb358 100644
--- a/src/org/apache/xerces/impl/dv/SecuritySupport.java
+++ b/src/org/apache/xerces/impl/dv/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/xerces/impl/xpath/XPathException.java 
b/src/org/apache/xerces/impl/xpath/XPathException.java
index e50c9b781..e336da814 100644
--- a/src/org/apache/xerces/impl/xpath/XPathException.java
+++ b/src/org/apache/xerces/impl/xpath/XPathException.java
@@ -26,7 +26,7 @@ package org.apache.xerces.impl.xpath;
  *
  * @version $Id$
  */
-public class XPathException 
+public class XPathException
     extends Exception {
 
     /** Serialization version. */
@@ -42,8 +42,7 @@ public class XPathException
 
     /** Constructs an exception. */
     public XPathException() {
-        super();
-        fKey = "c-general-xpath";
+        this("c-general-xpath");
     } // <init>()
 
     /** Constructs an exception with the specified key. */
diff --git a/src/org/apache/xerces/impl/xs/SchemaGrammar.java 
b/src/org/apache/xerces/impl/xs/SchemaGrammar.java
index ae88c28e2..88fd2beda 100644
--- a/src/org/apache/xerces/impl/xs/SchemaGrammar.java
+++ b/src/org/apache/xerces/impl/xs/SchemaGrammar.java
@@ -38,6 +38,7 @@ import org.apache.xerces.parsers.XML11Configuration;
 import org.apache.xerces.util.SymbolHash;
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.xni.NamespaceContext;
+import org.apache.xerces.xni.grammars.Grammar;
 import org.apache.xerces.xni.grammars.XMLGrammarDescription;
 import org.apache.xerces.xni.grammars.XSGrammar;
 import org.apache.xerces.xs.StringList;
@@ -116,8 +117,8 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
     // symbol table for constructing parsers (annotation support)
     private SymbolTable fSymbolTable = null;
     // parsers for annotation support
-    private SoftReference fSAXParser = null;
-    private SoftReference fDOMParser = null;
+    private SoftReference<SAXParser> fSAXParser = null;
+    private SoftReference<DOMParser> fDOMParser = null;
     
     // is this grammar immutable?  (fully constructed and not changeable)
     private boolean fIsImmutable = false;
@@ -239,7 +240,7 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
 
         // List of imported grammars
         if (grammar.fImported != null) {
-            fImported = new Vector();
+            fImported = new Vector<>();
             for (int i=0; i<grammar.fImported.size(); i++) {
                 fImported.add(grammar.fImported.elementAt(i));
             }
@@ -798,12 +799,24 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
         return true;
     } // isNamespaceAware():boolean
 
-    Vector fImported = null;
+    Vector<Grammar> fImported = null;
 
+    /**
+     * Set imported grammars.
+     *
+     * @param importedGrammars a Vector of imported Grammar objects
+     * @see Grammar
+     */
     public void setImportedGrammars(Vector importedGrammars) {
         fImported = importedGrammars;
     }
 
+    /**
+     * Get imported grammars.
+     *
+     * @return the imported Grammar objects as a Vector
+     * @see Grammar
+     */
     public Vector getImportedGrammars() {
         return fImported;
     }
@@ -1193,34 +1206,41 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
             // don't allow this.
         }
 
+        @Override
         public void setName(String name){
             // don't allow this.
         }
 
+        @Override
         public void setIsAbstractType() {
             // null implementation
         }
 
+        @Override
         public void setContainsTypeID() {
             // null implementation
         }
 
+        @Override
         public void setIsAnonymous() {
             // null implementation
         }
 
+        @Override
         public void reset() {
             // null implementation
         }
 
+        @Override
         public XSObjectList getAnnotations() {
             return XSObjectListImpl.EMPTY_LIST;
         }
-        
+
+        @Override
         public XSNamespaceItem getNamespaceItem() {
             return SG_SchemaNS;
         }
-        
+
         private XSAttributeGroupDecl createAttrGrp() {
             XSWildcardDecl wildcard = new XSWildcardDecl();
             wildcard.fProcessContents = XSWildcardDecl.PC_LAX;
@@ -1269,14 +1289,17 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
             // ignore this call.
         }
 
+        @Override
         public void reset () {
             // also ignore this call.
         }
-        
+
+        @Override
         public XSAnnotation getAnnotation() {
             return null;
         }
-        
+
+        @Override
         public XSNamespaceItem getNamespaceItem() {
             return SG_XSI;
         }
@@ -1354,13 +1377,13 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
 
     // store the documents and their locations contributing to this namespace
     // REVISIT: use StringList and XSObjectList for there fields.
-    private Vector fDocuments = null;
-    private Vector fLocations = null;
+    private Vector<Object> fDocuments = null;
+    private Vector<String> fLocations = null;
     
     public synchronized void addDocument(Object document, String location) {
         if (fDocuments == null) {
-            fDocuments = new Vector();
-            fLocations = new Vector();
+            fDocuments = new Vector<>();
+            fLocations = new Vector<>();
         }
         fDocuments.addElement(document);
         fLocations.addElement(location);
@@ -1406,7 +1429,7 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
             parser.setFeature(Constants.XERCES_FEATURE_PREFIX + 
Constants.DEFER_NODE_EXPANSION_FEATURE, false);
         }
         catch (SAXException exc) {}
-        fDOMParser = new SoftReference(parser);
+        fDOMParser = new SoftReference<>(parser);
         return parser;
     }
 
@@ -1426,7 +1449,7 @@ public class SchemaGrammar implements XSGrammar, 
XSNamespaceItem {
         config.setFeature(Constants.SAX_FEATURE_PREFIX + 
Constants.NAMESPACES_FEATURE, true);
         config.setFeature(Constants.SAX_FEATURE_PREFIX + 
Constants.VALIDATION_FEATURE, false);
         SAXParser parser = new SAXParser(config);
-        fSAXParser = new SoftReference(parser);
+        fSAXParser = new SoftReference<>(parser);
         return parser;
     }
 
diff --git a/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java 
b/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
index e6a5a38e3..36465d424 100644
--- a/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
+++ b/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
@@ -27,6 +27,7 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Locale;
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
@@ -229,7 +230,7 @@ XSLoader, DOMConfiguration {
     
     // features and properties
     private final ParserConfigurationSettings fLoaderConfig = new 
ParserConfigurationSettings();
-    private XMLErrorReporter fErrorReporter = new XMLErrorReporter ();
+    private XMLErrorReporter fErrorReporter = new XMLErrorReporter();
     private XMLEntityManager fEntityManager = null;
     private XMLEntityResolver fUserEntityResolver = null;
     private XMLGrammarPool fGrammarPool = null;
@@ -253,7 +254,7 @@ XSLoader, DOMConfiguration {
     private XSDDescription fXSDDescription = new XSDDescription();
     private SchemaDVFactory fDefaultSchemaDVFactory;
     
-    private WeakHashMap fJAXPCache;
+    private WeakHashMap<Object, Grammar> fJAXPCache;
     private Locale fLocale = Locale.getDefault();
     
     // XSLoader attributes
@@ -340,7 +341,7 @@ XSLoader, DOMConfiguration {
         }
         fCMBuilder = builder;
         fSchemaHandler = new XSDHandler(fGrammarBucket);
-        fJAXPCache = new WeakHashMap();
+        fJAXPCache = new WeakHashMap<>();
         
         fSettingsChanged = true;
     }
@@ -538,7 +539,7 @@ XSLoader, DOMConfiguration {
         desc.setBaseSystemId(source.getBaseSystemId());
         desc.setLiteralSystemId( source.getSystemId());
         // none of the other fields make sense for preparsing
-        Hashtable locationPairs = new Hashtable();
+        Hashtable<String, LocationArray> locationPairs = new Hashtable<>();
         // Process external schema location properties.
         // We don't call tokenizeSchemaLocationStr here, because we also want
         // to check whether the values are valid URI.
@@ -560,20 +561,22 @@ XSLoader, DOMConfiguration {
     /**
      * This method is called either from XMLGrammarLoader.loadGrammar or from 
XMLSchemaValidator.
      * Note: in either case, the EntityManager (or EntityResolvers) are not 
going to be invoked
-     * to resolve the location of the schema in XSDDescription 
-     * @param desc
-     * @param source
-     * @param locationPairs
+     * to resolve the location of the schema in XSDDescription.
+     *
+     * @param desc the XSD description
+     * @param source the XML input source
+     * @param locationPairs a Hashtable of <code>Hashtable&lt;String, 
LocationArray></code>
      * @return An XML Schema grammar
      * @throws IOException
      * @throws XNIException
+     * @see LocationArray
      */
     SchemaGrammar loadSchema(XSDDescription desc,
             XMLInputSource source,
             Hashtable locationPairs) throws IOException, XNIException {
         
         // this should only be done once per invocation of this object;
-        // unless application alters JAXPSource in the mean time.
+        // unless application alters JAXPSource in the meantime.
         if(!fJAXPProcessed) {
             processJAXPSchemaSource(locationPairs);
         }
@@ -589,11 +592,12 @@ XSLoader, DOMConfiguration {
      * to find in the hashtable whether there is a value for that namespace,
      * if so, pass that location value to the user-defined entity resolver.
      *
-     * @param desc
-     * @param locationPairs
+     * @param desc the XSD description
+     * @param locationPairs a Hashtable of <code>Hashtable&lt;String, 
LocationArray></code>
      * @param entityResolver
      * @return the XMLInputSource
      * @throws IOException
+     * @see LocationArray
      */
     public static XMLInputSource resolveDocument(XSDDescription desc, 
Hashtable locationPairs,
             XMLEntityResolver entityResolver) throws IOException {
@@ -623,8 +627,15 @@ XSLoader, DOMConfiguration {
         desc.setExpandedSystemId(expandedLoc);
         return entityResolver.resolveEntity(desc);
     }
-    
-    // add external schema locations to the location pairs
+
+    /**
+     * Adds external schema locations to the location pairs.
+     *
+     * @param sl
+     * @param nsl
+     * @param locations a Hashtable of String to LocationArray
+     * @param er an XML error reporter
+     */
     public static void processExternalHints(String sl, String nsl,
             Hashtable locations,
             XMLErrorReporter er) {
@@ -716,7 +727,7 @@ XSLoader, DOMConfiguration {
      * Note: all JAXP schema files will be checked for full-schema validity if 
the feature was set up
      * 
      */
-    private void processJAXPSchemaSource(Hashtable locationPairs) throws 
IOException {
+    private void processJAXPSchemaSource(Hashtable<String, LocationArray> 
locationPairs) throws IOException {
         fJAXPProcessed = true;
         if (fJAXPSource == null) {
             return;
@@ -781,7 +792,8 @@ XSLoader, DOMConfiguration {
         // InputSource also, apart from [] of type Object.
         Object[] objArr = (Object[]) fJAXPSource;
         // make local vector for storing target namespaces of schemasources 
specified in object arrays.
-        ArrayList jaxpSchemaSourceNamespaces = new ArrayList();
+        final List<String> jaxpSchemaSourceNamespaces = new ArrayList<>();
+
         for (int i = 0; i < objArr.length; i++) {
             if (objArr[i] instanceof InputStream ||
                     objArr[i] instanceof InputSource) {
@@ -903,8 +915,12 @@ XSLoader, DOMConfiguration {
         
         return new XMLInputSource(publicId, systemId, null);
     }
-    
-    static class LocationArray{
+
+    /*
+     * For internal use only.
+     * todo: This class being package-private is not ideal as it should be 
accessible to XSDHandler
+     */
+    static final class LocationArray {
         
         int length ;
         String [] locations = new String[2];
@@ -1267,7 +1283,7 @@ XSLoader, DOMConfiguration {
      */
     public DOMStringList getParameterNames() {
         if (fRecognizedParameters == null){
-            ArrayList v = new ArrayList();
+            final ArrayList<String> v = new ArrayList<>();
             v.add(Constants.DOM_VALIDATE);
             v.add(Constants.DOM_ERROR_HANDLER);
             v.add(Constants.DOM_RESOURCE_RESOLVER);
diff --git a/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 
b/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
index 8a5619159..c1522cdaf 100644
--- a/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
+++ b/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
@@ -40,6 +40,7 @@ import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.validation.ConfigurableValidationState;
 import org.apache.xerces.impl.validation.ValidationManager;
 import org.apache.xerces.impl.validation.ValidationState;
+import org.apache.xerces.impl.xs.XMLSchemaLoader.LocationArray;
 import org.apache.xerces.impl.xs.identity.Field;
 import org.apache.xerces.impl.xs.identity.FieldActivator;
 import org.apache.xerces.impl.xs.identity.IdentityConstraint;
@@ -328,8 +329,7 @@ public class XMLSchemaValidator
         };
 
     /** Property defaults. */
-    private static final Object[] PROPERTY_DEFAULTS =
-        { null, null, null, null, null, null, null, null, null, null, null};
+    private static final Object[] PROPERTY_DEFAULTS = { null, null, null, 
null, null, null, null, null, null, null, null};
 
     // this is the number of valuestores of each kind
     // we expect an element to have.  It's almost
@@ -343,7 +343,7 @@ public class XMLSchemaValidator
     static final XSAttributeDecl XSI_NONAMESPACESCHEMALOCATION = 
SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_NONAMESPACESCHEMALOCATION);
 
     //
-    private static final Hashtable EMPTY_TABLE = new Hashtable();
+    private static final Hashtable<String, LocationArray> EMPTY_TABLE = new 
Hashtable<>();
 
     //
     // Data
@@ -405,7 +405,7 @@ public class XMLSchemaValidator
 
         // store error codes; starting position of the errors for each element;
         // number of element (depth); and whether to record error
-        Vector fErrors = new Vector();
+        Vector<String> fErrors = new Vector<>();
         int[] fContext = new int[INITIAL_STACK_SIZE];
         int fContextCount;
 
@@ -479,23 +479,20 @@ public class XMLSchemaValidator
             return errors;
         }
 
-        public void reportError(String domain, String key, Object[] arguments, 
short severity)
-            throws XNIException {
-            String message = fErrorReporter.reportError(domain, key, 
arguments, severity);
+        public void reportError(String domain, String key, Object[] arguments, 
short severity) throws XNIException {
+            final String message = fErrorReporter.reportError(domain, key, 
arguments, severity);
             if (fAugPSVI) {
                 fErrors.addElement(key);
                 fErrors.addElement(message);
             }
         } // reportError(String,String,Object[],short)
 
-        public void reportError(
-            XMLLocator location,
-            String domain,
-            String key,
-            Object[] arguments,
-            short severity)
-            throws XNIException {
-            String message = fErrorReporter.reportError(location, domain, key, 
arguments, severity);
+        public void reportError(XMLLocator location,
+                                String domain,
+                                String key,
+                                Object[] arguments,
+                                short severity) throws XNIException {
+            final String message = fErrorReporter.reportError(location, 
domain, key, arguments, severity);
             if (fAugPSVI) {
                 fErrors.addElement(key);
                 fErrors.addElement(message);
@@ -523,7 +520,7 @@ public class XMLSchemaValidator
 
     /** Schema Grammar Description passed,  to give a chance to application to 
supply the Grammar */
     protected final XSDDescription fXSDDescription = new XSDDescription();
-    protected final Hashtable fLocationPairs = new Hashtable();
+    protected final Hashtable<String, LocationArray> fLocationPairs = new 
Hashtable<>();
     protected final Hashtable fExpandedLocationPairs = new Hashtable();
     protected final ArrayList fUnparsedLocations = new ArrayList();
 
@@ -2677,11 +2674,11 @@ public class XMLSchemaValidator
                 
fXSDDescription.setBaseSystemId(fLocator.getExpandedSystemId());
             }
 
-            Hashtable locationPairs = fLocationPairs;
-            Object locationArray =
-                locationPairs.get(namespace == null ? XMLSymbols.EMPTY_STRING 
: namespace);
+            Hashtable<String, LocationArray> locationPairs = fLocationPairs;
+            final LocationArray locationArray = locationPairs.get(namespace == 
null ? XMLSymbols.EMPTY_STRING : namespace);
+
             if (locationArray != null) {
-                String[] temp = ((XMLSchemaLoader.LocationArray) 
locationArray).getLocationArray();
+                String[] temp = locationArray.getLocationArray();
                 if (temp.length != 0) {
                     setLocationHints(fXSDDescription, temp, grammar);
                 }
diff --git a/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
b/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
index 8340e6852..67da0f933 100644
--- a/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
+++ b/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
@@ -289,23 +289,23 @@ public class XSDHandler {
     // this hashtable is keyed on by XSDocumentInfo objects.  Its values
     // are Vectors containing the XSDocumentInfo objects <include>d,
     // <import>ed or <redefine>d by the key XSDocumentInfo.
-    private Hashtable fDependencyMap = new Hashtable();
+    private Hashtable<XSDocumentInfo, Vector<XSDocumentInfo>> fDependencyMap = 
new Hashtable<>();
     
     // this hashtable is keyed on by a target namespace.  Its values
     // are Vectors containing namespaces imported by schema documents
     // with the key target namespace.
     // if an imprted schema has absent namespace, the value "null" is stored.
-    private Hashtable fImportMap = new Hashtable();
+    private Hashtable<String, Vector> fImportMap = new Hashtable<>();
     // all namespaces that imports other namespaces
     // if the importing schema has absent namespace, empty string is stored.
     // (because the key of a hashtable can't be null.)
-    private Vector fAllTNSs = new Vector();
+    private Vector<String> fAllTNSs = new Vector<String>();
     // stores instance document mappings between namespaces and schema hints
-    private Hashtable fLocationPairs = null;
-    private static final Hashtable EMPTY_TABLE = new Hashtable();
+    private Hashtable<String, Object> fLocationPairs = null; // should be 
Hashtable<String, LocationArray> but LocationArray is a private class
+    private static final Hashtable<String, Object> EMPTY_TABLE = new 
Hashtable<>(); // should be Hashtable<String, LocationArray> but LocationArray 
is a private class
     
     // Records which nodes are hidden when the input is a DOMInputSource.
-    Hashtable fHiddenNodes = null;
+    Hashtable<Node, Object> fHiddenNodes = null;
 
     // convenience methods
     private String null2EmptyString(String ns) {
@@ -317,7 +317,7 @@ public class XSDHandler {
     // use Schema Element to lookup the SystemId.
     private String doc2SystemId(Element ele) {
         String documentURI = null;
-        /**
+        /*
          * REVISIT: Casting until DOM Level 3 interfaces are available. -- 
mrglavas
          */
         if(ele.getOwnerDocument() instanceof 
org.apache.xerces.impl.xs.opti.SchemaDOM){
@@ -456,7 +456,7 @@ public class XSDHandler {
 
     // Constructors
     public XSDHandler(){
-        fHiddenNodes = new Hashtable();       
+        fHiddenNodes = new Hashtable<>();       
         fSchemaParser = new SchemaDOMParser(new SchemaParsingConfig());
     }
     
@@ -478,9 +478,10 @@ public class XSDHandler {
      * called from the Validator and it will make the
      * resulting grammar available; it returns a reference to this object just
      * in case.  A reset(XMLComponentManager) must be called before this 
methods is called.
-     * @param is
+     *
+     * @param is an input source
      * @param desc
-     * @param locationPairs
+     * @param locationPairs a Hashtable of String to LocationArray
      * @return the SchemaGrammar
      * @throws IOException
      */
@@ -2049,7 +2050,7 @@ public class XSDHandler {
                                   Element referElement, boolean usePairs) {
         XMLInputSource schemaSource = null;
         try {
-            Hashtable pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
+            Hashtable<String, Object> pairs = usePairs ? fLocationPairs : 
EMPTY_TABLE;
             schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, 
fEntityResolver);
         }
         catch (IOException ex) {
@@ -2705,11 +2706,11 @@ public class XSDHandler {
     }
 
     private void addNewImportedGrammars(SchemaGrammar srcGrammar, 
SchemaGrammar dstGrammar) {
-        final Vector src = srcGrammar.getImportedGrammars();
+        final Vector<Grammar> src = srcGrammar.getImportedGrammars();
         if (src != null) {
-            Vector dst = dstGrammar.getImportedGrammars();
+            Vector<Grammar> dst = dstGrammar.getImportedGrammars();
             if (dst == null) {
-                dst = new Vector();
+                dst = new Vector<>();
                 dstGrammar.setImportedGrammars(dst);
             }
             final int size = src.size();
@@ -3285,9 +3286,9 @@ public class XSDHandler {
         SchemaGrammar sg = fGrammarBucket.getGrammar(namespace);
         // shouldn't be null
         if (sg != null) {
-            Vector isgs = sg.getImportedGrammars();
+            Vector<Grammar> isgs = sg.getImportedGrammars();
             if (isgs == null) {
-                isgs = new Vector();
+                isgs = new Vector<>();
                 addImportList(sg, isgs, namespaceList);
                 sg.setImportedGrammars(isgs);
             }
diff --git a/src/org/apache/xerces/impl/xs/util/LSInputListImpl.java 
b/src/org/apache/xerces/impl/xs/util/LSInputListImpl.java
index 54b77b65b..bc0acad1b 100644
--- a/src/org/apache/xerces/impl/xs/util/LSInputListImpl.java
+++ b/src/org/apache/xerces/impl/xs/util/LSInputListImpl.java
@@ -82,7 +82,7 @@ public final class LSInputListImpl extends AbstractList 
implements LSInputList {
     /*
      * List methods
      */
-
+    @Override
     public Object get(int index) {
         if (index >= 0 && index < fLength) {
             return fArray[index];
@@ -90,16 +90,19 @@ public final class LSInputListImpl extends AbstractList 
implements LSInputList {
         throw new IndexOutOfBoundsException("Index: " + index);
     }
 
+    @Override
     public int size() {
         return getLength();
     }
-    
+
+    @Override
     public Object[] toArray() {
         Object[] a = new Object[fLength];
         toArray0(a);
         return a;
     }
-    
+
+    @Override
     public Object[] toArray(Object[] a) {
         if (a.length < fLength) {
             Class arrayClass = a.getClass();
diff --git a/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java 
b/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
index 6ca7c24ea..40daa184b 100644
--- a/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
+++ b/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java
@@ -77,6 +77,7 @@ public final class ObjectListImpl extends AbstractList 
implements ObjectList {
     /*
      * List methods
      */
+    @Override
     public Object get(int index) {
         if (index >= 0 && index < fLength) {
             return fArray[index];
@@ -84,16 +85,19 @@ public final class ObjectListImpl extends AbstractList 
implements ObjectList {
         throw new IndexOutOfBoundsException("Index: " + index);
     }
 
+    @Override
     public int size() {
         return getLength();
     }
-    
+
+    @Override
     public Object[] toArray() {
         Object[] a = new Object[fLength];
         toArray0(a);
         return a;
     }
-    
+
+    @Override
     public Object[] toArray(Object[] a) {
         if (a.length < fLength) {
             Class arrayClass = a.getClass();
diff --git a/src/org/apache/xerces/impl/xs/util/ShortListImpl.java 
b/src/org/apache/xerces/impl/xs/util/ShortListImpl.java
index ae3191e13..9b89f93d3 100644
--- a/src/org/apache/xerces/impl/xs/util/ShortListImpl.java
+++ b/src/org/apache/xerces/impl/xs/util/ShortListImpl.java
@@ -58,6 +58,7 @@ public final class ShortListImpl extends AbstractList 
implements ShortList {
      * The number of <code>Objects</code> in the list. The range of valid
      * child node indices is 0 to <code>length-1</code> inclusive.
      */
+    @Override
     public int getLength() {
         return fLength;
     }
@@ -70,6 +71,7 @@ public final class ShortListImpl extends AbstractList 
implements ShortList {
      * @return  True if this list contains the <code>unsigned short</code> 
      *   <code>item</code>. 
      */
+    @Override
     public boolean contains(short item) {
         for (int i = 0; i < fLength; i++) {
             if (fArray[i] == item) {
@@ -78,14 +80,16 @@ public final class ShortListImpl extends AbstractList 
implements ShortList {
         }
         return false;
     }
-    
+
+    @Override
     public short item(int index) throws XSException {
         if (index < 0 || index >= fLength) {
             throw new XSException(XSException.INDEX_SIZE_ERR, null);
         }
         return fArray[index];
     }
-    
+
+    @Override
     public boolean equals(Object obj) {
         if (obj == null || !(obj instanceof ShortList)) {
             return false;
@@ -106,7 +110,7 @@ public final class ShortListImpl extends AbstractList 
implements ShortList {
     /*
      * List methods
      */
-
+    @Override
     public Object get(int index) {
         if (index >= 0 && index < fLength) {
             return Short.valueOf(fArray[index]);
@@ -114,6 +118,7 @@ public final class ShortListImpl extends AbstractList 
implements ShortList {
         throw new IndexOutOfBoundsException("Index: " + index);
     }
 
+    @Override
     public int size() {
         return getLength();
     }
diff --git a/src/org/apache/xerces/impl/xs/util/SimpleLocator.java 
b/src/org/apache/xerces/impl/xs/util/SimpleLocator.java
index 886494e0c..950d7011d 100644
--- a/src/org/apache/xerces/impl/xs/util/SimpleLocator.java
+++ b/src/org/apache/xerces/impl/xs/util/SimpleLocator.java
@@ -61,31 +61,38 @@ public final class SimpleLocator implements XMLLocator {
         this.esid = esid;
         charOffset = offset;
     }
-    
+
+    @Override
     public int getLineNumber() {
         return line;
     }
-    
+
+    @Override
     public int getColumnNumber() {
         return column;
     }
-    
+
+    @Override
     public int getCharacterOffset() {
         return charOffset;
     }
-    
+
+    @Override
     public String getPublicId() {
         return null;
     }
-    
+
+    @Override
     public String getExpandedSystemId() {
         return esid;
     }
-    
+
+    @Override
     public String getLiteralSystemId() {
         return lsid;
     }
-    
+
+    @Override
     public String getBaseSystemId() {
         return null;
     }
@@ -133,10 +140,12 @@ public final class SimpleLocator implements XMLLocator {
      * no point in having this object deal intelligently 
      * with encoding information.
      */
+    @Override
     public String getEncoding() {
         return null;
     }
-    
+
+    @Override
     public String getXMLVersion() {
         return null;
     }
diff --git a/src/org/apache/xerces/impl/xs/util/XSGrammarPool.java 
b/src/org/apache/xerces/impl/xs/util/XSGrammarPool.java
index 995f2c62f..5deef9e84 100644
--- a/src/org/apache/xerces/impl/xs/util/XSGrammarPool.java
+++ b/src/org/apache/xerces/impl/xs/util/XSGrammarPool.java
@@ -18,11 +18,13 @@
 package org.apache.xerces.impl.xs.util;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.XSModelImpl;
 import org.apache.xerces.util.XMLGrammarPoolImpl;
+import org.apache.xerces.xni.grammars.Grammar;
 import org.apache.xerces.xni.grammars.XMLGrammarDescription;
 import org.apache.xerces.xs.XSModel;
 
@@ -47,7 +49,7 @@ public class XSGrammarPool extends XMLGrammarPoolImpl {
     }
     
     public XSModel toXSModel(short schemaVersion) {
-        ArrayList list = new ArrayList();
+        final List<Grammar> list = new ArrayList<>();
         for (int i = 0; i < fGrammars.length; i++) {
             for (Entry entry = fGrammars[i] ; entry != null ; entry = 
entry.next) {
                 if 
(entry.desc.getGrammarType().equals(XMLGrammarDescription.XML_SCHEMA)) {
diff --git a/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java 
b/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java
index 128b06cbb..a48113406 100644
--- a/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java
+++ b/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java
@@ -152,7 +152,7 @@ final class StAXValidatorHelper implements ValidatorHelper, 
EntityState {
     final QName fElementQName = new QName();
     final QName fAttributeQName = new QName();
     final XMLAttributesImpl fAttributes = new XMLAttributesImpl();
-    final ArrayList fDeclaredPrefixes = new ArrayList();
+    final List<String> fDeclaredPrefixes = new ArrayList<>();
     final XMLString fTempString = new XMLString();
     final XMLStringBuffer fStringBuffer = new XMLStringBuffer();
 
diff --git a/src/org/apache/xerces/parsers/BasicParserConfiguration.java 
b/src/org/apache/xerces/parsers/BasicParserConfiguration.java
index 9f61f92a4..a3b9ff134 100644
--- a/src/org/apache/xerces/parsers/BasicParserConfiguration.java
+++ b/src/org/apache/xerces/parsers/BasicParserConfiguration.java
@@ -149,7 +149,10 @@ public abstract class BasicParserConfiguration
     /** Locale. */
     protected Locale fLocale;
 
-    /** Components. */
+    /**
+     * Components.
+     * @see XMLComponent
+     */
     protected ArrayList fComponents;
 
     // handlers
diff --git a/src/org/apache/xerces/parsers/SecuritySupport.java 
b/src/org/apache/xerces/parsers/SecuritySupport.java
index 52e44b4da..cb8e0b964 100644
--- a/src/org/apache/xerces/parsers/SecuritySupport.java
+++ b/src/org/apache/xerces/parsers/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/xerces/parsers/XML11Configuration.java 
b/src/org/apache/xerces/parsers/XML11Configuration.java
index 40c7bc5b2..30a2c209a 100644
--- a/src/org/apache/xerces/parsers/XML11Configuration.java
+++ b/src/org/apache/xerces/parsers/XML11Configuration.java
@@ -306,13 +306,25 @@ public class XML11Configuration extends 
ParserConfigurationSettings
        protected final XMLVersionDetector fVersionDetector;
        protected Locale fLocale;
 
-       /** XML 1.0 Components. */
+       /**
+     * XML 1.0 Components.
+     * @see XMLComponent
+     */
        protected final ArrayList fComponents;
     
-       /** XML 1.1. Components. */
+       /**
+     * XML 1.1. Components.
+     * @see XMLComponent
+     */
        protected final ArrayList fXML11Components;
        
-       /** Common components: XMLEntityManager, XMLErrorReporter, 
XMLSchemaValidator */
+       /**
+     * An array list of common XMLComponents: XMLEntityManager, 
XMLErrorReporter, XMLSchemaValidator.
+     *
+     * @see XMLEntityManager
+     * @see XMLErrorReporter
+     * @see XMLSchemaValidator
+     */
        protected final ArrayList fCommonComponents;
 
        /** The document handler. */
@@ -460,28 +472,24 @@ public class XML11Configuration extends 
ParserConfigurationSettings
      * @param grammarPool    The grammar pool to use.
      * @param parentSettings The parent settings.
      */
-    public XML11Configuration(
-        SymbolTable symbolTable,
-        XMLGrammarPool grammarPool,
-        XMLComponentManager parentSettings) {
-               
+    public XML11Configuration(SymbolTable symbolTable, XMLGrammarPool 
grammarPool, XMLComponentManager parentSettings) {
                super(parentSettings);
 
                // create a vector to hold all the components in use
                // XML 1.0 specialized components
-               fComponents = new ArrayList();
+               fComponents = new ArrayList<XMLComponent>();
                // XML 1.1 specialized components
-               fXML11Components = new ArrayList();
+               fXML11Components = new ArrayList<XMLComponent>();
                // Common components for XML 1.1. and XML 1.0
-               fCommonComponents = new ArrayList();
+               fCommonComponents = new ArrayList<XMLComponent>();
 
                // create storage for recognized features and properties
-               fRecognizedFeatures = new ArrayList();
-               fRecognizedProperties = new ArrayList();
+               fRecognizedFeatures = new ArrayList<>();
+               fRecognizedProperties = new ArrayList<>();
 
                // create table for features and properties
-               fFeatures = new HashMap();
-               fProperties = new HashMap();
+               fFeatures = new HashMap<>();
+               fProperties = new HashMap<>();
 
         // add default recognized features
                final String[] recognizedFeatures =
@@ -530,7 +538,7 @@ public class XML11Configuration extends 
ParserConfigurationSettings
 
         // add default recognized properties
         final String[] recognizedProperties =
-        {                                   
+        {
                 SYMBOL_TABLE,
                 ERROR_HANDLER,  
                 ENTITY_RESOLVER,
diff --git a/src/org/apache/xerces/parsers/XML11DTDConfiguration.java 
b/src/org/apache/xerces/parsers/XML11DTDConfiguration.java
index 3918c7e55..5eb9813e4 100644
--- a/src/org/apache/xerces/parsers/XML11DTDConfiguration.java
+++ b/src/org/apache/xerces/parsers/XML11DTDConfiguration.java
@@ -193,11 +193,11 @@ public class XML11DTDConfiguration extends 
ParserConfigurationSettings
 
     /** Property identifier: JAXP schema language / DOM schema-type. */
     protected static final String JAXP_SCHEMA_LANGUAGE =
-        Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE; 
+        Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE;
 
     /** Property identifier: JAXP schema source/ DOM schema-location. */
     protected static final String JAXP_SCHEMA_SOURCE =
-        Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE; 
+        Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;
 
     // debugging
 
@@ -214,13 +214,24 @@ public class XML11DTDConfiguration extends 
ParserConfigurationSettings
     protected XMLLocator fLocator;
     protected Locale fLocale;
     
-    /** XML 1.0 Components. */
+    /**
+     * XML 1.0 Components.
+     * @see XMLComponent
+     */
     protected ArrayList fComponents;
     
-    /** XML 1.1. Components. */
+    /**
+     * XML 1.1. Components.
+     * @see XMLComponent
+     */
     protected ArrayList fXML11Components = null;
     
-    /** Common components: XMLEntityManager, XMLErrorReporter */
+    /**
+     * An array list of common XMLComponents: XMLEntityManager, 
XMLErrorReporter.
+     *
+     * @see XMLEntityManager
+     * @see XMLErrorReporter
+     */
     protected ArrayList fCommonComponents = null;
     
     /** The document handler. */
@@ -377,19 +388,19 @@ public class XML11DTDConfiguration extends 
ParserConfigurationSettings
 
                // create a vector to hold all the components in use
                // XML 1.0 specialized components
-               fComponents = new ArrayList();
+               fComponents = new ArrayList<XMLComponent>();
                // XML 1.1 specialized components
-               fXML11Components = new ArrayList();
+               fXML11Components = new ArrayList<XMLComponent>();
                // Common components for XML 1.1. and XML 1.0
-               fCommonComponents = new ArrayList();
+               fCommonComponents = new ArrayList<XMLComponent>();
 
                // create storage for recognized features and properties
-               fRecognizedFeatures = new ArrayList();
-               fRecognizedProperties = new ArrayList();
+               fRecognizedFeatures = new ArrayList<>();
+               fRecognizedProperties = new ArrayList<>();
 
                // create table for features and properties
-               fFeatures = new HashMap();
-               fProperties = new HashMap();
+               fFeatures = new HashMap<>();
+               fProperties = new HashMap<>();
 
         // add default recognized features
         final String[] recognizedFeatures =
diff --git a/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java 
b/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java
index aa61dfa92..b92b1ca3e 100644
--- a/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java
+++ b/src/org/apache/xerces/parsers/XML11NonValidatingConfiguration.java
@@ -171,13 +171,24 @@ public class XML11NonValidatingConfiguration extends 
ParserConfigurationSettings
     protected XMLLocator fLocator;
     protected Locale fLocale;
     
-    /** XML 1.0 Components. */
+    /**
+     * XML 1.0 Components.
+     * @see XMLComponent
+     */
     protected ArrayList fComponents;
-    
-    /** XML 1.1. Components. */
+
+    /**
+     * XML 1.1. Components.
+     * @see XMLComponent
+     */
     protected ArrayList fXML11Components = null;
-    
-    /** Common components: XMLEntityManager, XMLErrorReporter */
+
+    /**
+     * An array list of common XMLComponents: XMLEntityManager, 
XMLErrorReporter.
+     *
+     * @see XMLEntityManager
+     * @see XMLErrorReporter
+     */
     protected ArrayList fCommonComponents = null;
     
     /** The document handler. */
@@ -316,19 +327,19 @@ public class XML11NonValidatingConfiguration extends 
ParserConfigurationSettings
 
                // create a vector to hold all the components in use
                // XML 1.0 specialized components
-               fComponents = new ArrayList();
+               fComponents = new ArrayList<XMLComponent>();
                // XML 1.1 specialized components
-               fXML11Components = new ArrayList();
+               fXML11Components = new ArrayList<XMLComponent>();
                // Common components for XML 1.1. and XML 1.0
-               fCommonComponents = new ArrayList();
+               fCommonComponents = new ArrayList<XMLComponent>();
 
                // create storage for recognized features and properties
-               fRecognizedFeatures = new ArrayList();
-               fRecognizedProperties = new ArrayList();
+               fRecognizedFeatures = new ArrayList<>();
+               fRecognizedProperties = new ArrayList<>();
 
                // create table for features and properties
-               fFeatures = new HashMap();
-               fProperties = new HashMap();
+               fFeatures = new HashMap<>();
+               fProperties = new HashMap<>();
 
         // add default recognized features
         final String[] recognizedFeatures =
diff --git a/src/org/apache/xerces/util/DOMUtil.java 
b/src/org/apache/xerces/util/DOMUtil.java
index 79325fd06..804958c89 100644
--- a/src/org/apache/xerces/util/DOMUtil.java
+++ b/src/org/apache/xerces/util/DOMUtil.java
@@ -180,7 +180,13 @@ public class DOMUtil {
         
     } // getFirstChildElement(Node):Element
     
-    /** Finds and returns the first visible child element node. */
+    /**
+     * Finds and returns the first visible child element node.
+     *
+     * @param parent the parent node
+     * @param hiddenNodes a hash table of Node to Object
+     * @return the first visible child element
+     */
     public static Element getFirstVisibleChildElement(Node parent, Hashtable 
hiddenNodes) {
         
         // search for node
@@ -235,8 +241,13 @@ public class DOMUtil {
         
     } // getLastChildElement(Node):Element
     
-    /** Finds and returns the last visible child element node. 
-     *  Overload previous method for non-Xerces node impl
+    /**
+     * Finds and returns the last visible child element node.
+     * Overload previous method for non-Xerces node impl.
+     *
+     * @param parent the parent node
+     * @param hiddenNodes a hash table of Node to Object
+     * @return the last visible child element
      */
     public static Element getLastVisibleChildElement(Node parent, Hashtable 
hiddenNodes) {
         
@@ -290,7 +301,7 @@ public class DOMUtil {
     } // getNextSiblingdElement(Node):Element
     
     // get next visible (un-hidden) node, overload previous method for non 
Xerces node impl
-    public static Element getNextVisibleSiblingElement(Node node, Hashtable 
hiddenNodes) {
+    public static Element getNextVisibleSiblingElement(Node node, 
Hashtable<Node, Object> hiddenNodes) {
         
         // search for node
         Node sibling = node.getNextSibling();
@@ -316,7 +327,7 @@ public class DOMUtil {
     } // setHidden(node):void
 
     // set this Node as being hidden, overloaded method
-    public static void setHidden(Node node, Hashtable hiddenNodes) {
+    public static void setHidden(Node node, Hashtable<Node, Object> 
hiddenNodes) {
         if (node instanceof org.apache.xerces.impl.xs.opti.NodeImpl) {
             ((org.apache.xerces.impl.xs.opti.NodeImpl)node).setReadOnly(true, 
false);
         }
@@ -334,7 +345,7 @@ public class DOMUtil {
     } // setVisible(node):void   
 
     // set this Node as being visible, overloaded method
-    public static void setVisible(Node node, Hashtable hiddenNodes) {
+    public static void setVisible(Node node, Hashtable<Node, Object> 
hiddenNodes) {
         if (node instanceof org.apache.xerces.impl.xs.opti.NodeImpl) {
             ((org.apache.xerces.impl.xs.opti.NodeImpl)node).setReadOnly(false, 
false);   
         }
@@ -353,7 +364,7 @@ public class DOMUtil {
     } // isHidden(Node):boolean
 
     // is this node hidden? overloaded method
-    public static boolean isHidden(Node node, Hashtable hiddenNodes) {
+    public static boolean isHidden(Node node, Hashtable<Node, Object> 
hiddenNodes) {
         if (node instanceof org.apache.xerces.impl.xs.opti.NodeImpl) {
             return 
((org.apache.xerces.impl.xs.opti.NodeImpl)node).getReadOnly();
         }
diff --git a/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java 
b/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
index 088b4d042..6c6974808 100644
--- a/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
+++ b/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
@@ -38,8 +38,8 @@ public final class JAXPNamespaceContextWrapper implements 
NamespaceContext {
     
     private javax.xml.namespace.NamespaceContext fNamespaceContext;
     private SymbolTable fSymbolTable;
-    private List fPrefixes;
-    private final Vector fAllPrefixes = new Vector();
+    private List<String> fPrefixes;
+    private final Vector<String> fAllPrefixes = new Vector<>();
     
     private int[] fContext = new int[8];
     private int fCurrentContext;
@@ -63,11 +63,21 @@ public final class JAXPNamespaceContextWrapper implements 
NamespaceContext {
     public SymbolTable getSymbolTable() {
         return fSymbolTable;
     }
-    
+
+    /**
+     * Set the declared prefixes as a list of strings.
+     *
+     * @param prefixes a list of prefixes as strings
+     */
     public void setDeclaredPrefixes(List prefixes) {
         fPrefixes = prefixes;
     }
-    
+
+    /**
+     * Get a list of declared prefixes as strings.
+     *
+     * @return a list of declared prefixes as strings
+     */
     public List getDeclaredPrefixes() {
         return fPrefixes;
     }
@@ -99,11 +109,16 @@ public final class JAXPNamespaceContextWrapper implements 
NamespaceContext {
         }
         return null;
     }
-    
+
+    /**
+     * Get all the prefix values as an enumeration of strings.
+     *
+     * @return an enumeration of string values of all the prefixes
+     */
     public Enumeration getAllPrefixes() {
         // There may be duplicate prefixes in the list so we 
         // first transfer them to a set to ensure uniqueness.
-        return Collections.enumeration(new TreeSet(fAllPrefixes));
+        return Collections.enumeration(new TreeSet<>(fAllPrefixes));
     }
 
     public void pushContext() {
diff --git a/src/org/apache/xerces/util/ParserConfigurationSettings.java 
b/src/org/apache/xerces/util/ParserConfigurationSettings.java
index 1854af211..54f25e861 100644
--- a/src/org/apache/xerces/util/ParserConfigurationSettings.java
+++ b/src/org/apache/xerces/util/ParserConfigurationSettings.java
@@ -41,9 +41,9 @@ import org.apache.xerces.xni.parser.XMLConfigurationException;
  */
 public class ParserConfigurationSettings
     implements XMLComponentManager {
-       
-       protected static final String PARSER_SETTINGS = 
-                       Constants.XERCES_FEATURE_PREFIX + 
Constants.PARSER_SETTINGS;    
+
+       protected static final String PARSER_SETTINGS =
+                       Constants.XERCES_FEATURE_PREFIX + 
Constants.PARSER_SETTINGS;
 
     //
     // Data
@@ -51,16 +51,16 @@ public class ParserConfigurationSettings
 
     // data
 
-    /** Recognized properties. */
+    /** Recognized properties as a list of Strings. */
     protected ArrayList fRecognizedProperties;
 
-    /** Properties. */
+    /** Properties as a map of Strings to Objects. */
     protected HashMap fProperties;
 
-    /** Recognized features. */
+    /** Recognized features as a list of strings. */
     protected ArrayList fRecognizedFeatures;
 
-    /** Features. */
+    /** Features as a map of Strings to Boolean values. */
     protected HashMap fFeatures;
 
     /** Parent parser configuration settings. */
@@ -82,12 +82,12 @@ public class ParserConfigurationSettings
     public ParserConfigurationSettings(XMLComponentManager parent) {
 
         // create storage for recognized features and properties
-        fRecognizedFeatures = new ArrayList();
-        fRecognizedProperties = new ArrayList();
+        fRecognizedFeatures = new ArrayList<String>();
+        fRecognizedProperties = new ArrayList<String>();
 
         // create table for features and properties
-        fFeatures = new HashMap();
-        fProperties = new HashMap();
+        fFeatures = new HashMap<String, Boolean>();
+        fProperties = new HashMap<String, Object>();
 
         // save parent
         fParentSettings = parent;
diff --git a/src/org/apache/xerces/xinclude/SecuritySupport.java 
b/src/org/apache/xerces/xinclude/SecuritySupport.java
index 0b6517da2..e1e027c38 100644
--- a/src/org/apache/xerces/xinclude/SecuritySupport.java
+++ b/src/org/apache/xerces/xinclude/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/src/org/apache/xml/serialize/DOMSerializerImpl.java 
b/src/org/apache/xml/serialize/DOMSerializerImpl.java
index 52fa1f7de..18f93a68c 100644
--- a/src/org/apache/xml/serialize/DOMSerializerImpl.java
+++ b/src/org/apache/xml/serialize/DOMSerializerImpl.java
@@ -338,7 +338,7 @@ public class DOMSerializerImpl implements LSSerializer, 
DOMConfiguration {
     public DOMStringList getParameterNames() {
        
        if (fRecognizedParameters == null){
-                       ArrayList parameters = new ArrayList();
+                       final ArrayList<String> parameters = new ArrayList<>();
 
                        //Add DOM recognized parameters
                        //REVISIT: Would have been nice to have a list of 
diff --git a/src/org/apache/xml/serialize/SecuritySupport.java 
b/src/org/apache/xml/serialize/SecuritySupport.java
index 715674be8..b7c99c743 100644
--- a/src/org/apache/xml/serialize/SecuritySupport.java
+++ b/src/org/apache/xml/serialize/SecuritySupport.java
@@ -37,35 +37,30 @@ import java.security.PrivilegedExceptionAction;
 final class SecuritySupport {
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = Thread.currentThread().getContextClassLoader();
+                    return Thread.currentThread().getContextClassLoader();
                 } catch (SecurityException ex) { }
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 try {
-                    cl = ClassLoader.getSystemClassLoader();
+                    return ClassLoader.getSystemClassLoader();
                 } catch (SecurityException ex) {}
-                return cl;
+                return null;
             }
         });
     }
     
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new 
PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 ClassLoader parent = null;
                 try {
                     parent = cl.getParent();
@@ -79,21 +74,17 @@ final class SecuritySupport {
     }
     
     static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty(propName);
             }
         });
     }
     
-    static FileInputStream getFileInputStream(final File file)
-    throws FileNotFoundException
-    {
+    static FileInputStream getFileInputStream(final File file) throws 
FileNotFoundException {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(new 
PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
                     return new FileInputStream(file);
                 }
             });
@@ -102,12 +93,9 @@ final class SecuritySupport {
         }
     }
     
-    static InputStream getResourceAsStream(final ClassLoader cl,
-            final String name)
-    {
-        return (InputStream)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+    static InputStream getResourceAsStream(final ClassLoader cl, final String 
name) {
+        return AccessController.doPrivileged(new 
PrivilegedAction<InputStream>() {
+            public InputStream run() {
                 InputStream ris;
                 if (cl == null) {
                     ris = ClassLoader.getSystemResourceAsStream(name);
@@ -120,21 +108,19 @@ final class SecuritySupport {
     }
     
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        }).booleanValue();
     }
     
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return Long.valueOf(f.lastModified());
-                    }
-                })).longValue();
+        return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+            public Long run() {
+                return Long.valueOf(f.lastModified());
+            }
+        }).longValue();
     }
     
     private SecuritySupport () {}
diff --git a/tests/dom/DTest.java b/tests/dom/DTest.java
index f5c5e4005..d8f0e294d 100644
--- a/tests/dom/DTest.java
+++ b/tests/dom/DTest.java
@@ -872,7 +872,7 @@ public void testCharacterData(org.w3c.dom.Document document)
  */
 public void testChildNodeList(org.w3c.dom.Document document)
 {
-       
+
        Node node, node2;
        boolean OK = true;
 // For debugging*****  println("\n          testChildNodeList's outputs:\n");
@@ -927,7 +927,7 @@ public void testComment(org.w3c.dom.Document document)
  */
 public void testDeepNodeList(org.w3c.dom.Document document)
 {
-       
+
        Node node, node2;
        boolean OK = true;
 // For debugging*****  println("\n          testDeepNodeList's outputs:\n");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to