summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-06-30 14:30:55 -0700
committerDeepanshu Gupta <deepanshu@google.com>2015-06-30 15:36:34 -0700
commitc77f9c76e4142db8dd76a28ad99b8f0395b82eba (patch)
treeb9a1629b9288ab652e4bbb01b3928bfe9c97f18a
parent5d1eaf4a197130f561b16c4ed083cf016b20ab92 (diff)
downloadframeworks_base-c77f9c76e4142db8dd76a28ad99b8f0395b82eba.zip
frameworks_base-c77f9c76e4142db8dd76a28ad99b8f0395b82eba.tar.gz
frameworks_base-c77f9c76e4142db8dd76a28ad99b8f0395b82eba.tar.bz2
Replace infinite loop with foreach.
A method call exists to find all inner classes. Use it instead of manually enumerating the possibilities and checking. Also fix a typo. Change-Id: I2af678e92ea0c11b53617b247d8cda324391c185
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java2
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java10
2 files changed, 3 insertions, 9 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
index 8b8cc38..958b7aa 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
@@ -151,7 +151,7 @@ public class AppCompatActionBar extends BridgeActionBar {
@Override
public void createMenuPopup() {
- // it's hard to addd menus to appcompat's actionbar, since it'll use a lot of reflection.
+ // it's hard to add menus to appcompat's actionbar, since it'll use a lot of reflection.
// so we skip it for now.
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
index f6c2626..dae5509 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
@@ -94,14 +94,8 @@ public class AsmGenerator {
ListIterator<Class<?>> iter = injectedClasses.listIterator();
while (iter.hasNext()) {
Class<?> clazz = iter.next();
- try {
- int i = 1;
- while(i < 100) {
- iter.add(Class.forName(clazz.getName() + "$" + i));
- i++;
- }
- } catch (ClassNotFoundException ignored) {
- // Expected.
+ for (Class<?> aClass : clazz.getDeclaredClasses()) {
+ iter.add(aClass);
}
}
mInjectClasses = injectedClasses.toArray(new Class<?>[0]);