8325189: Enable this-escape javac warning in java.base

Reviewed-by: alanb, erikj, naoto, smarks, ihse, joehw, lancea, weijun
This commit is contained in:
Joe Darcy 2024-02-07 20:05:11 +00:00
parent 299a8ee68d
commit fbd15b2087
93 changed files with 151 additions and 2 deletions

View file

@ -229,6 +229,7 @@ public class NetworkClient {
}
/** Create connection with host <i>host</i> on port <i>port</i> */
@SuppressWarnings("this-escape")
public NetworkClient(String host, int port) throws IOException {
openServer(host, port);
}

View file

@ -50,6 +50,7 @@ class MessageHeader {
grow();
}
@SuppressWarnings("this-escape")
public MessageHeader (InputStream is) throws java.io.IOException {
parseHeader(is);
}

View file

@ -677,6 +677,7 @@ public class DoubleByte {
return encodeBufferLoop(src, dst);
}
@SuppressWarnings("this-escape")
protected byte[] repl = replacement();
protected void implReplaceWith(byte[] newReplacement) {
repl = newReplacement;

View file

@ -355,6 +355,7 @@ public class HKSCS {
return encodeBufferLoop(src, dst);
}
@SuppressWarnings("this-escape")
private byte[] repl = replacement();
protected void implReplaceWith(byte[] newReplacement) {
repl = newReplacement;

View file

@ -402,6 +402,7 @@ public class PKCS9Attribute implements DerEncoder {
* @param derVal the DerValue representing the DER encoding of the attribute.
* @exception IOException on parsing error.
*/
@SuppressWarnings("this-escape")
public PKCS9Attribute(DerValue derVal) throws IOException {
DerInputStream derIn = new DerInputStream(derVal.toByteArray());

View file

@ -59,6 +59,7 @@ public class CtrDrbg extends AbstractDrbg {
private byte[] v;
private byte[] k;
@SuppressWarnings("this-escape")
public CtrDrbg(SecureRandomParameters params) {
mechName = "CTR_DRBG";
configure(params);

View file

@ -81,6 +81,7 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
* @param q DSA parameter q, may be null if all of p, q, and g are null.
* @param g DSA parameter g, may be null if all of p, q, and g are null.
*/
@SuppressWarnings("this-escape")
public DSAPublicKey(BigInteger y, BigInteger p, BigInteger q,
BigInteger g) {
this.y = y;
@ -95,6 +96,7 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
/**
* Make a DSA public key from its DER encoding (X.509).
*/
@SuppressWarnings("this-escape")
public DSAPublicKey(byte[] encoded) throws InvalidKeyException {
decode(encoded);
}

View file

@ -46,6 +46,7 @@ public class HashDrbg extends AbstractHashDrbg {
private byte[] v;
private byte[] c;
@SuppressWarnings("this-escape")
public HashDrbg(SecureRandomParameters params) {
mechName = "Hash_DRBG";
configure(params);

View file

@ -45,6 +45,7 @@ public class HmacDrbg extends AbstractHashDrbg {
private byte[] v;
private byte[] k;
@SuppressWarnings("this-escape")
public HmacDrbg(SecureRandomParameters params) {
mechName = "HMAC_DRBG";
configure(params);

View file

@ -115,6 +115,7 @@ public class BitArray {
* Create a BitArray whose bits are those of the given array
* of Booleans.
*/
@SuppressWarnings("this-escape")
public BitArray(boolean[] bits) {
length = bits.length;
repn = new byte[(length + 7)/8];

View file

@ -340,6 +340,7 @@ public class DerValue {
*
* This is a public constructor.
*/
@SuppressWarnings("this-escape")
public DerValue(byte[] encoding) throws IOException {
this(encoding.clone(), 0, encoding.length, true, false);
}
@ -487,6 +488,7 @@ public class DerValue {
* @param in the input stream holding a single DER datum,
* which may be followed by additional data
*/
@SuppressWarnings("this-escape")
public DerValue(InputStream in) throws IOException {
this(in, true);
}

View file

@ -70,6 +70,7 @@ public class ValidatorException extends CertificateException {
super(msg);
}
@SuppressWarnings("this-escape")
public ValidatorException(String msg, Throwable cause) {
super(msg);
initCause(cause);
@ -85,8 +86,9 @@ public class ValidatorException extends CertificateException {
this.cert = cert;
}
@SuppressWarnings("this-escape")
public ValidatorException(Object type, X509Certificate cert,
Throwable cause) {
Throwable cause) {
this(type, cert);
initCause(cause);
}
@ -97,6 +99,7 @@ public class ValidatorException extends CertificateException {
this.cert = cert;
}
@SuppressWarnings("this-escape")
public ValidatorException(String msg, Object type, X509Certificate cert,
Throwable cause) {
this(msg, type, cert);

View file

@ -123,6 +123,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
* @param oid the identifier for the algorithm.
* @param params the associated algorithm parameters, can be null.
*/
@SuppressWarnings("this-escape")
public AlgorithmId(ObjectIdentifier oid, DerValue params)
throws IOException {
this.algid = oid;

View file

@ -52,6 +52,7 @@ public class GeneralNames {
* @param derVal the DerValue to construct the GeneralNames from.
* @exception IOException on error.
*/
@SuppressWarnings("this-escape")
public GeneralNames(DerValue derVal) throws IOException {
this();
if (derVal.tag != DerValue.tag_Sequence) {

View file

@ -70,6 +70,7 @@ public class GeneralSubtrees implements Cloneable, DerEncoder {
*
* @param val the DER encoded form of the same.
*/
@SuppressWarnings("this-escape")
public GeneralSubtrees(DerValue val) throws IOException {
this();
if (val.tag != DerValue.tag_Sequence) {

View file

@ -50,6 +50,7 @@ public class RFC822Name implements GeneralNameInterface
* @param derValue the encoded DER RFC822Name.
* @exception IOException on error.
*/
@SuppressWarnings("this-escape")
public RFC822Name(DerValue derValue) throws IOException {
name = derValue.getIA5String();
parseName(name);
@ -61,6 +62,7 @@ public class RFC822Name implements GeneralNameInterface
* @param name the RFC822Name.
* @throws IOException on invalid input name
*/
@SuppressWarnings("this-escape")
public RFC822Name(String name) throws IOException {
parseName(name);
this.name = name;

View file

@ -125,6 +125,7 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
*
* @exception CRLException on parsing/construction errors.
*/
@SuppressWarnings("this-escape")
public TBSCertList(X500Name issuer, Date thisDate, Date nextDate,
X509CRLEntry[] badCerts)
throws CRLException
@ -175,6 +176,7 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
/**
* Constructs from the encoding.
*/
@SuppressWarnings("this-escape")
public TBSCertList(DerValue value) throws IOException, CRLException {
if (value.tag != DerValue.tag_Sequence)

View file

@ -45,6 +45,7 @@ public class FallbackLocaleProviderAdapter extends JRELocaleProviderAdapter {
/**
* Fallback provider only provides the ROOT locale data.
*/
@SuppressWarnings("this-escape")
private final LocaleResources rootLocaleResources =
new LocaleResources(this, Locale.ROOT);