Code Review Request, JDK-8217820 Useless cast in ECUtil.java

Xuelei Fan xuelei.fan at oracle.com
Fri Jan 25 20:02:32 UTC 2019


Hi,

Can I have a code review for a trivial code cleanup?

   https://bugs.openjdk.java.net/browse/JDK-8217820

Thanks,
Xuelei

diff -r 1262a93634c2 
src/java.base/share/classes/sun/security/util/ECUtil.java
--- a/src/java.base/share/classes/sun/security/util/ECUtil.java Thu Jan 
24 12:52:37 2019 -0500
+++ b/src/java.base/share/classes/sun/security/util/ECUtil.java Fri Jan 
25 09:26:40 2019 -0800
@@ -31,7 +31,6 @@
  import java.security.interfaces.*;
  import java.security.spec.*;
  import java.util.Arrays;
-import sun.security.x509.X509Key;

  public class ECUtil {

@@ -103,7 +102,7 @@
              ECParameterSpec params) throws InvalidKeySpecException {
          KeyFactory keyFactory = getKeyFactory();
          ECPublicKeySpec keySpec = new ECPublicKeySpec(w, params);
-        X509Key key = (X509Key)keyFactory.generatePublic(keySpec);
+        Key key = keyFactory.generatePublic(keySpec);

          return key.getEncoded();
      }



More information about the security-dev mailing list