diff --git a/src/main/java/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/src/main/java/com/google/common/escape/ArrayBasedUnicodeEscaper.java index 4fd5e35..374c9c7 100644 --- a/src/main/java/com/google/common/escape/ArrayBasedUnicodeEscaper.java +++ b/src/main/java/com/google/common/escape/ArrayBasedUnicodeEscaper.java @@ -1,28 +1,30 @@ package com.google.common.escape; public abstract class ArrayBasedUnicodeEscaper { - // The first code point in the safe range. + /*The first code point in the safe range.*/ private int safeMin; - // The last code point in the safe range. + /*The last code point in the safe range.*/ private int safeMax; private char safeMinChar; private char safeMaxChar; protected ArrayBasedUnicodeEscaper() { - // This is a bit of a hack but lets us do quicker per-character checks in - // the fast path code. The safe min/max values are very unlikely to extend - // into the range of surrogate characters, but if they do we must not test - // any values in that range. To see why, consider the case where: - // safeMin <= {hi,lo} <= safeMax - // where {hi,lo} are characters forming a surrogate pair such that: - // codePointOf(hi, lo) > safeMax - // which would result in the surrogate pair being (wrongly) considered safe. - // If we clip the safe range used during the per-character tests so it is - // below the values of characters in surrogate pairs, this cannot occur. - // This approach does mean that we break out of the fast path code in cases - // where we don't strictly need to, but this situation will almost never - // occur in practice. + /* + This is a bit of a hack but lets us do quicker per-character checks in + the fast path code. The safe min/max values are very unlikely to extend + into the range of surrogate characters, but if they do we must not test + any values in that range. To see why, consider the case where: + safeMin <= {hi,lo} <= safeMax + where {hi,lo} are characters forming a surrogate pair such that: + codePointOf(hi, lo) > safeMax + which would result in the surrogate pair being (wrongly) considered safe. + If we clip the safe range used during the per-character tests so it is + below the values of characters in surrogate pairs, this cannot occur. + This approach does mean that we break out of the fast path code in cases + where we don't strictly need to, but this situation will almost never + occur in practice. + */ if (safeMin >= Character.MIN_HIGH_SURROGATE) { this.safeMinChar = Character.MAX_VALUE; this.safeMaxChar = 0;