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

Simplify SegmentBulkOperations::powerOfProperty

    XMLWordPrintable

Details

    Description

      The method could be simplified like so:

          static int powerOfPropertyOr(String name, int defaultPower) {
              final String property = GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name, Integer.toString(defaultPower));
              try {
                  return 1 << Math.clamp(Integer.parseInt(property), 0, Integer.SIZE - 2);
              } catch (NumberFormatException _) {
                  // ignore
              }
              return defaultPower;
          }

      Attachments

        Issue Links

          Activity

            People

              pminborg Per-Ake Minborg
              pminborg Per-Ake Minborg
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: