Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8291027

Some of TimeZone methods marked 'synchronized' unnecessarily

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 17, 20
    • core-libs
    • None

    Description

      There are 3 methods in 'java.util.TimeZone' class, which have suspicious 'synchronized' modifier on them.
      Seems that all of them are leftovers and can be removed.

      1.
          public static synchronized TimeZone getTimeZone(String ID) {
              return getTimeZone(ID, true);
          }

      This method doesn't modify any fields and just calls another method 'getTimeZone(String, boolean)'. Method 'getTimeZone(String, boolean)' is also called in another non-syncrhonized public TimeZone method - 'getTimeZone(ZoneId)'.

      2.
          public static synchronized String[] getAvailableIDs(int rawOffset) {
              return ZoneInfo.getAvailableIDs(rawOffset);
          }

      This method just call static method in 'ZoneInfo' class, which calls ZoneInfoFile method, which construct array from data initialized in <clinit>.

      3.
          public static synchronized String[] getAvailableIDs() {
              return ZoneInfo.getAvailableIDs();
          }

      This method just call static method in 'ZoneInfo' class, which calls ZoneInfoFile method, which construct array from data initialized in <clinit>.

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: