Restore constants for MIN_VERSION and MAX_VERSION.

pull/28/head
Christopher Schultz 8 years ago
parent 78c8f41e81
commit 586eb38ebe

@ -93,7 +93,7 @@ public final class QrCode {
* @throws IllegalArgumentException if the data is too long to fit in the largest version QR Code at the ECL * @throws IllegalArgumentException if the data is too long to fit in the largest version QR Code at the ECL
*/ */
public static QrCode encodeSegments(List<QrSegment> segs, Ecc ecl) { public static QrCode encodeSegments(List<QrSegment> segs, Ecc ecl) {
return encodeSegments(segs, ecl, 1, 40, -1, true); return encodeSegments(segs, ecl, MIN_VERSION, MAX_VERSION, -1, true);
} }
@ -117,7 +117,7 @@ public final class QrCode {
public static QrCode encodeSegments(List<QrSegment> segs, Ecc ecl, int minVersion, int maxVersion, int mask, boolean boostEcl) { public static QrCode encodeSegments(List<QrSegment> segs, Ecc ecl, int minVersion, int maxVersion, int mask, boolean boostEcl) {
Objects.requireNonNull(segs); Objects.requireNonNull(segs);
Objects.requireNonNull(ecl); Objects.requireNonNull(ecl);
if (!(1 <= minVersion && minVersion <= maxVersion && maxVersion <= 40) || mask < -1 || mask > 7) if (!(MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION) || mask < -1 || mask > 7)
throw new IllegalArgumentException("Invalid value"); throw new IllegalArgumentException("Invalid value");
// Find the minimal version number to use // Find the minimal version number to use
@ -161,10 +161,13 @@ public final class QrCode {
// Create the QR Code symbol // Create the QR Code symbol
return new QrCode(version, ecl, bb.getBytes(), mask); return new QrCode(version, ecl, bb.getBytes(), mask);
} }
/*---- Public constants ----*/
/*---- Instance fields ----*/ public static final int MIN_VERSION = 1;
public static final int MAX_VERSION = 40;
/*---- Instance fields ----*/
// Public immutable scalar parameters // Public immutable scalar parameters

Loading…
Cancel
Save