mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8286378: Address possibly lossy conversions in java.base
Reviewed-by: naoto, xuelei, bpb, alanb
This commit is contained in:
parent
0a6832b24c
commit
17c52789b7
32 changed files with 68 additions and 71 deletions
|
@ -4866,7 +4866,7 @@ public final class Main {
|
|||
if (pos % 2 == 0) {
|
||||
data[pos/2] = (byte)(hex << 4);
|
||||
} else {
|
||||
data[pos/2] += hex;
|
||||
data[pos/2] += (byte)hex;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
@ -5338,4 +5338,3 @@ class Pair<A, B> {
|
|||
return new Pair<>(a,b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -142,9 +142,9 @@ public class BitArray {
|
|||
int bit = position(index);
|
||||
|
||||
if (value) {
|
||||
repn[idx] |= bit;
|
||||
repn[idx] |= (byte) bit;
|
||||
} else {
|
||||
repn[idx] &= ~bit;
|
||||
repn[idx] &= (byte) ~bit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -717,7 +717,7 @@ public class DerValue {
|
|||
byte[] retval = Arrays.copyOfRange(buffer, start + 1, end);
|
||||
if (numOfPadBits != 0) {
|
||||
// get rid of the padding bits
|
||||
retval[end - start - 2] &= (0xff << numOfPadBits);
|
||||
retval[end - start - 2] &= (byte)((0xff << numOfPadBits));
|
||||
}
|
||||
data.pos = data.end; // Compatibility. Reach end.
|
||||
return retval;
|
||||
|
|
|
@ -524,10 +524,10 @@ public final class ObjectIdentifier implements Serializable {
|
|||
|
||||
// and move them!
|
||||
out[opos/ow] |= // paste!
|
||||
(((in[ioffset+ipos/iw]+256) // locate the byte (+256 so that it's never negative)
|
||||
(byte)((((in[ioffset+ipos/iw]+256) // locate the byte (+256 so that it's never negative)
|
||||
>> (iw-ipos%iw-count)) & // move to the end of a byte
|
||||
((1 << (count))-1)) // zero out all other bits
|
||||
<< (ow-opos%ow-count); // move to the output position
|
||||
<< (ow-opos%ow-count)); // move to the output position
|
||||
ipos += count; // advance
|
||||
opos += count; // advance
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ public final class ObjectIdentifier implements Serializable {
|
|||
if (pack[i] != 0) {
|
||||
firstNonZero = i;
|
||||
}
|
||||
pack[i] |= 0x80;
|
||||
pack[i] |= (byte)0x80;
|
||||
}
|
||||
System.arraycopy(pack, firstNonZero,
|
||||
out, ooffset, pack.length-firstNonZero);
|
||||
|
|
|
@ -420,8 +420,8 @@ public abstract sealed class IntegerPolynomial implements IntegerFieldModuloP
|
|||
int bitsAdded = bitsPerLimb - bitPos;
|
||||
int bitsLeft = 8 - bitsAdded;
|
||||
|
||||
dst[dstIndex] += (curLimbValue & (0xFF >> bitsAdded))
|
||||
<< bitsAdded;
|
||||
dst[dstIndex] += (byte) ((curLimbValue & (0xFF >> bitsAdded))
|
||||
<< bitsAdded);
|
||||
curLimbValue >>= bitsLeft;
|
||||
bitPos = bitsLeft;
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, 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
|
||||
|
@ -190,12 +190,12 @@ public final class ZoneInfoFile {
|
|||
|
||||
char[] buf = new char[] { 'G', 'M', 'T', sign, '0', '0', ':', '0', '0' };
|
||||
if (hh >= 10) {
|
||||
buf[4] += hh / 10;
|
||||
buf[4] += (char)(hh / 10);
|
||||
}
|
||||
buf[5] += hh % 10;
|
||||
buf[5] += (char)(hh % 10);
|
||||
if (mm != 0) {
|
||||
buf[7] += mm / 10;
|
||||
buf[8] += mm % 10;
|
||||
buf[7] += (char)(mm / 10);
|
||||
buf[8] += (char)(mm % 10);
|
||||
}
|
||||
return new String(buf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue