harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko" <mloe...@gmail.com>
Subject [classlib][swing] an odd code in swing
Date Tue, 05 Dec 2006 07:07:37 GMT
I don't understand why array is created on each iteration of the loop and
suggest to move it up (see below). Any reason behind the current behavior?

Index: modules/swing/src/main/java/common/javax/swing/TransferHandler.java
==========================================================
--- modules/swing/src/main/java/common/javax/swing/TransferHandler.java
(revision 482512)
+++ modules/swing/src/main/java/common/javax/swing/TransferHandler.java
(working copy)
@@ -286,9 +286,10 @@
            beanInfo = Introspector.getBeanInfo(c.getClass());
         } catch (IntrospectionException e) {
         }
-        for (int i = 0; i < beanInfo.getPropertyDescriptors().length; i++) {
-            String name = beanInfo.getPropertyDescriptors()[i]
-                          .getName();
+
+        PropertyDescriptor[] list = beanInfo.getPropertyDescriptors();
+        for (int i = 0; i < list.length; i++) {
+            String name = list[i].getName();
             if (name.equals(propertyName)) {
                 return COPY;
             }

Mime
View raw message