8286378: Address possibly lossy conversions in java.base

Reviewed-by: naoto, xuelei, bpb, alanb
This commit is contained in:
Roger Riggs 2022-05-12 16:50:36 +00:00
parent 0a6832b24c
commit 17c52789b7
32 changed files with 68 additions and 71 deletions

View file

@ -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
@ -2323,11 +2323,11 @@ public class GregorianCalendar extends Calendar {
fixedDate += time / ONE_DAY;
timeOfDay += (int) (time % ONE_DAY);
if (timeOfDay >= ONE_DAY) {
timeOfDay -= ONE_DAY;
timeOfDay -= (int)ONE_DAY;
++fixedDate;
} else {
while (timeOfDay < 0) {
timeOfDay += ONE_DAY;
timeOfDay += (int)ONE_DAY;
--fixedDate;
}
}

View file

@ -1607,11 +1607,11 @@ class JapaneseImperialCalendar extends Calendar {
fixedDate += time / ONE_DAY;
timeOfDay += (int) (time % ONE_DAY);
if (timeOfDay >= ONE_DAY) {
timeOfDay -= ONE_DAY;
timeOfDay -= (int) ONE_DAY;
++fixedDate;
} else {
while (timeOfDay < 0) {
timeOfDay += ONE_DAY;
timeOfDay += (int) ONE_DAY;
--fixedDate;
}
}

View file

@ -152,7 +152,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
randomBytes[8] |= (byte) 0x80; /* set to IETF variant */
return new UUID(randomBytes);
}
@ -176,7 +176,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
md5Bytes[6] &= 0x0f; /* clear version */
md5Bytes[6] |= 0x30; /* set to version 3 */
md5Bytes[8] &= 0x3f; /* clear variant */
md5Bytes[8] |= 0x80; /* set to IETF variant */
md5Bytes[8] |= (byte) 0x80; /* set to IETF variant */
return new UUID(md5Bytes);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, 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
@ -533,7 +533,7 @@ public class Manifest implements Cloneable {
if (n > avail) {
n = avail;
}
pos += n;
pos += (int) n;
return n;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, 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
@ -2055,14 +2055,14 @@ final class Nodes {
else {
task.setPendingCount(task.node.getChildCount() - 1);
int size = 0;
long size = 0;
int i = 0;
for (;i < task.node.getChildCount() - 1; i++) {
K leftTask = task.makeChild(i, task.offset + size);
K leftTask = task.makeChild(i, (int) (task.offset + size));
size += leftTask.node.count();
leftTask.fork();
}
task = task.makeChild(i, task.offset + size);
task = task.makeChild(i, (int) (task.offset + size));
}
}
}