Skip to content

Commit e6d04dd

Browse files
authored
Merge pull request #104 from keithc-ca/warnings
Fix warnings in openj9 java code patches
2 parents 5f17c4d + 0d7e57f commit e6d04dd

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

src/java.base/share/classes/java/io/ObjectInputStream.java

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,12 @@ private static class Logging {
366366
* read* requests
367367
*/
368368

369-
/* ClassByNameCache Entry for caching class.forName results upon enableClassCaching */
370-
private static final ClassByNameCache classByNameCache;
371-
private static final boolean isClassCachingEnabled;
372-
static {
373-
isClassCachingEnabled =
369+
@SuppressWarnings("removal")
370+
private static final boolean isClassCachingEnabled =
374371
AccessController.doPrivileged(new GetClassCachingSettingAction());
375-
classByNameCache = (isClassCachingEnabled ? new ClassByNameCache() : null);
376-
}
377-
372+
/* ClassByNameCache Entry for caching class.forName results upon enableClassCaching */
373+
private static final ClassByNameCache classByNameCache =
374+
isClassCachingEnabled ? new ClassByNameCache() : null;
378375

379376
/** if true LUDCL/forName results would be cached, true by default starting Java8 */
380377
private static final class GetClassCachingSettingAction
@@ -513,12 +510,12 @@ public final Object readObject()
513510
* latestUserDefinedLoader().
514511
*
515512
* @throws ClassNotFoundException if the class of a serialized object
516-
* could not be found.
513+
* could not be found.
517514
* @throws IOException if an I/O error occurs.
518515
*
519516
*/
520517

521-
private static Object redirectedReadObject(ObjectInputStream iStream, Class caller)
518+
private static Object redirectedReadObject(ObjectInputStream iStream, Class<?> caller)
522519
throws ClassNotFoundException, IOException
523520
{
524521
return iStream.readObject(Object.class, caller);
@@ -556,7 +553,7 @@ private String readString() throws IOException {
556553
* @throws ClassNotFoundException Class of a serialized object cannot be
557554
* found.
558555
*/
559-
private final Object readObject(Class<?> type, Class caller)
556+
private final Object readObject(Class<?> type, Class<?> caller)
560557
throws IOException, ClassNotFoundException
561558
{
562559
if (enableOverride) {
@@ -567,17 +564,17 @@ private final Object readObject(Class<?> type, Class caller)
567564
throw new AssertionError("internal error");
568565

569566
ClassLoader oldCachedLudcl = null;
570-
boolean setCached = false;
571-
572-
if (((null == curContext) || refreshLudcl) && (isClassCachingEnabled)) {
567+
boolean setCached = false;
568+
569+
if (((null == curContext) || refreshLudcl) && isClassCachingEnabled) {
573570
oldCachedLudcl = cachedLudcl;
574571

575572
// If caller is not provided, follow the standard path to get the cachedLudcl.
576573
// Otherwise use the class loader provided by JIT as the cachedLudcl.
577574

578575
if (caller == null) {
579576
cachedLudcl = latestUserDefinedLoader();
580-
}else{
577+
} else {
581578
cachedLudcl = caller.getClassLoader();
582579
}
583580

@@ -693,9 +690,9 @@ protected Object readObjectOverride()
693690
public Object readUnshared() throws IOException, ClassNotFoundException {
694691

695692
ClassLoader oldCachedLudcl = null;
696-
boolean setCached = false;
693+
boolean setCached = false;
697694

698-
if (((null == curContext) || refreshLudcl) && (isClassCachingEnabled)) {
695+
if (((null == curContext) || refreshLudcl) && isClassCachingEnabled) {
699696
oldCachedLudcl = cachedLudcl;
700697
cachedLudcl = latestUserDefinedLoader();
701698
setCached = true;

src/java.base/share/classes/java/lang/String.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/*
2727
* ===========================================================================
28-
* (c) Copyright IBM Corp. 2021, 2021 All Rights Reserved
28+
* (c) Copyright IBM Corp. 2021, 2022 All Rights Reserved
2929
* ===========================================================================
3030
*/
3131

@@ -1854,7 +1854,7 @@ private String(String s1, int v1) {
18541854
} while (quot != 0);
18551855

18561856
if (v1 < 0) {
1857-
helpers.putCharInArrayByIndex(value, index, (char) '-');
1857+
helpers.putCharInArrayByIndex(value, index, '-');
18581858
}
18591859

18601860
// Copy in s1 contents
@@ -2013,7 +2013,7 @@ private String(int v1, String s1, int v2, String s2, String s3) {
20132013
} while (quot2 != 0);
20142014

20152015
if (v2 < 0) {
2016-
helpers.putCharInArrayByIndex(value, index2--, (char) '-');
2016+
helpers.putCharInArrayByIndex(value, index2--, '-');
20172017
}
20182018

20192019
// Copy in s1 contents
@@ -2040,7 +2040,7 @@ private String(int v1, String s1, int v2, String s2, String s3) {
20402040
} while (quot1 != 0);
20412041

20422042
if (v1 < 0) {
2043-
helpers.putCharInArrayByIndex(value, index1--, (char) '-');
2043+
helpers.putCharInArrayByIndex(value, index1--, '-');
20442044
}
20452045

20462046
if (COMPACT_STRINGS) {

0 commit comments

Comments
 (0)