changeset 27747:3a271dc8b758

8046949: Generify the javax.xml.crypto API Reviewed-by: xuelei
author mullan
date Fri, 21 Nov 2014 15:23:36 -0500
parents 8c9bd4be4a86
children 8580ad3a9d0d
files jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java jdk/test/javax/xml/crypto/dsig/GenerationTests.java jdk/test/javax/xml/crypto/dsig/KeySelectors.java jdk/test/javax/xml/crypto/dsig/SignatureValidator.java jdk/test/javax/xml/crypto/dsig/X509KeySelector.java
diffstat 46 files changed, 255 insertions(+), 407 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,9 +37,10 @@
  *
  * @author Sean Mullan
  * @author JSR 105 Expert Group
+ * @param <T> the type of nodes maintained by this set
  * @since 1.6
  */
-public interface NodeSetData extends Data {
+public interface NodeSetData<T> extends Data, Iterable<T> {
 
     /**
      * Returns a read-only iterator over the nodes contained in this
@@ -52,6 +53,5 @@
      * @return an <code>Iterator</code> over the nodes in this
      *    <code>NodeSetData</code> in document order
      */
-    @SuppressWarnings("rawtypes")
-    Iterator iterator();
+    Iterator<T> iterator();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import org.w3c.dom.Element;
 
 /**
@@ -219,8 +220,7 @@
      *
      * @return a read-only iterator over the set of mappings
      */
-    @SuppressWarnings("rawtypes")
-    public Iterator iterator() {
+    public Iterator<Map.Entry<String, Element>> iterator() {
         return Collections.unmodifiableMap(idMap).entrySet().iterator();
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,8 +51,8 @@
  *
  * <pre>
  *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   List references = Collections.singletonList(factory.newReference
- *       ("#reference-1", DigestMethod.SHA1));
+ *   Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
+ *   List<Reference> references = Collections.singletonList(ref);
  *   Manifest manifest = factory.newManifest(references, "manifest-1");
  * </pre>
  *
@@ -86,6 +86,5 @@
      *
      * @return an unmodifiable list of one or more <code>Reference</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getReferences();
+    List<Reference> getReferences();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,7 @@
      * @return an unmodifiable list of <code>Transform</code>s
      *    (may be empty but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getTransforms();
+    List<Transform> getTransforms();
 
     /**
      * Returns the digest method of this <code>Reference</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,5 @@
      * @return an unmodifiable list of one or more
      *    <code>SignatureProperty</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getProperties();
+    List<SignatureProperty> getProperties();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,6 +91,5 @@
      *
      * @return an unmodifiable list of one or more <code>XMLStructure</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,8 +80,7 @@
      *
      * @return an unmodifiable list of one or more {@link Reference}s
      */
-    @SuppressWarnings("rawtypes")
-    List getReferences();
+    List<Reference> getReferences();
 
     /**
      * Returns the optional <code>Id</code> attribute of this
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,8 @@
  *
  * <pre>
  *   XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
- *   List content = Collections.singletonList(fac.newManifest(references)));
+ *   Manifest manifest = fac.newManifest(references);
+ *   List<XMLStructure> content = Collections.singletonList(manifest);
  *   XMLObject object = factory.newXMLObject(content, "object-1", null, null);
  * </pre>
  *
@@ -100,8 +101,7 @@
      * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty
      *    but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 
     /**
      * Returns the Id of this <code>XMLObject</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,8 +136,7 @@
      * @return an unmodifiable list of <code>XMLObject</code>s (may be empty
      *    but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getObjects();
+    List<XMLObject> getObjects();
 
     /**
      * Returns the optional Id of this <code>XMLSignature</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -365,9 +365,8 @@
      * @throws ClassCastException if any of the <code>objects</code> are not of
      *    type <code>XMLObject</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
-        List objects, String id, String signatureValueId);
+        List<? extends XMLObject> objects, String id, String signatureValueId);
 
     /**
      * Creates a <code>Reference</code> with the specified URI and digest
@@ -399,9 +398,8 @@
      *    compliant
      * @throws NullPointerException if <code>dm</code> is <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id);
+        List<? extends Transform> transforms, String type, String id);
 
     /**
      * Creates a <code>Reference</code> with the specified parameters and
@@ -430,9 +428,9 @@
      * @throws NullPointerException if <code>dm</code> or
      *    <code>digestValue</code> is <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id, byte[] digestValue);
+        List<? extends Transform> transforms, String type, String id,
+        byte[] digestValue);
 
     /**
      * Creates a <code>Reference</code> with the specified parameters.
@@ -473,10 +471,9 @@
      *    <code>appliedTransforms</code> or <code>result</code> is
      *    <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List appliedTransforms, Data result, List transforms, String type,
-        String id);
+        List<? extends Transform> appliedTransforms, Data result,
+        List<? extends Transform> transforms, String type, String id);
 
     /**
      * Creates a <code>SignedInfo</code> with the specified canonicalization
@@ -493,9 +490,8 @@
      * @throws NullPointerException if any of the parameters
      *    are <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references);
+        SignatureMethod sm, List<? extends Reference> references);
 
     /**
      * Creates a <code>SignedInfo</code> with the specified parameters.
@@ -512,9 +508,8 @@
      * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or
      *    <code>references</code> are <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references, String id);
+        SignatureMethod sm, List<? extends Reference> references, String id);
 
     // Object factory methods
     /**
@@ -530,9 +525,8 @@
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract XMLObject newXMLObject(List content, String id,
-        String mimeType, String encoding);
+    public abstract XMLObject newXMLObject(List<? extends XMLStructure> content,
+        String id, String mimeType, String encoding);
 
     /**
      * Creates a <code>Manifest</code> containing the specified
@@ -547,8 +541,7 @@
      * @throws ClassCastException if <code>references</code> contains any
      *    entries that are not of type {@link Reference}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract Manifest newManifest(List references);
+    public abstract Manifest newManifest(List<? extends Reference> references);
 
     /**
      * Creates a <code>Manifest</code> containing the specified
@@ -564,8 +557,8 @@
      * @throws ClassCastException if <code>references</code> contains any
      *    entries that are not of type {@link Reference}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract Manifest newManifest(List references, String id);
+    public abstract Manifest newManifest(List<? extends Reference> references,
+        String id);
 
     /**
      * Creates a <code>SignatureProperty</code> containing the specified
@@ -583,9 +576,8 @@
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignatureProperty newSignatureProperty
-        (List content, String target, String id);
+        (List<? extends XMLStructure> content, String target, String id);
 
     /**
      * Creates a <code>SignatureProperties</code> containing the specified
@@ -602,9 +594,8 @@
      * @throws ClassCastException if <code>properties</code> contains any
      *    entries that are not of type {@link SignatureProperty}
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignatureProperties newSignatureProperties
-        (List properties, String id);
+        (List<? extends SignatureProperty> properties, String id);
 
     // Algorithm factory methods
     /**
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,8 +94,7 @@
      *    in this <code>KeyInfo</code>. Never returns <code>null</code> or an
      *    empty list.
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 
     /**
      * Return the optional Id attribute of this <code>KeyInfo</code>, which
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -305,8 +305,7 @@
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract KeyInfo newKeyInfo(List content);
+    public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content);
 
     /**
      * Creates a <code>KeyInfo</code> containing the specified list of key
@@ -325,8 +324,8 @@
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract KeyInfo newKeyInfo(List content, String id);
+    public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content,
+        String id);
 
     /**
      * Creates a <code>KeyName</code> from the specified name.
@@ -387,9 +386,8 @@
      * @throws ClassCastException if <code>other</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
     public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket,
-        List other);
+        List<? extends XMLStructure> other);
 
     /**
      * Creates a <code>PGPData</code> from the specified PGP key material
@@ -411,8 +409,8 @@
      * @throws ClassCastException if <code>other</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract PGPData newPGPData(byte[] keyPacket, List other);
+    public abstract PGPData newPGPData(byte[] keyPacket,
+        List<? extends XMLStructure> other);
 
     /**
      * Creates a <code>RetrievalMethod</code> from the specified URI.
@@ -443,9 +441,8 @@
      * @throws ClassCastException if <code>transforms</code> contains any
      *    entries that are not of type {@link Transform}
      */
-    @SuppressWarnings("rawtypes")
     public abstract RetrievalMethod newRetrievalMethod(String uri, String type,
-        List transforms);
+        List<? extends Transform> transforms);
 
     /**
      * Creates a <code>X509Data</code> containing the specified list of
@@ -469,8 +466,7 @@
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of one of the valid types mentioned above
      */
-    @SuppressWarnings("rawtypes")
-    public abstract X509Data newX509Data(List content);
+    public abstract X509Data newX509Data(List<?> content);
 
     /**
      * Creates an <code>X509IssuerSerial</code> from the specified X.500 issuer
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,5 @@
      * @return an unmodifiable list of <code>XMLStructure</code>s (may be
      *    empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getExternalElements();
+    List<XMLStructure> getExternalElements();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,8 +80,7 @@
      * @return an unmodifiable list of <code>Transform</code> objects (may be
      *    empty but never <code>null</code>).
      */
-    @SuppressWarnings("rawtypes")
-    List getTransforms();
+    List<Transform> getTransforms();
 
     /**
      * Returns the URI of the referenced <code>KeyInfo</code> information.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,6 +109,5 @@
      * @return an unmodifiable list of the content in this <code>X509Data</code>
      *    (never <code>null</code> or empty)
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<?> getContent();
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java	Fri Nov 21 15:23:36 2014 -0500
@@ -59,7 +59,7 @@
  */
 public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
 
-    private List<String> preList;
+    private final List<String> prefixList;
 
     /**
      * Indicates the default namespace ("#default").
@@ -71,7 +71,7 @@
      * list.
      */
     public ExcC14NParameterSpec() {
-        preList = Collections.emptyList();
+        prefixList = Collections.emptyList();
     }
 
     /**
@@ -86,22 +86,14 @@
      * @throws ClassCastException if any of the entries in the list are not
      *    of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public ExcC14NParameterSpec(List prefixList) {
+    public ExcC14NParameterSpec(List<String> prefixList) {
         if (prefixList == null) {
             throw new NullPointerException("prefixList cannot be null");
         }
-        List<?> copy = new ArrayList<>((List<?>)prefixList);
-        for (int i = 0, size = copy.size(); i < size; i++) {
-            if (!(copy.get(i) instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        List<String> temp = (List<String>)copy;
-
-        preList = Collections.unmodifiableList(temp);
+        List<String> tempList = Collections.checkedList(new ArrayList<>(),
+                                                        String.class);
+        tempList.addAll(prefixList);
+        this.prefixList = Collections.unmodifiableList(tempList);
     }
 
     /**
@@ -114,8 +106,7 @@
      * @return the inclusive namespace prefix list (may be empty but never
      *    <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public List getPrefixList() {
-        return preList;
+    public List<String> getPrefixList() {
+        return prefixList;
     }
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,27 +59,18 @@
      * @throws NullPointerException if <code>xPathList</code> is
      *    <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathFilter2ParameterSpec(List xPathList) {
+    public XPathFilter2ParameterSpec(List<XPathType> xPathList) {
         if (xPathList == null) {
             throw new NullPointerException("xPathList cannot be null");
         }
-        List<?> xPathListCopy = new ArrayList<>((List<?>)xPathList);
-        if (xPathListCopy.isEmpty()) {
+        List<XPathType> tempList =
+            Collections.checkedList(new ArrayList<XPathType>(),
+                                    XPathType.class);
+        tempList.addAll(xPathList);
+        if (tempList.isEmpty()) {
             throw new IllegalArgumentException("xPathList cannot be empty");
         }
-        int size = xPathListCopy.size();
-        for (int i = 0; i < size; i++) {
-            if (!(xPathListCopy.get(i) instanceof XPathType)) {
-                throw new ClassCastException
-                    ("xPathList["+i+"] is not a valid type");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        List<XPathType> temp = (List<XPathType>)xPathListCopy;
-
-        this.xPathList = Collections.unmodifiableList(temp);
+        this.xPathList = Collections.unmodifiableList(tempList);
     }
 
     /**
@@ -91,8 +82,7 @@
      * @return a <code>List</code> of <code>XPathType</code> objects
      *    (never <code>null</code> or empty)
      */
-    @SuppressWarnings("rawtypes")
-    public List getXPathList() {
+    public List<XPathType> getXPathList() {
         return xPathList;
     }
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
 
 /**
  * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-XPath">
@@ -51,8 +50,8 @@
  */
 public final class XPathFilterParameterSpec implements TransformParameterSpec {
 
-    private String xPath;
-    private Map<String,String> nsMap;
+    private final String xPath;
+    private final Map<String,String> nsMap;
 
     /**
      * Creates an <code>XPathFilterParameterSpec</code> with the specified
@@ -83,26 +82,16 @@
      * @throws ClassCastException if any of the map's keys or entries are not
      *    of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathFilterParameterSpec(String xPath, Map namespaceMap) {
+    public XPathFilterParameterSpec(String xPath, Map<String,String> namespaceMap) {
         if (xPath == null || namespaceMap == null) {
             throw new NullPointerException();
         }
         this.xPath = xPath;
-        Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap);
-        Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry<?,?> me = entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        Map<String,String> temp = (Map<String,String>)copy;
-
-        nsMap = Collections.unmodifiableMap(temp);
+        Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
+                                                            String.class,
+                                                            String.class);
+        tempMap.putAll(namespaceMap);
+        this.nsMap = Collections.unmodifiableMap(tempMap);
     }
 
     /**
@@ -125,8 +114,7 @@
      * @return a <code>Map</code> of namespace prefixes to namespace URIs (may
      *    be empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public Map getNamespaceMap() {
+    public Map<String,String> getNamespaceMap() {
         return nsMap;
     }
 }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
 package javax.xml.crypto.dsig.spec;
 
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -106,7 +105,7 @@
 
     private final String expression;
     private final Filter filter;
-    private Map<String,String> nsMap;
+    private final Map<String,String> nsMap;
 
     /**
      * Creates an <code>XPathType</code> instance with the specified XPath
@@ -147,26 +146,24 @@
      * @throws ClassCastException if any of the map's keys or entries are
      *    not of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathType(String expression, Filter filter, Map namespaceMap) {
-        this(expression, filter);
+    public XPathType(String expression, Filter filter,
+        Map<String,String> namespaceMap) {
+        if (expression == null) {
+            throw new NullPointerException("expression cannot be null");
+        }
+        if (filter == null) {
+            throw new NullPointerException("filter cannot be null");
+        }
         if (namespaceMap == null) {
             throw new NullPointerException("namespaceMap cannot be null");
         }
-        Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap);
-        Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry<?,?> me = entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        Map<String,String> temp = (Map<String,String>)copy;
-
-        nsMap = Collections.unmodifiableMap(temp);
+        this.expression = expression;
+        this.filter = filter;
+        Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
+                                                            String.class,
+                                                            String.class);
+        tempMap.putAll(namespaceMap);
+        this.nsMap = Collections.unmodifiableMap(tempMap);
     }
 
     /**
@@ -198,8 +195,7 @@
      * @return a <code>Map</code> of namespace prefixes to namespace URIs
      *    (may be empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public Map getNamespaceMap() {
+    public Map<String,String> getNamespaceMap() {
         return nsMap;
     }
 }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java	Fri Nov 21 15:23:36 2014 -0500
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: ApacheCanonicalizer.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -166,11 +166,9 @@
                          (subTree.getRoot())));
                 }
             } else if (data instanceof NodeSetData) {
-                NodeSetData nsd = (NodeSetData)data;
-                // convert Iterator to Set
-                @SuppressWarnings("unchecked")
-                Set<Node> ns = Utils.toNodeSet(nsd.iterator());
-                nodeSet = ns;
+                NodeSetData<?> nsd = (NodeSetData<?>)data;
+                // convert Iterator to Set<Node>
+                nodeSet = Utils.toNodeSet(nsd.iterator());
                 if (log.isLoggable(java.util.logging.Level.FINE)) {
                     log.log(java.util.logging.Level.FINE, "Canonicalizing " + nodeSet.size() + " nodes");
                 }
@@ -236,7 +234,6 @@
                 in = new XMLSignatureInput(subTree.getRoot());
                 in.setExcludeComments(subTree.excludeComments());
             } else {
-                @SuppressWarnings("unchecked")
                 Set<Node> nodeSet =
                     Utils.toNodeSet(((NodeSetData)data).iterator());
                 in = new XMLSignatureInput(nodeSet);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java	Fri Nov 21 15:23:36 2014 -0500
@@ -39,7 +39,7 @@
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
-public class ApacheNodeSetData implements ApacheData, NodeSetData {
+public class ApacheNodeSetData implements ApacheData, NodeSetData<Node> {
 
     private XMLSignatureInput xi;
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Fri Nov 21 15:23:36 2014 -0500
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: ApacheTransform.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -175,7 +175,6 @@
                 in = new XMLSignatureInput(subTree.getRoot());
                 in.setExcludeComments(subTree.excludeComments());
             } else {
-                @SuppressWarnings("unchecked")
                 Set<Node> nodeSet =
                     Utils.toNodeSet(((NodeSetData)data).iterator());
                 in = new XMLSignatureInput(nodeSet);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java	Fri Nov 21 15:23:36 2014 -0500
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMExcC14NMethod.java 1197150 2011-11-03 14:34:57Z coheigea $
@@ -119,7 +119,6 @@
 
         ExcC14NParameterSpec params = (ExcC14NParameterSpec)spec;
         StringBuilder prefixListAttr = new StringBuilder("");
-        @SuppressWarnings("unchecked")
         List<String> prefixList = params.getPrefixList();
         for (int i = 0, size = prefixList.size(); i < size; i++) {
             prefixListAttr.append(prefixList.get(i));
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java	Fri Nov 21 15:23:36 2014 -0500
@@ -68,17 +68,14 @@
         if (content == null) {
             throw new NullPointerException("content cannot be null");
         }
-        this.keyInfoTypes =
-            Collections.unmodifiableList(new ArrayList<XMLStructure>(content));
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        tempList.addAll(content);
+        this.keyInfoTypes = Collections.unmodifiableList(tempList);
         if (this.keyInfoTypes.isEmpty()) {
             throw new IllegalArgumentException("content cannot be empty");
         }
-        for (int i = 0, size = this.keyInfoTypes.size(); i < size; i++) {
-            if (!(this.keyInfoTypes.get(i) instanceof XMLStructure)) {
-                throw new ClassCastException
-                    ("content["+i+"] is not a valid KeyInfo type");
-            }
-        }
         this.id = id;
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Fri Nov 21 15:23:36 2014 -0500
@@ -34,6 +34,7 @@
 import java.util.List;
 import javax.xml.crypto.*;
 import javax.xml.crypto.dom.DOMCryptoContext;
+import javax.xml.crypto.dsig.Transform;
 import javax.xml.crypto.dsig.keyinfo.*;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -48,13 +49,11 @@
 
     public DOMKeyInfoFactory() { }
 
-    @SuppressWarnings("rawtypes")
-    public KeyInfo newKeyInfo(List content) {
+    public KeyInfo newKeyInfo(List<? extends XMLStructure> content) {
         return newKeyInfo(content, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public KeyInfo newKeyInfo(List content, String id) {
+    public KeyInfo newKeyInfo(List<? extends XMLStructure> content, String id) {
         return new DOMKeyInfo(content, id);
     }
 
@@ -79,13 +78,13 @@
         return newPGPData(keyId, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) {
+    public PGPData newPGPData(byte[] keyId, byte[] keyPacket,
+        List<? extends XMLStructure> other) {
         return new DOMPGPData(keyId, keyPacket, other);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public PGPData newPGPData(byte[] keyPacket, List other) {
+    public PGPData newPGPData(byte[] keyPacket,
+        List<? extends XMLStructure> other) {
         return new DOMPGPData(keyPacket, other);
     }
 
@@ -93,17 +92,15 @@
         return newRetrievalMethod(uri, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public RetrievalMethod newRetrievalMethod(String uri, String type,
-        List transforms) {
+        List<? extends Transform> transforms) {
         if (uri == null) {
             throw new NullPointerException("uri must not be null");
         }
         return new DOMRetrievalMethod(uri, type, transforms);
     }
 
-    @SuppressWarnings("rawtypes")
-    public X509Data newX509Data(List content) {
+    public X509Data newX509Data(List<?> content) {
         return new DOMX509Data(content);
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Fri Nov 21 15:23:36 2014 -0500
@@ -33,7 +33,6 @@
 import javax.xml.crypto.dsig.*;
 import javax.xml.crypto.dsig.keyinfo.KeyValue;
 
-// import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.security.AccessController;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Fri Nov 21 15:23:36 2014 -0500
@@ -67,18 +67,15 @@
         if (references == null) {
             throw new NullPointerException("references cannot be null");
         }
-        this.references =
-            Collections.unmodifiableList(new ArrayList<Reference>(references));
+        List<Reference> tempList =
+            Collections.checkedList(new ArrayList<Reference>(),
+                                    Reference.class);
+        tempList.addAll(references);
+        this.references = Collections.unmodifiableList(tempList);
         if (this.references.isEmpty()) {
             throw new IllegalArgumentException("list of references must " +
                 "contain at least one entry");
         }
-        for (int i = 0, size = this.references.size(); i < size; i++) {
-            if (!(this.references.get(i) instanceof Reference)) {
-                throw new ClassCastException
-                    ("references["+i+"] is not a valid type");
-            }
-        }
         this.id = id;
     }
 
@@ -127,7 +124,6 @@
         return id;
     }
 
-    @SuppressWarnings("unchecked")
     static List<Reference> getManifestReferences(Manifest mf) {
         return mf.getReferences();
     }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java	Fri Nov 21 15:23:36 2014 -0500
@@ -73,18 +73,13 @@
         if (keyPacket == null) {
             throw new NullPointerException("keyPacket cannot be null");
         }
-        if (other == null || other.isEmpty()) {
-            this.externalElements = Collections.emptyList();
-        } else {
-            this.externalElements =
-                Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
-            for (int i = 0, size = this.externalElements.size(); i < size; i++) {
-                if (!(this.externalElements.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("other["+i+"] is not a valid PGPData type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (other != null) {
+            tempList.addAll(other);
         }
+        this.externalElements = Collections.unmodifiableList(tempList);
         this.keyPacket = keyPacket.clone();
         checkKeyPacket(keyPacket);
         this.keyId = null;
@@ -120,18 +115,13 @@
         if (keyId.length != 8) {
             throw new IllegalArgumentException("keyId must be 8 bytes long");
         }
-        if (other == null || other.isEmpty()) {
-            this.externalElements = Collections.emptyList();
-        } else {
-            this.externalElements =
-                Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
-            for (int i = 0, size = this.externalElements.size(); i < size; i++) {
-                if (!(this.externalElements.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("other["+i+"] is not a valid PGPData type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (other != null) {
+            tempList.addAll(other);
         }
+        this.externalElements = Collections.unmodifiableList(tempList);
         this.keyId = keyId.clone();
         this.keyPacket = keyPacket == null ? null
                                            : keyPacket.clone();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Fri Nov 21 15:23:36 2014 -0500
@@ -147,29 +147,21 @@
         if (dm == null) {
             throw new NullPointerException("DigestMethod must be non-null");
         }
-        if (appliedTransforms == null) {
-            this.allTransforms = new ArrayList<Transform>();
-        } else {
-            this.allTransforms = new ArrayList<Transform>(appliedTransforms);
-            for (int i = 0, size = this.allTransforms.size(); i < size; i++) {
-                if (!(this.allTransforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("appliedTransforms["+i+"] is not a valid type");
-                }
-            }
+        List<Transform> tempList =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (appliedTransforms != null) {
+            tempList.addAll(appliedTransforms);
         }
-        if (transforms == null) {
-            this.transforms = Collections.emptyList();
-        } else {
-            this.transforms = new ArrayList<Transform>(transforms);
-            for (int i = 0, size = this.transforms.size(); i < size; i++) {
-                if (!(this.transforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("transforms["+i+"] is not a valid type");
-                }
-            }
-            this.allTransforms.addAll(this.transforms);
+        List<Transform> tempList2 =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (transforms != null) {
+            tempList.addAll(transforms);
+            tempList2.addAll(transforms);
         }
+        this.allTransforms = Collections.unmodifiableList(tempList);
+        this.transforms = tempList2;
         this.digestMethod = dm;
         this.uri = uri;
         if ((uri != null) && (!uri.equals(""))) {
@@ -642,7 +634,7 @@
             if (xsi.isNodeSet()) {
                 try {
                     final Set<Node> s = xsi.getNodeSet();
-                    return new NodeSetData() {
+                    return new NodeSetData<Node>() {
                         public Iterator<Node> iterator() { return s.iterator(); }
                     };
                 } catch (Exception e) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Fri Nov 21 15:23:36 2014 -0500
@@ -90,18 +90,13 @@
         if (uri == null) {
             throw new NullPointerException("uri cannot be null");
         }
-        if (transforms == null || transforms.isEmpty()) {
-            this.transforms = Collections.emptyList();
-        } else {
-            this.transforms = Collections.unmodifiableList(
-                new ArrayList<Transform>(transforms));
-            for (int i = 0, size = this.transforms.size(); i < size; i++) {
-                if (!(this.transforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("transforms["+i+"] is not a valid type");
-                }
-            }
+        List<Transform> tempList =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (transforms != null) {
+            tempList.addAll(transforms);
         }
+        this.transforms = Collections.unmodifiableList(tempList);
         this.uri = uri;
         if (!uri.equals("")) {
             try {
@@ -244,7 +239,7 @@
 
         // guard against RetrievalMethod loops
         if ((data instanceof NodeSetData) && Utils.secureValidation(context)) {
-            NodeSetData nsd = (NodeSetData)data;
+            NodeSetData<?> nsd = (NodeSetData<?>)data;
             Iterator<?> i = nsd.iterator();
             if (i.hasNext()) {
                 Node root = (Node)i.next();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Fri Nov 21 15:23:36 2014 -0500
@@ -69,18 +69,15 @@
     {
         if (properties == null) {
             throw new NullPointerException("properties cannot be null");
-        } else if (properties.isEmpty()) {
+        }
+        List<SignatureProperty> tempList =
+            Collections.checkedList(new ArrayList<SignatureProperty>(),
+                                    SignatureProperty.class);
+        tempList.addAll(properties);
+        if (tempList.isEmpty()) {
             throw new IllegalArgumentException("properties cannot be empty");
-        } else {
-            this.properties = Collections.unmodifiableList(
-                new ArrayList<SignatureProperty>(properties));
-            for (int i = 0, size = this.properties.size(); i < size; i++) {
-                if (!(this.properties.get(i) instanceof SignatureProperty)) {
-                    throw new ClassCastException
-                        ("properties["+i+"] is not a valid type");
-                }
-            }
         }
+        this.properties = Collections.unmodifiableList(tempList);
         this.id = id;
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java	Fri Nov 21 15:23:36 2014 -0500
@@ -71,20 +71,18 @@
     {
         if (target == null) {
             throw new NullPointerException("target cannot be null");
-        } else if (content == null) {
+        }
+        if (content == null) {
             throw new NullPointerException("content cannot be null");
-        } else if (content.isEmpty()) {
+        }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        tempList.addAll(content);
+        if (tempList.isEmpty()) {
             throw new IllegalArgumentException("content cannot be empty");
-        } else {
-            this.content = Collections.unmodifiableList(
-                new ArrayList<XMLStructure>(content));
-            for (int i = 0, size = this.content.size(); i < size; i++) {
-                if (!(this.content.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("content["+i+"] is not a valid type");
-                }
-            }
         }
+        this.content = Collections.unmodifiableList(tempList);
         this.target = target;
         this.id = id;
     }
@@ -169,7 +167,6 @@
         boolean idsEqual = (id == null ? osp.getId() == null
                                        : id.equals(osp.getId()));
 
-        @SuppressWarnings("unchecked")
         List<XMLStructure> ospContent = osp.getContent();
         return (equalsContent(ospContent) &&
                 target.equals(osp.getTarget()) && idsEqual);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Fri Nov 21 15:23:36 2014 -0500
@@ -100,19 +100,14 @@
         }
         this.canonicalizationMethod = cm;
         this.signatureMethod = sm;
-        this.references = Collections.unmodifiableList(
-            new ArrayList<Reference>(references));
-        if (this.references.isEmpty()) {
-            throw new IllegalArgumentException("list of references must " +
-                "contain at least one entry");
+        List<Reference> tempList =
+            Collections.checkedList(new ArrayList<Reference>(),
+                                    Reference.class);
+        tempList.addAll(references);
+        if (tempList.isEmpty()) {
+            throw new IllegalArgumentException("references cannot be empty");
         }
-        for (int i = 0, size = this.references.size(); i < size; i++) {
-            Object obj = this.references.get(i);
-            if (!(obj instanceof Reference)) {
-                throw new ClassCastException("list of references contains " +
-                    "an illegal type");
-            }
-        }
+        this.references = Collections.unmodifiableList(tempList);
     }
 
     /**
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java	Fri Nov 21 15:23:36 2014 -0500
@@ -44,7 +44,7 @@
  * directly on the subdocument and there is no need to convert it
  * first to an XPath node-set.
  */
-public class DOMSubTreeData implements NodeSetData {
+public class DOMSubTreeData implements NodeSetData<Node> {
 
     private boolean excludeComments;
     private Node root;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Fri Nov 21 15:23:36 2014 -0500
@@ -367,9 +367,7 @@
     private static boolean paramsEqual(XPathFilter2ParameterSpec spec1,
                                        XPathFilter2ParameterSpec spec2)
     {
-        @SuppressWarnings("unchecked")
         List<XPathType> types = spec1.getXPathList();
-        @SuppressWarnings("unchecked")
         List<XPathType> otypes = spec2.getXPathList();
         int size = types.size();
         if (size != otypes.size()) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java	Fri Nov 21 15:23:36 2014 -0500
@@ -135,7 +135,7 @@
         this.content = Collections.unmodifiableList(content);
     }
 
-    public List<Object> getContent() {
+    public List<?> getContent() {
         return content;
     }
 
@@ -265,7 +265,7 @@
         }
         X509Data oxd = (X509Data)o;
 
-        @SuppressWarnings("unchecked") List<Object> ocontent = oxd.getContent();
+        List<?> ocontent = oxd.getContent();
         int size = content.size();
         if (size != ocontent.size()) {
             return false;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java	Fri Nov 21 15:23:36 2014 -0500
@@ -70,18 +70,13 @@
     public DOMXMLObject(List<? extends XMLStructure> content, String id,
                         String mimeType, String encoding)
     {
-        if (content == null || content.isEmpty()) {
-            this.content = Collections.emptyList();
-        } else {
-            this.content = Collections.unmodifiableList(
-                new ArrayList<XMLStructure>(content));
-            for (int i = 0, size = this.content.size(); i < size; i++) {
-                if (!(this.content.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("content["+i+"] is not a valid type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (content != null) {
+            tempList.addAll(content);
         }
+        this.content = Collections.unmodifiableList(tempList);
         this.id = id;
         this.mimeType = mimeType;
         this.encoding = encoding;
@@ -204,7 +199,6 @@
             (mimeType == null ? oxo.getMimeType() == null
                               : mimeType.equals(oxo.getMimeType()));
 
-        @SuppressWarnings("unchecked")
         List<XMLStructure> oxoContent = oxo.getContent();
         return (idsEqual && encodingsEqual && mimeTypesEqual &&
                 equalsContent(oxoContent));
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Fri Nov 21 15:23:36 2014 -0500
@@ -109,18 +109,13 @@
         this.si = si;
         this.id = id;
         this.sv = new DOMSignatureValue(signatureValueId);
-        if (objs == null) {
-            this.objects = Collections.emptyList();
-        } else {
-            this.objects =
-                Collections.unmodifiableList(new ArrayList<XMLObject>(objs));
-            for (int i = 0, size = this.objects.size(); i < size; i++) {
-                if (!(this.objects.get(i) instanceof XMLObject)) {
-                    throw new ClassCastException
-                        ("objs["+i+"] is not an XMLObject");
-                }
-            }
+        List<XMLObject> tempList =
+            Collections.checkedList(new ArrayList<XMLObject>(),
+                                    XMLObject.class);
+        if (objs != null) {
+            tempList.addAll(objs);
         }
+        this.objects = Collections.unmodifiableList(tempList);
         this.ki = ki;
     }
 
@@ -270,7 +265,6 @@
         }
 
         // validate all References
-        @SuppressWarnings("unchecked")
         List<Reference> refs = this.si.getReferences();
         boolean validateRefs = true;
         for (int i = 0, size = refs.size(); validateRefs && i < size; i++) {
@@ -297,7 +291,6 @@
         {
             for (int i=0, size=objects.size(); validateMans && i < size; i++) {
                 XMLObject xo = objects.get(i);
-                @SuppressWarnings("unchecked")
                 List<XMLStructure> content = xo.getContent();
                 int csize = content.size();
                 for (int j = 0; validateMans && j < csize; j++) {
@@ -307,7 +300,6 @@
                             log.log(java.util.logging.Level.FINE, "validating manifest");
                         }
                         Manifest man = (Manifest)xs;
-                        @SuppressWarnings("unchecked")
                         List<Reference> manRefs = man.getReferences();
                         int rsize = manRefs.size();
                         for (int k = 0; validateMans && k < rsize; k++) {
@@ -348,20 +340,17 @@
         signatureIdMap = new HashMap<String, XMLStructure>();
         signatureIdMap.put(id, this);
         signatureIdMap.put(si.getId(), si);
-        @SuppressWarnings("unchecked")
         List<Reference> refs = si.getReferences();
         for (Reference ref : refs) {
             signatureIdMap.put(ref.getId(), ref);
         }
         for (XMLObject obj : objects) {
             signatureIdMap.put(obj.getId(), obj);
-            @SuppressWarnings("unchecked")
             List<XMLStructure> content = obj.getContent();
             for (XMLStructure xs : content) {
                 if (xs instanceof Manifest) {
                     Manifest man = (Manifest)xs;
                     signatureIdMap.put(man.getId(), man);
-                    @SuppressWarnings("unchecked")
                     List<Reference> manRefs = man.getReferences();
                     for (Reference ref : manRefs) {
                         allReferences.add(ref);
@@ -483,7 +472,6 @@
             // reference dependencies in the XPath Transform - so be on
             // the safe side, and skip and do at end in the final sweep
             if (uri.length() == 0) {
-                @SuppressWarnings("unchecked")
                 List<Transform> transforms = ref.getTransforms();
                 for (Transform transform : transforms) {
                     String transformAlg = transform.getAlgorithm();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Fri Nov 21 15:23:36 2014 -0500
@@ -58,9 +58,8 @@
         return new DOMXMLSignature(si, ki, null, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
-        List objects, String id, String signatureValueId) {
+        List<? extends XMLObject> objects, String id, String signatureValueId) {
         return new DOMXMLSignature(si, ki, objects, id, signatureValueId);
     }
 
@@ -68,16 +67,14 @@
         return newReference(uri, dm, null, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Reference newReference(String uri, DigestMethod dm, List transforms,
-        String type, String id) {
+    public Reference newReference(String uri, DigestMethod dm,
+        List<? extends Transform> transforms, String type, String id) {
         return new DOMReference(uri, type, dm, transforms, id, getProvider());
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public Reference newReference(String uri, DigestMethod dm,
-        List appliedTransforms, Data result, List transforms, String type,
-        String id) {
+        List<? extends Transform> appliedTransforms, Data result,
+        List<? extends Transform> transforms, String type, String id) {
         if (appliedTransforms == null) {
             throw new NullPointerException("appliedTransforms cannot be null");
         }
@@ -91,9 +88,9 @@
             (uri, type, dm, appliedTransforms, result, transforms, id, getProvider());
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Reference newReference(String uri, DigestMethod dm, List transforms,
-        String type, String id, byte[] digestValue) {
+    public Reference newReference(String uri, DigestMethod dm,
+        List<? extends Transform> transforms, String type, String id,
+        byte[] digestValue) {
         if (digestValue == null) {
             throw new NullPointerException("digestValue cannot be null");
         }
@@ -101,43 +98,38 @@
             (uri, type, dm, null, null, transforms, id, digestValue, getProvider());
     }
 
-    @SuppressWarnings("rawtypes")
     public SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references) {
+        SignatureMethod sm, List<? extends Reference> references) {
         return newSignedInfo(cm, sm, references, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references, String id) {
+        SignatureMethod sm, List<? extends Reference> references, String id) {
         return new DOMSignedInfo(cm, sm, references, id);
     }
 
     // Object factory methods
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public XMLObject newXMLObject(List content, String id, String mimeType,
-        String encoding) {
+    public XMLObject newXMLObject(List<? extends XMLStructure> content,
+        String id, String mimeType, String encoding) {
         return new DOMXMLObject(content, id, mimeType, encoding);
     }
 
-    @SuppressWarnings("rawtypes")
-    public Manifest newManifest(List references) {
+    public Manifest newManifest(List<? extends Reference> references) {
         return newManifest(references, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Manifest newManifest(List references, String id) {
+    public Manifest newManifest(List<? extends Reference> references,
+        String id) {
         return new DOMManifest(references, id);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public SignatureProperties newSignatureProperties(List props, String id) {
+    public SignatureProperties newSignatureProperties(
+        List<? extends SignatureProperty> props, String id) {
         return new DOMSignatureProperties(props, id);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public SignatureProperty newSignatureProperty
-        (List info, String target, String id) {
+        (List<? extends XMLStructure> info, String target, String id) {
         return new DOMSignatureProperty(info, target, id);
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java	Fri Nov 21 15:23:36 2014 -0500
@@ -133,7 +133,6 @@
         String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
         String qname = (prefix == null || prefix.length() == 0)
                        ? "xmlns" : "xmlns:" + prefix;
-        @SuppressWarnings("unchecked")
         List<XPathType> xpathList = xp.getXPathList();
         for (XPathType xpathType : xpathList) {
             Element elem = DOMUtils.createElement(ownerDoc, "XPath",
@@ -146,7 +145,6 @@
                                 Transform.XPATH2);
 
             // add namespace attributes, if necessary
-            @SuppressWarnings("unchecked")
             Set<Map.Entry<String, String>> entries =
                 xpathType.getNamespaceMap().entrySet();
             for (Map.Entry<String, String> entry : entries) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java	Fri Nov 21 15:23:36 2014 -0500
@@ -99,7 +99,6 @@
         xpathElem.appendChild(ownerDoc.createTextNode(xp.getXPath()));
 
         // add namespace attributes, if necessary
-        @SuppressWarnings("unchecked")
         Set<Map.Entry<String, String>> entries =
             xp.getNamespaceMap().entrySet();
         for (Map.Entry<String, String> entry : entries) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java	Fri Nov 21 15:23:36 2014 -0500
@@ -70,10 +70,10 @@
      * @param i the Iterator
      * @return the Set of Nodes
      */
-    static Set<Node> toNodeSet(Iterator<Node> i) {
+    static Set<Node> toNodeSet(Iterator<?> i) {
         Set<Node> nodeSet = new HashSet<Node>();
         while (i.hasNext()) {
-            Node n = i.next();
+            Node n = (Node)i.next();
             nodeSet.add(n);
             // insert attributes nodes to comply with XPath
             if (n.getNodeType() == Node.ELEMENT_NODE) {
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Fri Nov 21 15:23:36 2014 -0500
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349
+ * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -377,7 +377,7 @@
 
     static void test_create_signature_x509_crt_crl() throws Exception {
         System.out.println("* Generating signature-x509-crt-crl.xml");
-        List<Object> xds = new ArrayList<Object>();
+        List<Object> xds = new ArrayList<>();
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
         xds.add(signingCert);
         FileInputStream fis = new FileInputStream(CRL);
@@ -444,7 +444,7 @@
         SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs);
 
         // create objects
-        List<XMLStructure> objs = new ArrayList<XMLStructure>();
+        List<XMLObject> objs = new ArrayList<>();
 
         // Object 1
         List<Reference> manRefs = Collections.singletonList
@@ -559,7 +559,7 @@
         System.out.println("* Generating signature.xml");
 
         // create references
-        List<Reference> refs = new ArrayList<Reference>();
+        List<Reference> refs = new ArrayList<>();
 
         // Reference 1
         refs.add(fac.newReference(STYLESHEET, sha1));
@@ -610,7 +610,7 @@
             SignatureProperties.TYPE, null));
 
         // Reference 8
-        List<Transform> transforms = new ArrayList<Transform>();
+        List<Transform> transforms = new ArrayList<>();
         transforms.add(fac.newTransform
             (Transform.ENVELOPED, (TransformParameterSpec) null));
         refs.add(fac.newReference("", sha1, transforms, null, null));
@@ -685,7 +685,7 @@
         Document doc = db.newDocument();
 
         // create objects
-        List<XMLStructure> objs = new ArrayList<XMLStructure>();
+        List<XMLObject> objs = new ArrayList<>();
 
         // Object 1
         objs.add(fac.newXMLObject(Collections.singletonList
@@ -705,7 +705,7 @@
             (new DOMStructure(nc)), "object-3", null, null));
 
         // Manifest
-        List<Reference> manRefs = new ArrayList<Reference>();
+        List<Reference> manRefs = new ArrayList<>();
 
         // Manifest Reference 1
         manRefs.add(fac.newReference(STYLESHEET,
@@ -715,7 +715,7 @@
         manRefs.add(fac.newReference("#reference-1", sha1));
 
         // Manifest Reference 3
-        List<Transform> manTrans = new ArrayList<Transform>();
+        List<Transform> manTrans = new ArrayList<>();
         String xslt = ""
           + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
           + "            xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
@@ -770,7 +770,7 @@
             null, null));
 
         // Object 4
-        List<Object> xds = new ArrayList<Object>();
+        List<Object> xds = new ArrayList<>();
         xds.add("CN=User");
         xds.add(kifac.newX509IssuerSerial
             ("CN=User", new BigInteger("45ef2729", 16)));
@@ -930,7 +930,7 @@
 
     static void test_create_exc_signature() throws Exception {
         System.out.println("* Generating exc_signature.xml");
-        List<Reference> refs = new ArrayList<Reference>(4);
+        List<Reference> refs = new ArrayList<>(4);
 
         // create reference 1
         refs.add(fac.newReference
@@ -942,7 +942,7 @@
              null, null));
 
         // create reference 2
-        List<String> prefixList = new ArrayList<String>(2);
+        List<String> prefixList = new ArrayList<>(2);
         prefixList.add("bar");
         prefixList.add("#default");
         ExcC14NParameterSpec params = new ExcC14NParameterSpec(prefixList);
@@ -963,7 +963,7 @@
              null, null));
 
         // create reference 4
-        prefixList = new ArrayList<String>(2);
+        prefixList = new ArrayList<>(2);
         prefixList.add("bar");
         prefixList.add("#default");
         params = new ExcC14NParameterSpec(prefixList);
@@ -982,7 +982,7 @@
             fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs);
 
         // create KeyInfo
-        List<XMLStructure> kits = new ArrayList<XMLStructure>(2);
+        List<XMLStructure> kits = new ArrayList<>(2);
         kits.add(kifac.newKeyValue(validatingKey));
         KeyInfo ki = kifac.newKeyInfo(kits);
 
@@ -1027,10 +1027,10 @@
 
     static void test_create_sign_spec() throws Exception {
         System.out.println("* Generating sign-spec.xml");
-        List<Reference> refs = new ArrayList<Reference>(2);
+        List<Reference> refs = new ArrayList<>(2);
 
         // create reference 1
-        List<XPathType> types = new ArrayList<XPathType>(3);
+        List<XPathType> types = new ArrayList<>(3);
         types.add(new XPathType(" //ToBeSigned ", XPathType.Filter.INTERSECT));
         types.add(new XPathType(" //NotToBeSigned ",
             XPathType.Filter.SUBTRACT));
@@ -1043,7 +1043,7 @@
              null, null));
 
         // create reference 2
-        List<Transform> trans2 = new ArrayList<Transform>(2);
+        List<Transform> trans2 = new ArrayList<>(2);
         trans2.add(fac.newTransform(Transform.ENVELOPED,
             (TransformParameterSpec) null));
         XPathFilter2ParameterSpec xp2 = new XPathFilter2ParameterSpec
@@ -1061,9 +1061,9 @@
             fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs);
 
         // create KeyInfo
-        List<XMLStructure> kits = new ArrayList<XMLStructure>(2);
+        List<XMLStructure> kits = new ArrayList<>(2);
         kits.add(kifac.newKeyValue(validatingKey));
-        List<Object> xds = new ArrayList<Object>(2);
+        List<Object> xds = new ArrayList<>(2);
         xds.add("CN=User");
         xds.add(signingCert);
         kits.add(kifac.newX509Data(xds));
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Fri Nov 21 15:23:36 2014 -0500
@@ -101,9 +101,7 @@
                 throw new KeySelectorException("Null KeyInfo object!");
             }
             // search for X509Data in keyinfo
-            Iterator iter = keyInfo.getContent().iterator();
-            while (iter.hasNext()) {
-                XMLStructure kiType = (XMLStructure) iter.next();
+            for (XMLStructure kiType : keyInfo.getContent()) {
                 if (kiType instanceof X509Data) {
                     X509Data xd = (X509Data) kiType;
                     Object[] entries = xd.getContent().toArray();
@@ -114,10 +112,8 @@
                             crl = (X509CRL) entries[i];
                         }
                     }
-                    Iterator xi = xd.getContent().iterator();
                     boolean hasCRL = false;
-                    while (xi.hasNext()) {
-                        Object o = xi.next();
+                    for (Object o : xd.getContent()) {
                         // skip non-X509Certificate entries
                         if (o instanceof X509Certificate) {
                             if ((purpose != KeySelector.Purpose.VERIFY) &&
@@ -152,10 +148,8 @@
                 throw new KeySelectorException("Null KeyInfo object!");
             }
             SignatureMethod sm = (SignatureMethod) method;
-            List list = keyInfo.getContent();
 
-            for (int i = 0; i < list.size(); i++) {
-                XMLStructure xmlStructure = (XMLStructure) list.get(i);
+            for (XMLStructure xmlStructure : keyInfo.getContent()) {
                 if (xmlStructure instanceof KeyValue) {
                     PublicKey pk = null;
                     try {
@@ -282,9 +276,7 @@
             if (keyInfo == null) {
                 throw new KeySelectorException("Null KeyInfo object!");
             }
-            Iterator iter = keyInfo.getContent().iterator();
-            while (iter.hasNext()) {
-                XMLStructure xmlStructure = (XMLStructure) iter.next();
+            for (XMLStructure xmlStructure : keyInfo.getContent()) {
                 try {
                     if (xmlStructure instanceof KeyName) {
                         String name = ((KeyName)xmlStructure).getName();
@@ -330,14 +322,12 @@
                         }
                     } else if (xmlStructure instanceof X509Data) {
                         List content = ((X509Data)xmlStructure).getContent();
-                        int size = content.size();
                         Vector<X509Certificate> result = null;
                         // Lookup the public key using the information
                         // specified in X509Data element, i.e. searching
                         // over the collection of certificate files under
                         // "certs" subdirectory and return those match.
-                        for (int k = 0; k<size; k++) {
-                            Object obj = content.get(k);
+                        for (Object obj : content) {
                             if (obj instanceof String) {
                                 result = match(MATCH_SUBJECT, obj, certs);
                             } else if (obj instanceof byte[]) {
--- a/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java	Fri Nov 21 15:23:36 2014 -0500
@@ -78,9 +78,10 @@
 
         // Check reference cache
         if (cache) {
-            Iterator i = signature.getSignedInfo().getReferences().iterator();
-            for (int j=0; i.hasNext(); j++) {
-                Reference ref = (Reference) i.next();
+            Iterator<Reference> i =
+                signature.getSignedInfo().getReferences().iterator();
+            for (int j = 0; i.hasNext(); j++) {
+                Reference ref = i.next();
                 if (!digestInputEqual(ref)) {
                     throw new Exception
                         ("cached data for Reference[" + j + "] is not correct");
@@ -88,10 +89,10 @@
                 // check that dereferenced data does not contain comment nodes
                 if (ref.getURI() == "") {
                     System.out.println("checking deref data");
-                    NodeSetData data = (NodeSetData) ref.getDereferencedData();
-                    Iterator ni = data.iterator();
-                    while (ni.hasNext()) {
-                        Node n = (Node) ni.next();
+                    @SuppressWarnings("unchecked")
+                    NodeSetData<Node> data =
+                        (NodeSetData<Node>)ref.getDereferencedData();
+                    for (Node n : data) {
                         if (n.getNodeType() == Node.COMMENT_NODE) {
                             throw new Exception("dereferenced data for " +
                                 " Reference[" + j + " contains comment node");
--- a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java	Fri Nov 21 16:05:11 2014 +0100
+++ b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java	Fri Nov 21 15:23:36 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,9 +139,7 @@
             }
 
             // Iterate through KeyInfo types
-            Iterator i = keyInfo.getContent().iterator();
-            while (i.hasNext()) {
-                XMLStructure kiType = (XMLStructure) i.next();
+            for (XMLStructure kiType : keyInfo.getContent()) {
                 // check X509Data
                 if (kiType instanceof X509Data) {
                     X509Data xd = (X509Data) kiType;
@@ -303,9 +301,7 @@
         }
         Collection<X509Certificate> certs = new ArrayList<>();
 
-        Iterator xi = xd.getContent().iterator();
-        while (xi.hasNext()) {
-            Object o = xi.next();
+        for (Object o : xd.getContent()) {
             // check X509IssuerSerial
             if (o instanceof X509IssuerSerial) {
                 X509IssuerSerial xis = (X509IssuerSerial) o;