@@ -32,9 +32,12 @@ static final class RandomGeneratorNextDouble {
3232 }
3333
3434 /**
35- * Prefer {@link RandomGenerator#nextDouble(double origin, double bound)} over more contrived
36- * alternatives .
35+ * Prefer {@link RandomGenerator#nextDouble(double origin, double bound)} over alternatives that
36+ * may silently yield an ununiform domain of values .
3737 */
38+ // XXX: This rule assumes that `a` is not an expensive or side-effectful expression.
39+ // XXX: The replacement code throws an `IllegalArgumentException` in more cases than the original
40+ // code, but only in situations that are likely unintended.
3841 static final class RandomGeneratorNextDoubleWithOrigin {
3942 @ BeforeTemplate
4043 double before (RandomGenerator random , double a , double b ) {
@@ -63,8 +66,12 @@ int after(RandomGenerator random, int bound) {
6366 }
6467
6568 /**
66- * Prefer {@link RandomGenerator#nextInt(int origin, int bound)} over more contrived alternatives.
69+ * Prefer {@link RandomGenerator#nextInt(int origin, int bound)} over alternatives that may
70+ * silently yield values outside the intended domain.
6771 */
72+ // XXX: This rule assumes that `a` is not an expensive or side-effectful expression.
73+ // XXX: The replacement code throws an `IllegalArgumentException` in more cases than the original
74+ // code, but only in situations that are likely unintended.
6875 static final class RandomGeneratorNextIntWithOrigin {
6976 @ BeforeTemplate
7077 int before (RandomGenerator random , int a , int b ) {
@@ -111,6 +118,9 @@ long after(RandomGenerator random, long bound) {
111118 * Prefer {@link RandomGenerator#nextLong(long origin, long bound)} over more contrived
112119 * alternatives.
113120 */
121+ // XXX: This rule assumes that `a` is not an expensive or side-effectful expression.
122+ // XXX: The replacement code throws an `IllegalArgumentException` in more cases than the original
123+ // code, but only in situations that are likely unintended.
114124 static final class RandomGeneratorNextLongWithOrigin {
115125 @ BeforeTemplate
116126 long before (RandomGenerator random , long a , long b ) {
0 commit comments