8250246: Address reliance on default constructors in security libs

Reviewed-by: mullan
This commit is contained in:
Joe Darcy 2020-07-24 13:49:38 -07:00
parent 9b73fb125d
commit 5db58348f8
29 changed files with 170 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -60,6 +60,11 @@ import java.security.spec.AlgorithmParameterSpec;
public abstract class AlgorithmParameterGeneratorSpi {
/**
* Constructor for subclasses to call.
*/
public AlgorithmParameterGeneratorSpi() {}
/**
* Initializes this parameter generator for a certain size
* and source of randomness.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -50,6 +50,11 @@ import java.security.spec.InvalidParameterSpecException;
public abstract class AlgorithmParametersSpi {
/**
* Constructor for subclasses to call.
*/
public AlgorithmParametersSpi() {}
/**
* Initializes this parameters object using the parameters
* specified in {@code paramSpec}.

View file

@ -69,6 +69,11 @@ import java.security.spec.InvalidKeySpecException;
public abstract class KeyFactorySpi {
/**
* Constructor for subclasses to call.
*/
public KeyFactorySpi() {}
/**
* Generates a public key object from the provided key
* specification (key material).

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -58,6 +58,11 @@ import java.security.spec.AlgorithmParameterSpec;
public abstract class KeyPairGeneratorSpi {
/**
* Constructor for subclasses to call.
*/
public KeyPairGeneratorSpi() {}
/**
* Initializes the key pair generator for a certain keysize, using
* the default parameter set.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -53,6 +53,11 @@ import javax.security.auth.callback.*;
public abstract class KeyStoreSpi {
/**
* Constructor for subclasses to call.
*/
public KeyStoreSpi() {}
/**
* Returns the key associated with the given alias, using the given
* password to recover it. The key must have been associated with

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -54,6 +54,11 @@ public abstract class MessageDigestSpi {
// for re-use in engineUpdate(ByteBuffer input)
private byte[] tempArray;
/**
* Constructor for subclasses to call.
*/
public MessageDigestSpi() {}
/**
* Returns the digest length in bytes.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -102,6 +102,11 @@ public abstract class PermissionCollection implements java.io.Serializable {
// when set, add will throw an exception.
private volatile boolean readOnly;
/**
* Constructor for subclasses to call.
*/
public PermissionCollection() {}
/**
* Adds a permission object to the current collection of permission objects.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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,11 @@ import sun.security.util.SecurityConstants;
public abstract class Policy {
/**
* Constructor for subclasses to call.
*/
public Policy() {}
/**
* A read-only empty PermissionCollection instance.
* @since 1.6

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -44,6 +44,11 @@ package java.security;
public abstract class PolicySpi {
/**
* Constructor for subclasses to call.
*/
public PolicySpi() {}
/**
* Check whether the policy has granted a Permission to a ProtectionDomain.
*

View file

@ -52,6 +52,11 @@ import sun.security.jca.JCAUtil;
public abstract class SignatureSpi {
/**
* Constructor for subclasses to call.
*/
public SignatureSpi() {}
/**
* Application-specified source of randomness.
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -65,6 +65,11 @@ import java.security.NoSuchProviderException;
public abstract class CertificateFactorySpi {
/**
* Constructor for subclasses to call.
*/
public CertificateFactorySpi() {}
/**
* Generates a certificate object and initializes it with
* the data read from the input stream {@code inStream}.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -67,6 +67,11 @@ import sun.security.x509.X509CRLEntryImpl;
public abstract class X509CRLEntry implements X509Extension {
/**
* Constructor for subclasses to call.
*/
public X509CRLEntry() {}
/**
* Compares this CRL entry for equality with the given
* object. If the {@code other} object is an