8316557: Make fields final in 'sun.util' package
Reviewed-by: pminborg, naoto
This commit is contained in:
parent
de51aa19d6
commit
6c5e15c1a2
src/java.base/share/classes/sun/util
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2023, 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
|
||||
@ -243,7 +243,7 @@ public abstract class PreHashedMap<V>
|
||||
|
||||
public Map.Entry<String,V> next() {
|
||||
return new Map.Entry<String,V>() {
|
||||
String k = i.next();
|
||||
final String k = i.next();
|
||||
public String getKey() { return k; }
|
||||
public V getValue() { return get(k); }
|
||||
public int hashCode() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, 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
|
||||
@ -35,7 +35,6 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -45,17 +44,13 @@ import java.util.Objects;
|
||||
*/
|
||||
public class PropertyResourceBundleCharset extends Charset {
|
||||
|
||||
private boolean strictUTF8 = false;
|
||||
private final boolean strictUTF8;
|
||||
|
||||
public PropertyResourceBundleCharset(boolean strictUTF8) {
|
||||
this(PropertyResourceBundleCharset.class.getCanonicalName(), null);
|
||||
super(PropertyResourceBundleCharset.class.getCanonicalName(), null);
|
||||
this.strictUTF8 = strictUTF8;
|
||||
}
|
||||
|
||||
public PropertyResourceBundleCharset(String canonicalName, String[] aliases) {
|
||||
super(canonicalName, aliases);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Charset cs) {
|
||||
return false;
|
||||
@ -73,7 +68,7 @@ public class PropertyResourceBundleCharset extends Charset {
|
||||
|
||||
private final class PropertiesFileDecoder extends CharsetDecoder {
|
||||
|
||||
private CharsetDecoder cdUTF_8 = UTF_8.INSTANCE.newDecoder()
|
||||
private final CharsetDecoder cdUTF_8 = UTF_8.INSTANCE.newDecoder()
|
||||
.onMalformedInput(CodingErrorAction.REPORT)
|
||||
.onUnmappableCharacter(CodingErrorAction.REPORT);
|
||||
private CharsetDecoder cdISO_8859_1 = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2023, 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
|
||||
@ -36,9 +36,9 @@ import java.util.Set;
|
||||
*/
|
||||
public class ResourceBundleEnumeration implements Enumeration<String> {
|
||||
|
||||
Set<String> set;
|
||||
Iterator<String> iterator;
|
||||
Enumeration<String> enumeration; // may remain null
|
||||
private final Set<String> set;
|
||||
private final Iterator<String> iterator;
|
||||
private final Enumeration<String> enumeration; // may remain null
|
||||
|
||||
/**
|
||||
* Constructs a resource bundle enumeration.
|
||||
|
@ -60,8 +60,8 @@ public final class LocalGregorianCalendar extends BaseCalendar {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String name;
|
||||
private Era[] eras;
|
||||
private final String name;
|
||||
private final Era[] eras;
|
||||
|
||||
// Used within java.time and java.util
|
||||
public static final class Date extends BaseCalendar.Date {
|
||||
|
@ -210,7 +210,7 @@ public final class ZoneInfoFile {
|
||||
|
||||
private static String versionId;
|
||||
private static final Map<String, ZoneInfo> zones = new ConcurrentHashMap<>();
|
||||
private static Map<String, String> aliases = new HashMap<>();
|
||||
private static final Map<String, String> aliases = new HashMap<>();
|
||||
|
||||
private static byte[][] ruleArray;
|
||||
private static String[] regions;
|
||||
@ -219,7 +219,7 @@ public final class ZoneInfoFile {
|
||||
// Flag for supporting JDK backward compatible IDs, such as "EST".
|
||||
private static final boolean USE_OLDMAPPING;
|
||||
|
||||
private static String[][] oldMappings = new String[][] {
|
||||
private static final String[][] oldMappings = new String[][] {
|
||||
{ "ACT", "Australia/Darwin" },
|
||||
{ "AET", "Australia/Sydney" },
|
||||
{ "AGT", "America/Argentina/Buenos_Aires" },
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, 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
|
||||
@ -27,14 +27,12 @@ package sun.util.cldr;
|
||||
|
||||
import static sun.util.locale.provider.LocaleProviderAdapter.Type;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import sun.util.locale.provider.LocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleResources;
|
||||
import sun.util.locale.provider.CalendarDataProviderImpl;
|
||||
import sun.util.locale.provider.CalendarDataUtility;
|
||||
|
||||
@ -47,8 +45,8 @@ import sun.util.locale.provider.CalendarDataUtility;
|
||||
*/
|
||||
public class CLDRCalendarDataProviderImpl extends CalendarDataProviderImpl {
|
||||
|
||||
private static Map<String, Integer> firstDay = new ConcurrentHashMap<>();
|
||||
private static Map<String, Integer> minDays = new ConcurrentHashMap<>();
|
||||
private static final Map<String, Integer> firstDay = new ConcurrentHashMap<>();
|
||||
private static final Map<String, Integer> minDays = new ConcurrentHashMap<>();
|
||||
|
||||
public CLDRCalendarDataProviderImpl(Type type, Set<String> langtags) {
|
||||
super(type, langtags);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023, 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,7 +60,7 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
||||
private final LocaleDataMetaInfo nonBaseMetaInfo;
|
||||
|
||||
// parent locales map
|
||||
private static volatile Map<Locale, Locale> parentLocalesMap;
|
||||
private static final Map<Locale, Locale> parentLocalesMap;
|
||||
// cache to hold locale to locale mapping for language aliases.
|
||||
private static final Map<Locale, Locale> langAliasesCache;
|
||||
// cache the available locales
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, 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
|
||||
@ -100,7 +100,7 @@ public abstract class LocaleObjectCache<K, V> {
|
||||
}
|
||||
|
||||
private static class CacheEntry<K, V> extends SoftReference<V> {
|
||||
private K key;
|
||||
private final K key;
|
||||
|
||||
CacheEntry(K key, V value, ReferenceQueue<V> queue) {
|
||||
super(value, queue);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, 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
|
||||
@ -36,7 +36,7 @@ public class LocaleSyntaxException extends Exception {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int index = -1;
|
||||
private final int index;
|
||||
|
||||
public LocaleSyntaxException(String msg) {
|
||||
this(msg, 0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, 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
|
||||
@ -31,9 +31,9 @@
|
||||
package sun.util.locale;
|
||||
|
||||
public class StringTokenIterator {
|
||||
private String text;
|
||||
private String dlms; // null if a single char delimiter
|
||||
private char delimiterChar; // delimiter if a single char delimiter
|
||||
private final String text;
|
||||
private final String dlms; // null if a single char delimiter
|
||||
private final char delimiterChar; // delimiter if a single char delimiter
|
||||
|
||||
private String token;
|
||||
private int start;
|
||||
@ -44,7 +44,9 @@ public class StringTokenIterator {
|
||||
this.text = text;
|
||||
if (dlms.length() == 1) {
|
||||
delimiterChar = dlms.charAt(0);
|
||||
this.dlms = null;
|
||||
} else {
|
||||
delimiterChar = 0;
|
||||
this.dlms = dlms;
|
||||
}
|
||||
setStart(0);
|
||||
@ -99,12 +101,6 @@ public class StringTokenIterator {
|
||||
return this;
|
||||
}
|
||||
|
||||
public StringTokenIterator setText(String text) {
|
||||
this.text = text;
|
||||
setStart(0);
|
||||
return this;
|
||||
}
|
||||
|
||||
private int nextDelimiter(int start) {
|
||||
int textlen = this.text.length();
|
||||
if (dlms == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user