summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-05-15 00:00:42 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-15 00:00:42 +0000
commitf50742b12de14da449de8680791c3ee0f6c4d854 (patch)
tree5fb83f5e19fb918c4d5c7fcc4931ba91b80615e0 /graphics
parent3eb9882a67167141817faef6556c0393fa6bab72 (diff)
parent76ee05d4f6a8ddafd2125db69e7560dab7cb2e8a (diff)
downloadframeworks_base-f50742b12de14da449de8680791c3ee0f6c4d854.zip
frameworks_base-f50742b12de14da449de8680791c3ee0f6c4d854.tar.gz
frameworks_base-f50742b12de14da449de8680791c3ee0f6c4d854.tar.bz2
am 76ee05d4: am d05c7d26: am bcf76242: Merge "Move FLATTENED_PATTERN to inner class."
* commit '76ee05d4f6a8ddafd2125db69e7560dab7cb2e8a': Move FLATTENED_PATTERN to inner class.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Rect.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index 8b5609f..437d2f4 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -36,9 +36,21 @@ public final class Rect implements Parcelable {
public int right;
public int bottom;
- private static final Pattern FLATTENED_PATTERN = Pattern.compile(
+ /**
+ * A helper class for flattened rectange pattern recognition. A separate
+ * class to avoid an initialization dependency on a regular expression
+ * causing Rect to not be initializable with an ahead-of-time compilation
+ * scheme.
+ */
+ private static final class UnflattenHelper {
+ private static final Pattern FLATTENED_PATTERN = Pattern.compile(
"(-?\\d+) (-?\\d+) (-?\\d+) (-?\\d+)");
+ static Matcher getMatcher(String str) {
+ return FLATTENED_PATTERN.matcher(str);
+ }
+ }
+
/**
* Create a new empty Rect. All coordinates are initialized to 0.
*/
@@ -152,7 +164,7 @@ public final class Rect implements Parcelable {
* or null if the string is not of that form.
*/
public static Rect unflattenFromString(String str) {
- Matcher matcher = FLATTENED_PATTERN.matcher(str);
+ Matcher matcher = UnflattenHelper.getMatcher(str);
if (!matcher.matches()) {
return null;
}